Re: [PATCH -v3 1/3] resource: Fix region_intersects() vs add_memory_driver_managed()

From: Andrew Morton
Date: Sat Sep 07 2024 - 23:25:09 EST


On Fri, 6 Sep 2024 11:07:11 +0800 Huang Ying <ying.huang@xxxxxxxxx> wrote:

> On a system with CXL memory, the resource tree (/proc/iomem) related
> to CXL memory may look like something as follows.
>
> 490000000-50fffffff : CXL Window 0
> 490000000-50fffffff : region0
> 490000000-50fffffff : dax0.0
> 490000000-50fffffff : System RAM (kmem)
>
> Because drivers/dax/kmem.c calls add_memory_driver_managed() during
> onlining CXL memory, which makes "System RAM (kmem)" a descendant of
> "CXL Window X". This confuses region_intersects(), which expects all
> "System RAM" resources to be at the top level of iomem_resource. This
> can lead to bugs.
>
> ...
>
> Fixes: c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM")

Do you believe this should be fixed in earlier (-stable) kernels?