Skip to content

Commit 2470216

Browse files
zhiquan1-liakpm00
authored andcommitted
crash: export PAGE_UNACCEPTED_MAPCOUNT_VALUE to vmcoreinfo
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 (~1/170). 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. [[email protected]: fix docs: "Title underline too short" warning] Link: https://lore.kernel.org/all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Zhiquan Li <[email protected]> Reviewed-by: Kirill A. Shutemov <[email protected]> Acked-by: Baoquan He <[email protected]> Cc: Dave Young <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Zhiquan Li <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3330dc1 commit 2470216

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Documentation/admin-guide/kdump/vmcoreinfo.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ PG_lru|PG_private|PG_swapcache|PG_swapbacked|PG_slab|PG_hwpoision|PG_head_mask|P
331331
Page attributes. These flags are used to filter various unnecessary for
332332
dumping pages.
333333

334-
PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)
335-
-----------------------------------------------------------------------------
334+
PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_unaccepted)
335+
-------------------------------------------------------------------------------------------------------------------------
336336

337337
More page attributes. These flags are used to filter various unnecessary for
338338
dumping pages.

kernel/vmcore_info.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ static int __init crash_save_vmcoreinfo_init(void)
210210
VMCOREINFO_NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE);
211211
#define PAGE_OFFLINE_MAPCOUNT_VALUE (PGTY_offline << 24)
212212
VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE);
213+
#ifdef CONFIG_UNACCEPTED_MEMORY
214+
#define PAGE_UNACCEPTED_MAPCOUNT_VALUE (PGTY_unaccepted << 24)
215+
VMCOREINFO_NUMBER(PAGE_UNACCEPTED_MAPCOUNT_VALUE);
216+
#endif
213217

214218
#ifdef CONFIG_KALLSYMS
215219
VMCOREINFO_SYMBOL(kallsyms_names);

0 commit comments

Comments
 (0)