Subject: Re: [PATCH v15 23/23] selftests: vm: pkeys: Use the correct page size on powerpc

From: Sandipan Das <[email-masked]>
Date: Thu, 16 Jan 2020 14:03:43 +0530

Hi Michael,

On 15/01/20 12:37 pm, Michael Ellerman wrote:
> Sandipan Das <[email-masked]> writes:
>> Both 4K and 64K pages are supported on powerpc. Parts of
>> the selftest code perform alignment computations based on
>> the PAGE_SIZE macro which is currently hardcoded to 64K
>> for powerpc. This causes some test failures on kernels
>> configured with 4K page size.
>>
>> This problem is solved by determining the correct page
>> size during the build process rather than hardcoding it
>> in the header file.
> 
> Doing it at build time is wrong, the test could be built on a 4K system
> and then run on a 64K system, or vice versa.
> 
> You should just use getpagesize() at runtime.
> 
> cheers
> 

The reason I chose to do it this way was because PAGE_SIZE also determines
the alignment for the function "lots_o_noops_around_write" (which is used
by some of the test cases). Since __attribute__((__aligned__(X))) requires
X to be a constant, I am not sure if there a way around this.

- Sandipan