[PATCH v1 2/3] kernel/resource: make walk_mem_res() find all busy IORESOURCE_MEM resources

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Mar 23 11:08:40 GMT 2021


On Mon, Mar 22, 2021 at 05:01:59PM +0100, David Hildenbrand wrote:
> It used to be true that we can have system RAM only on the first level
> in the resourc tree. However, this is no longer holds for driver-managed
> system RAM (i.e., dax/kmem and virtio-mem).
> 
> The function walk_mem_res() only consideres the first level and is
> used in arch/x86/mm/ioremap.c:__ioremap_check_mem() only. We currently
> fail to identify System RAM added by dax/kmem and virtio-mem as
> "IORES_MAP_SYSTEM_RAM", for example, allowing for remapping of such
> "normal RAM" in __ioremap_caller().

Here I dunno, but consider to add Fixes tag if it fixes known bad behaviour.

> Let's find all busy IORESOURCE_MEM resources, making the function
> behave similar to walk_system_ram_res().
> 
> 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: Signed-off-by: David Hildenbrand <david at redhat.com>
> 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 4efd6e912279..16e0c7e8ed24 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -470,7 +470,7 @@ int walk_mem_res(u64 start, u64 end, void *arg,
>  {
>  	unsigned long flags = IORESOURCE_MEM | 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
> 

-- 
With Best Regards,
Andy Shevchenko





More information about the kexec mailing list