[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ee8db861-3632-48a1-977d-b05670d9637a@arm.com>
Date: Wed, 28 May 2025 11:53:20 +0100
From: Ryan Roberts <ryan.roberts@....com>
To: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>, Shuah Khan <shuah@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Ingo Molnar
<mingo@...hat.com>, Peter Xu <peterx@...hat.com>, Dev Jain
<dev.jain@....com>, Aishwarya TCV <Aishwarya.TCV@....com>
Subject: Re: [PATCH v2] selftests/mm: add simple VM_PFNMAP tests based on
mmap'ing /dev/mem
On 28/05/2025 11:48, David Hildenbrand wrote:
> On 28.05.25 12:44, David Hildenbrand wrote:
>> On 28.05.25 12:34, Ryan Roberts wrote:
>>> Hi David,
>>>
>>>
>>> On 09/05/2025 16:30, David Hildenbrand wrote:
>>>> Let's test some basic functionality using /dev/mem. These tests will
>>>> implicitly cover some PAT (Page Attribute Handling) handling on x86.
>>>>
>>>> These tests will only run when /dev/mem access to the first two pages
>>>> in physical address space is possible and allowed; otherwise, the tests
>>>> are skipped.
>>>
>>> We are seeing really horrible RAS errors with this test when run on arm64 tx2
>>> machine. Based solely on reviewing the code, I think the problem is that tx2
>>> doesn't have anything at phys address 0, so test_read_access() is trying to put
>>> trasactions out to a bad address on the bus.
>>>
>>> tx2 /proc/iomem:
>>>
>>> $ sudo cat /proc/iomem
>>> 30000000-37ffffff : PCI ECAM
>>> 38000000-3fffffff : PCI ECAM
>>> 40000000-5fffffff : PCI Bus 0000:00
>>> ...
>>>
>>> Whereas my x86 box has some reserved memory:
>>>
>>> $ sudo cat /proc/iomem
>>> 00000000-00000fff : Reserved
>>> 00001000-0003dfff : System RAM
>>> ...
>>>
>>
>> A quick fix would be to make this test specific to x86 (the only one I
>> tested on). We should always have the lower two pages IIRC (BIOS stuff etc).
I'm not sure how far along this patch is? I'm guessing mm-stable? Perhaps you
can do the quick fix, then I'd be happy to make this more robust for arm64 later?
>>
>>> I think perhaps the only safe way to handle this is to parse /proc/iomem for a
>>> region of "System RAM" that is at least 2 pages then use that for your read
>>> tests. This would also solve the hypothetical issue of reading something that
>>> has read size effects.
>>
>> That sounds also plausible yes. I somehow remembered that mmap() would
>> fail if "there is nothing".
>
> Ah, my memory comes back, we perform checks only with CONFIG_STRICT_DEVMEM.
Ahh makes sense. I guess our config doesn't include this. I just checked the RAS
error and it is for PA 0. So I'm confident that what I describe above is
definitely what is happening.
Powered by blists - more mailing lists