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

From: Huang, Ying
Date: Sun Sep 08 2024 - 21:01:27 EST


Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:

> 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?

Yes. I think that we should fix this in -stable kernels. Although no
severe bug will be triggered on x86 in the earlier kernels, it may be a
real bug for some other architectures.

--
Best Regards,
Huang, Ying