Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64

From: Zi Yan
Date: Thu Jul 03 2025 - 10:56:48 EST


On 3 Jul 2025, at 10:44, Dev Jain wrote:

> On 03/07/25 8:11 pm, Zi Yan wrote:
>> On 3 Jul 2025, at 2:06, Aboorva Devarajan wrote:
>>
>>> From: Donet Tom <donettom@xxxxxxxxxxxxx>
>>>
>>> PowerPC64 supports a 4PB virtual address space, but this test was
>>> previously limited to 512TB. This patch extends the coverage up to
>>> the full 4PB VA range on PowerPC64.
>>>
>>> Memory from 0 to 128TB is allocated without an address hint, while
>>> allocations from 128TB to 4PB use a hint address.
>>>
>>> Signed-off-by: Donet Tom <donettom@xxxxxxxxxxxxx>
>>> Signed-off-by: Aboorva Devarajan <aboorvad@xxxxxxxxxxxxx>
>>> ---
>>> tools/testing/selftests/mm/virtual_address_range.c | 6 ++++++
>>> 1 file changed, 6 insertions(+)
>>>
>>> diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c
>>> index e24c36a39f22..619acf0b9239 100644
>>> --- a/tools/testing/selftests/mm/virtual_address_range.c
>>> +++ b/tools/testing/selftests/mm/virtual_address_range.c
>>> @@ -50,6 +50,7 @@
>>> #define NR_CHUNKS_256TB (NR_CHUNKS_128TB * 2UL)
>>> #define NR_CHUNKS_384TB (NR_CHUNKS_128TB * 3UL)
>>> #define NR_CHUNKS_3840TB (NR_CHUNKS_128TB * 30UL)
>>> +#define NR_CHUNKS_3968TB (NR_CHUNKS_128TB * 31UL)
>>>
>>> #define ADDR_MARK_128TB (1UL << 47) /* First address beyond 128TB */
>>> #define ADDR_MARK_256TB (1UL << 48) /* First address beyond 256TB */
>>> @@ -59,6 +60,11 @@
>>> #define HIGH_ADDR_SHIFT 49
>>> #define NR_CHUNKS_LOW NR_CHUNKS_256TB
>>> #define NR_CHUNKS_HIGH NR_CHUNKS_3840TB
>>> +#elif defined(__PPC64__)
>>> +#define HIGH_ADDR_MARK ADDR_MARK_128TB
>>> +#define HIGH_ADDR_SHIFT 48
>>> +#define NR_CHUNKS_LOW NR_CHUNKS_128TB
>>> +#define NR_CHUNKS_HIGH NR_CHUNKS_3968TB
>>> #else
>>> #define HIGH_ADDR_MARK ADDR_MARK_128TB
>>> #define HIGH_ADDR_SHIFT 48
>> Could you also update the comment above this code to say PowerPC64 also
>> supports 4PB virtual address space?
>>
>> From the comment, arm64 supports 4PB but its NR_CHUNKS_HIGH is only 3840TB,
>> whereas PowerPC64 here can get to 3968TB. I do not know why arm64’s
>> 4PB is smaller. ;)
>
> The border for high VA space is 128 TB for x86 and ppc, for arm64 it
> is 256 TB.

Thank you for the explanation. :)

Best Regards,
Yan, Zi