vmcoreinfo: export SECTION_HAS_MEM_MAP
Subsystems (3)
PATCH 1/1 vmcoreinfo: export SECTION_HAS_MEM_MAP
The crash tool currently hardcodes SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying on SECTION_MARKED_PRESENT, it should switch to SECTION_HAS_MEM_MAP).
Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups" [1]
This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)
kernel/vmcore_info.c +1 -0
@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);
---
base-commit: 57e4ac91fc62d75d84b5a03827a19ceb4094ecd9
change-id: 20260928-section_has_mem_map-6205dc90a09f
--
Cheers,
David
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0
kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);
It would be good to add one section in Documentation/admin-guide/kdump/vmcoreinfo.rst, e.g
SECTION_HAS_MEM_MAP
-------------------
Indicates a memory section has struct page array (mem_map). User-space tools should read this value but not hardcode it since the bit position could change between kernel versions.
The code change looks good to me.
Quoted 13 lines
---
base-commit:
57e4ac91fc62d75d84b5a03827a19ceb4094ecd9change-id: 20260928-section_has_mem_map-6205dc90a09f
--
Cheers,
David
Quoted 37 lines · Baoquan He
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);It would be good to add one section in
Documentation/admin-guide/kdump/vmcoreinfo.rst, e.g
Quoted 6 lines
SECTION_HAS_MEM_MAP
-------------------Indicates a memory section has struct page array (
mem_map). User-space tools should read this value but not hardcode it since the bit position could change between kernel versions.
I'm not particularly happy about having core-kernel defines documented in kdump/vmcoreinfo.rst, though?
If it would be something vmcoreinfo special, sure. But not for basic defines.
"See the kernel source code" is really what anybody using this should be doing?
Signature · 3 lines
Cheers, David
Baoquan He
Acked-byQuoted 45 lines · David Hildenbrand (Arm)
Quoted 37 lines · Baoquan He
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);It would be good to add one section in
Documentation/admin-guide/kdump/vmcoreinfo.rst, e.gQuoted 6 lines
SECTION_HAS_MEM_MAP
-------------------Indicates a memory section has struct page array (
mem_map). User-space tools should read this value but not hardcode it since the bit position could change between kernel versions.
Quoted 6 lines
I'm not particularly happy about having core-kernel defines documented in
kdump/vmcoreinfo.rst, though?If it would be something vmcoreinfo special, sure. But not for basic defines.
"See the kernel source code" is really what anybody using this should be doing?
I can't remember who suggested adding this document. The benefit is users can read document to understand how it works, no need to look at the code. I don't have strong preference on this.
So I am fine with both. Or we can add it if anyone really complains.
For the patch itself,
Thanks
Baoquan
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0
kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);
Current crash code looks below:
#define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_IS_ONLINE (1UL<<2) #define SECTION_IS_EARLY (1UL<<3) #define SECTION_TAINT_ZONE_DEVICE (1UL<<4) #define SECTION_MAP_LAST_BIT (1UL<<5) #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
And it does not match the kernel for below chunk with ifdef #ifdef CONFIG_ZONE_DEVICE
SECTION_TAINT_ZONE_DEVICE_BIT,
#endif
#ifdef CONFIG_SPARSEMEM_VMEMMAP_PREINIT
SECTION_IS_VMEMMAP_PREINIT_BIT,
#endif
The last bit could be wrong in crash. So all numbers should be exported in vmcoreinfo.
Thoughts?
ThanksDave
Quoted 52 lines · Dave Young
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);Current crash code looks below:
#define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_IS_ONLINE (1UL<<2) #define SECTION_IS_EARLY (1UL<<3) #define SECTION_TAINT_ZONE_DEVICE (1UL<<4) #define SECTION_MAP_LAST_BIT (1UL<<5) #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))And it does not match the kernel for below chunk with ifdef #ifdef
CONFIG_ZONE_DEVICE
SECTION_TAINT_ZONE_DEVICE_BIT,
#endif
#ifdefCONFIG_SPARSEMEM_VMEMMAP_PREINIT
SECTION_IS_VMEMMAP_PREINIT_BIT,
#endif
Quoted 3 lines
The last bit could be wrong in crash. So all numbers should be exported in vmcoreinfo.
Thoughts?
You know the crash code best, so likely ... it's time one of the crash people takes over this patch?
Signature · 3 lines
Cheers, David
Quoted 53 lines · David Hildenbrand (Arm)
Quoted 52 lines · Dave Young
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);Current crash code looks below:
#define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_IS_ONLINE (1UL<<2) #define SECTION_IS_EARLY (1UL<<3) #define SECTION_TAINT_ZONE_DEVICE (1UL<<4) #define SECTION_MAP_LAST_BIT (1UL<<5) #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))And it does not match the kernel for below chunk with ifdef #ifdef
CONFIG_ZONE_DEVICE
SECTION_TAINT_ZONE_DEVICE_BIT,
#endif
#ifdefCONFIG_SPARSEMEM_VMEMMAP_PREINIT
SECTION_IS_VMEMMAP_PREINIT_BIT,
#endif
Quoted 6 lines
Quoted 3 lines
The last bit could be wrong in crash. So all numbers should be exported in vmcoreinfo.
Thoughts?
You know the crash code best, so likely ... it's time one of the crash people takes over this patch?
Rethinking about it I'm hesitating to add many more to vmcoreinfo although it is reasonable, about the #ifdef things, there are other places other than mm, crash can not depend on the /proc/config.gz which is not reliable in the old kernel memory, maybe it will be helpful to export another elf note for old kernel's kconfig. So I'd like to support to use your patch for the time being as the first bit is always needed and leave the remaining concerns a follow up item.
Thanks
Dave
Quoted 54 lines · Dave Young
Quoted 53 lines · David Hildenbrand (Arm)
Quoted 52 lines · Dave Young
Quoted 25 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +0
-0kernel/vmcore_info.c static int __init crash_save_vmcoreinfo_init(void) · line 188
Quoted 7 lines
kernel/vmcore_info.c +1
-0@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page);Current crash code looks below:
#define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_IS_ONLINE (1UL<<2) #define SECTION_IS_EARLY (1UL<<3) #define SECTION_TAINT_ZONE_DEVICE (1UL<<4) #define SECTION_MAP_LAST_BIT (1UL<<5) #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))And it does not match the kernel for below chunk with ifdef #ifdef
CONFIG_ZONE_DEVICE
SECTION_TAINT_ZONE_DEVICE_BIT,
#endif
#ifdefCONFIG_SPARSEMEM_VMEMMAP_PREINIT
SECTION_IS_VMEMMAP_PREINIT_BIT,
#endif
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The last bit could be wrong in crash. So all numbers should be exported in vmcoreinfo.
Thoughts?
You know the crash code best, so likely ... it's time one of the crash people takes over this patch?
Rethinking about it I'm hesitating to add many more to vmcoreinfo although it is reasonable, about the #ifdef things, there are other places other than mm, crash can not depend on the
/proc/config.gzwhich is not reliable in the old kernel memory, maybe it will be helpful to export another elf note for old kernel's kconfig. So I'd like to support to use your patch for the time being as the first bit is always needed and leave the remaining concerns a follow up item.
I agree, from makedumpfile's view point.
(to be exact, makedumpfile needs this but maybe crash can read enum values from vmlinux.)
Thanks,
Kazu
Quoted 3 lines
Thanks
Dave
Quoted 5 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 2 lines · Dave Young
Quoted 1 line · David Hildenbrand (Arm)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
You know the crash code best, so likely ... it's time one of the crash people takes over this patch?
Rethinking about it I'm hesitating to add many more to vmcoreinfo although it is reasonable, about the #ifdef things, there are other places other than mm, crash can not depend on the
/proc/config.gzwhich is not reliable in the old kernel memory, maybe it will be helpful to export another elf note for old kernel's kconfig. So I'd like to support to use your patch for the time being as the first bit is always needed and leave the remaining concerns a follow up item.I agree, from makedumpfile's view point.
(to be exact, makedumpfile needs this but maybe crash can read enum values from vmlinux.)
That's a good point, maybe that indeed works for crash.
Signature · 3 lines
Cheers, David
Quoted 6 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
I guess that works
Quoted 32 lines
Signed-off-by David Hildenbrand (Arm) <[email protected]>---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1]
https://lore.kernel.org/r/[email protected]
---kernel/vmcore_info.c| 1 +1 file changed, 1 insertion(+)kernel/vmcore_info.c +1
-1@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page); ---base-commit:
57e4ac91fc62d75d84b5a03827a19ceb4094ecd9
Quoted 10 lines
change-id: 20260928-section_has_mem_map-6205dc90a09f
--
Cheers,
David
--- Thanks!
"I'm not a very positive person" - Linus torvalds
Quoted 8 lines · David Hildenbrand (Arm)
The crash tool currently hardcodes
SECTION_HAS_MEM_MAP, and makedumpfile needs similar information (although still relying onSECTION_MARKED_PRESENT, it should switch toSECTION_HAS_MEM_MAP).Let's just export the value instead, so tools that work on vmcoreinfo will not have to guess.
Signed-off-by David Hildenbrand (Arm) <[email protected]>
Quoted 37 lines
---
Result of the discussion in reply to "[PATCH v2 00/13] mm/sparse: removeSECTION_MARKED_PRESENTand further cleanups" [1]This patch can go in independently. It would be preferable if both go into the same kernel release ;)
[1] https://lore.kernel.org/r/[email protected]
--- kernel/vmcore_info.c | 1 + 1 file changed, 1 insertion(+)kernel/vmcore_info.c +1
-1@@ -182,6 +182,7 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_STRUCT_SIZE (mem_section);VMCOREINFO_OFFSET (mem_section, section_mem_map);VMCOREINFO_NUMBER (SECTION_SIZE_BITS ); +VMCOREINFO_NUMBER (SECTION_HAS_MEM_MAP );VMCOREINFO_NUMBER (MAX_PHYSMEM_BITS );#endif VMCOREINFO_STRUCT_SIZE (page); ---base-commit:
57e4ac91fc62d75d84b5a03827a19ceb4094ecd9change-id: 20260928-section_has_mem_map-6205dc90a09f
--
Cheers,
David