[PATCH v2 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources
David Hildenbrand
david at redhat.com
Thu Mar 25 11:53:24 GMT 2021
It used to be true that we can have system RAM (IORESOURCE_SYSTEM_RAM |
IORESOURCE_BUSY) only on the first level in the resource tree. However,
this is no longer holds for driver-managed system RAM (i.e., added via
dax/kmem and virtio-mem), which gets added on lower levels, for example,
inside device containers.
We have two users of walk_system_ram_res(), which currently only
consideres the first level:
a) kernel/kexec_file.c:kexec_walk_resources() -- We properly skip
IORESOURCE_SYSRAM_DRIVER_MANAGED resources via
locate_mem_hole_callback(), so even after this change, we won't be
placing kexec images onto dax/kmem and virtio-mem added memory. No
change.
b) arch/x86/kernel/crash.c:fill_up_crash_elf_data() -- we're currently
not adding relevant ranges to the crash elf header, resulting in them
not getting dumped via kdump.
This change fixes loading a crashkernel via kexec_file_load() and including
dax/kmem and virtio-mem added System RAM in the crashdump on x86-64. Note
that e.g,, arm64 relies on memblock data and, therefore, always considers
all added System RAM already.
Let's find all IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY resources, making
the function behave like walk_system_ram_range().
Fixes: ebf71552bb0e ("virtio-mem: Add parent resource for all added "System RAM"")
Fixes: c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM")
Reviewed-by: Dan Williams <dan.j.williams at intel.com>
Acked-by: Baoquan He <bhe at redhat.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Dan Williams <dan.j.williams at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
Cc: Dave Young <dyoung at redhat.com>
Cc: Baoquan He <bhe at redhat.com>
Cc: Vivek Goyal <vgoyal at redhat.com>
Cc: Dave Hansen <dave.hansen at linux.intel.com>
Cc: Keith Busch <keith.busch at intel.com>
Cc: Michal Hocko <mhocko at suse.com>
Cc: Qian Cai <cai at lca.pw>
Cc: Oscar Salvador <osalvador at suse.de>
Cc: Eric Biederman <ebiederm at xmission.com>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Borislav Petkov <bp at alien8.de>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: Tom Lendacky <thomas.lendacky at amd.com>
Cc: Brijesh Singh <brijesh.singh at amd.com>
Cc: x86 at kernel.org
Cc: kexec at lists.infradead.org
Signed-off-by: David Hildenbrand <david at redhat.com>
---
kernel/resource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 627e61b0c124..4efd6e912279 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -457,7 +457,7 @@ int walk_system_ram_res(u64 start, u64 end, void *arg,
{
unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
- return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, true,
+ return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, false,
arg, func);
}
--
2.29.2
More information about the kexec
mailing list