Skip to content

Commit 473c3cc

Browse files
sandip4ntorvalds
authored andcommitted
selftests: vm: pkeys: use the correct page size on powerpc
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. In some cases, we need to enforce function alignment on page size. Since this can only be done at build time, 64K is used as the alignment factor as that also ensures 4K alignment. Signed-off-by: Sandipan Das <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Dave Hansen <[email protected]> Cc: "Desnes A. Nunes do Rosario" <[email protected]> Cc: Florian Weimer <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ram Pai <[email protected]> Cc: Thiago Jung Bauermann <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Michal Suchanek <[email protected]> Cc: Shuah Khan <[email protected]> Link: http://lkml.kernel.org/r/5dcdfbf3353acdc90f315172e800b49f5ca21299.1585646528.git.sandipan@linux.ibm.com Signed-off-by: Linus Torvalds <[email protected]>
1 parent e950639 commit 473c3cc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tools/testing/selftests/vm/pkey-powerpc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
pkey-31 and exec-only key */
3333
#define PKEY_BITS_PER_PKEY 2
3434
#define HPAGE_SIZE (1UL << 24)
35-
#define PAGE_SIZE (1UL << 16)
35+
#define PAGE_SIZE sysconf(_SC_PAGESIZE)
3636

3737
static inline u32 pkey_bit_position(int pkey)
3838
{

tools/testing/selftests/vm/protection_keys.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ void abort_hooks(void)
146146
* will then fault, which makes sure that the fault code handles
147147
* execute-only memory properly.
148148
*/
149+
#ifdef __powerpc64__
150+
/* This way, both 4K and 64K alignment are maintained */
151+
__attribute__((__aligned__(65536)))
152+
#else
149153
__attribute__((__aligned__(PAGE_SIZE)))
154+
#endif
150155
void lots_o_noops_around_write(int *write_to_me)
151156
{
152157
dprintf3("running %s()\n", __func__);

0 commit comments

Comments
 (0)