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

Aboorva Devarajan posted 7 patches 3 months ago
There is a newer version of this series
[PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Aboorva Devarajan 3 months ago
From: Donet Tom <donettom@linux.ibm.com>

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@linux.ibm.com>
Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
---
 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
-- 
2.43.5
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Zi Yan 3 months ago
On 3 Jul 2025, at 2:06, Aboorva Devarajan wrote:

> From: Donet Tom <donettom@linux.ibm.com>
>
> 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@linux.ibm.com>
> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
> ---
>  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. ;)

Otherwise, the patch looks good to me.

Reviewed-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Donet Tom 3 months ago
On 7/3/25 8:11 PM, Zi Yan wrote:
> On 3 Jul 2025, at 2:06, Aboorva Devarajan wrote:
>
>> From: Donet Tom <donettom@linux.ibm.com>
>>
>> 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@linux.ibm.com>
>> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
>> ---
>>   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?


Sure. I will add


>
>  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. ;)
>
> Otherwise, the patch looks good to me.
>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
>
> Best Regards,
> Yan, Zi
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Dev Jain 3 months ago
On 03/07/25 8:11 pm, Zi Yan wrote:
> On 3 Jul 2025, at 2:06, Aboorva Devarajan wrote:
>
>> From: Donet Tom <donettom@linux.ibm.com>
>>
>> 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@linux.ibm.com>
>> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
>> ---
>>   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.

>
> Otherwise, the patch looks good to me.
>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
>
> Best Regards,
> Yan, Zi
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Zi Yan 3 months ago
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@linux.ibm.com>
>>>
>>> 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@linux.ibm.com>
>>> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
>>> ---
>>>   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
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by David Hildenbrand 3 months ago
On 03.07.25 08:06, Aboorva Devarajan wrote:
> From: Donet Tom <donettom@linux.ibm.com>
> 
> 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@linux.ibm.com>
> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>

Comment applies to all patches in this series:

See Documentation/process/submitting-patches.rst, in particular "Example 
of a patch submitted by a Co-developed-by: author::"

If you are a co-developer of any of these patches (and not simply resend 
them without touching them), you should have a

Co-developed-by: Aboorva Devarajan <aboorvad@linux.ibm.com>

above your Signed-off-by


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


Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb
Re: [PATCH v2 2/7] selftests/mm: Add support to test 4PB VA on PPC64
Posted by Dev Jain 3 months ago
On 03/07/25 11:36 am, Aboorva Devarajan wrote:
> From: Donet Tom <donettom@linux.ibm.com>
>
> 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@linux.ibm.com>
> Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
> ---

Would have saved us a lot of time if we had figured out that
the problem wasn't the gap logic but the large VA space support,
anyhow digging down that rabbit hole gave me some knowledge
on VMA allocation stuff : )

Reviewed-by: Dev Jain <dev.jain@arm.com>