mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
  2025-01-03  7:49 [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo Zhiquan Li
@ 2025-01-03  7:18 ` Dave Young
  2025-01-03  8:12   ` Zhiquan Li
  2025-01-03 14:26 ` Kirill A. Shutemov
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Young @ 2025-01-03  7:18 UTC (permalink / raw)
  To: Zhiquan Li; +Cc: bhe, vgoyal, kirill.shutemov, kexec, linux-kernel

On Fri, 3 Jan 2025 at 15:13, Zhiquan Li <zhiquan1.li@intel.com> wrote:
>
> On Intel TDX guest, unaccepted memory is unusable free memory which is
> not managed by buddy, until it's accepted by guest.  Before that, it
> cannot be accessed by the first kernel as well as the kexec'ed kernel.
> The kexec'ed kernel will skip these pages and fill in zero data for the
> reader of vmcore.
>
> The dump tool like makedumpfile creates a page descriptor (size 24
> bytes) for each non-free page, including zero data page, but it will not
> create descriptor for free pages.  If it is not able to distinguish
> these unaccepted pages with zero data pages, a certain amount of space
> will be wasted in proportion.  In fact, as a special kind of free page
> the unaccepted pages should be excluded, like the real free pages.
Hi,

>
> Export the page type PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo, so
> that dump tool can identify whether a page is unaccepted.
>
> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
> ---
>  kernel/vmcore_info.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c

Please add into admin-guide/kdump/vmcoreinfo.rst if you add more vmcoreinfo.

> index 1fec61603ef3..e066d31d08f8 100644
> --- a/kernel/vmcore_info.c
> +++ b/kernel/vmcore_info.c
> @@ -210,6 +210,10 @@ static int __init crash_save_vmcoreinfo_init(void)
>         VMCOREINFO_NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE);
>  #define PAGE_OFFLINE_MAPCOUNT_VALUE    (PGTY_offline << 24)
>         VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
> +#ifdef CONFIG_UNACCEPTED_MEMORY
> +#define PAGE_UNACCEPTED_MAPCOUNT_VALUE (PGTY_unaccepted << 24)
> +       VMCOREINFO_NUMBER(PAGE_UNACCEPTED_MAPCOUNT_VALUE);
> +#endif
>
>  #ifdef CONFIG_KALLSYMS
>         VMCOREINFO_SYMBOL(kallsyms_names);
>
> base-commit: fc033cf25e612e840e545f8d5ad2edd6ba613ed5
> --
> 2.25.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
@ 2025-01-03  7:49 Zhiquan Li
  2025-01-03  7:18 ` Dave Young
  2025-01-03 14:26 ` Kirill A. Shutemov
  0 siblings, 2 replies; 4+ messages in thread
From: Zhiquan Li @ 2025-01-03  7:49 UTC (permalink / raw)
  To: bhe, vgoyal, dyoung, kirill.shutemov; +Cc: kexec, linux-kernel, zhiquan1.li

On Intel TDX guest, unaccepted memory is unusable free memory which is
not managed by buddy, until it's accepted by guest.  Before that, it
cannot be accessed by the first kernel as well as the kexec'ed kernel.
The kexec'ed kernel will skip these pages and fill in zero data for the
reader of vmcore.

The dump tool like makedumpfile creates a page descriptor (size 24
bytes) for each non-free page, including zero data page, but it will not
create descriptor for free pages.  If it is not able to distinguish
these unaccepted pages with zero data pages, a certain amount of space
will be wasted in proportion.  In fact, as a special kind of free page
the unaccepted pages should be excluded, like the real free pages.

Export the page type PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo, so
that dump tool can identify whether a page is unaccepted.

Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
---
 kernel/vmcore_info.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c
index 1fec61603ef3..e066d31d08f8 100644
--- a/kernel/vmcore_info.c
+++ b/kernel/vmcore_info.c
@@ -210,6 +210,10 @@ static int __init crash_save_vmcoreinfo_init(void)
 	VMCOREINFO_NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE);
 #define PAGE_OFFLINE_MAPCOUNT_VALUE	(PGTY_offline << 24)
 	VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
+#ifdef CONFIG_UNACCEPTED_MEMORY
+#define PAGE_UNACCEPTED_MAPCOUNT_VALUE	(PGTY_unaccepted << 24)
+	VMCOREINFO_NUMBER(PAGE_UNACCEPTED_MAPCOUNT_VALUE);
+#endif
 
 #ifdef CONFIG_KALLSYMS
 	VMCOREINFO_SYMBOL(kallsyms_names);

base-commit: fc033cf25e612e840e545f8d5ad2edd6ba613ed5
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
  2025-01-03  7:18 ` Dave Young
@ 2025-01-03  8:12   ` Zhiquan Li
  0 siblings, 0 replies; 4+ messages in thread
From: Zhiquan Li @ 2025-01-03  8:12 UTC (permalink / raw)
  To: Dave Young; +Cc: bhe, vgoyal, kirill.shutemov, kexec, linux-kernel, zhiquan1.li


On 2025/1/3 15:18, Dave Young wrote:
> Please add into admin-guide/kdump/vmcoreinfo.rst if you add more vmcoreinfo.
> 

No problem, the changes as below will be added in V2.
Thanks for the comments.


--- a/Documentation/admin-guide/kdump/vmcoreinfo.rst
+++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst
@@ -331,7 +331,7 @@
PG_lru|PG_private|PG_swapcache|PG_swapbacked|PG_slab|PG_hwpoision|PG_head_mask|P
 Page attributes. These flags are used to filter various unnecessary for
 dumping pages.

-PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)
+PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_unaccepted)
 -----------------------------------------------------------------------------

 More page attributes. These flags are used to filter various
unnecessary for

Best Regards,
Zhiquan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
  2025-01-03  7:49 [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo Zhiquan Li
  2025-01-03  7:18 ` Dave Young
@ 2025-01-03 14:26 ` Kirill A. Shutemov
  1 sibling, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2025-01-03 14:26 UTC (permalink / raw)
  To: Zhiquan Li; +Cc: bhe, vgoyal, dyoung, kexec, linux-kernel

On Fri, Jan 03, 2025 at 03:49:41PM +0800, Zhiquan Li wrote:
> On Intel TDX guest, unaccepted memory is unusable free memory which is
> not managed by buddy, until it's accepted by guest.  Before that, it
> cannot be accessed by the first kernel as well as the kexec'ed kernel.
> The kexec'ed kernel will skip these pages and fill in zero data for the
> reader of vmcore.
> 
> The dump tool like makedumpfile creates a page descriptor (size 24
> bytes) for each non-free page, including zero data page, but it will not
> create descriptor for free pages.  If it is not able to distinguish
> these unaccepted pages with zero data pages, a certain amount of space
> will be wasted in proportion.  In fact, as a special kind of free page
> the unaccepted pages should be excluded, like the real free pages.
> 
> Export the page type PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo, so
> that dump tool can identify whether a page is unaccepted.
> 
> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-03 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-03  7:49 [PATCH] crash: Export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo Zhiquan Li
2025-01-03  7:18 ` Dave Young
2025-01-03  8:12   ` Zhiquan Li
2025-01-03 14:26 ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®