[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ikvih5nv.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Fri, 30 Aug 2024 14:43:32 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Dan Williams <dan.j.williams@...el.com>
Cc: Bjorn Helgaas <helgaas@...nel.org>, Andrew Morton
<akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org, David
Hildenbrand <david@...hat.com>, Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>, Dave Jiang
<dave.jiang@...el.com>, Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny
<ira.weiny@...el.com>, Alistair Popple <apopple@...dia.com>, Andy
Shevchenko <andriy.shevchenko@...ux.intel.com>, Bjorn Helgaas
<bhelgaas@...gle.com>, Baoquan He <bhe@...hat.com>
Subject: Re: [PATCH -v2] Resource: fix region_intersects() for CXL memory
Hi, Dan,
Dan Williams <dan.j.williams@...el.com> writes:
> Hi Bjorn,
>
> Ying is out for the next week or so, so I will address your comments and
> resubmit as I think this is a potentially urgent fix.
Just come back. Thank you very much for your kind help!
> Bjorn Helgaas wrote:
>> On Mon, Aug 19, 2024 at 10:34:13AM +0800, Huang Ying wrote:
>> > On a system with CXL memory installed, the resource tree (/proc/iomem)
[snip]
>> > In the above resource tree, "System RAM" is a descendant of "CXL
>> > Window 0" instead of a top level resource. So, region_intersects()
>> > will report no System RAM resources in the CXL memory region
>> > incorrectly, because it only checks the top level resources.
>> > Consequently, devmem_is_allowed() will return 1 (allow access via
>> > /dev/mem) for CXL memory region incorrectly. Fortunately, ioremap()
>> > doesn't allow to map System RAM and reject the access.
>> >
>> > However, region_intersects() needs to be fixed to work correctly with
>> > the resources tree with CXL Window as above. To fix it, if we found a
>> > unmatched resource in the top level, we will continue to search
>> > matched resources in its descendant resources. So, we will not miss
>> > any matched resources in resource tree anymore. In the new
>> > implementation,
>> >
>> > |------------- "CXL Window 0" ------------|
>> > |-- "System RAM" --|
>> >
>> > will look as if
>> >
>> > |-- "System RAM" --||-- "CXL Window 0a" --|
>>
>> Where did "0a" come from? The /proc/iomem above mentioned
>> "CXL Window 0"; is the "a" spurious? Same question applies to the
>> code comment below.
>
> Not sure where that came from, will clean up and provide a test that can
> upstreammed as well.
Sorry for confusing!
>> > |-- "System RAM" --||-- "CXL Window 0a" --|
This isn't the real resource tree. The real resource tree is still
>> > |------------- "CXL Window 0" ------------|
>> > |-- "System RAM" --|
While,
>> > |-- "System RAM" --||-- "CXL Window 0a" --|
is just used to demonstrate the effect of the algorithm. That is, a
part of "CXL Window 0" is covered (or masked) by "System RAM" now. The
remaining effective part of "CXL Window 0" is smaller, I used "CXL
Window 0a" to designate that it comes from "CXL Window 0", but it's not
exactly "CXL Window 0".
--
Best Regards,
Huang, Ying
Powered by blists - more mailing lists