selftests/vm/pkeys: fix assertion in test_pkey_alloc_exhaust()
authorRam Pai <linuxram@us.ibm.com>
Thu, 4 Jun 2020 23:52:22 +0000 (16:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:06:27 +0000 (19:06 -0700)
commitb0acc5d6bf333583b535f5caf1539d90c78519c2
tree850ccf8c4ae292bd29013d222ed069610472a5f9
parentc63e5e7f9942ac18bc6cc7e8853ad709e72e9f8b
selftests/vm/pkeys: fix assertion in test_pkey_alloc_exhaust()

Some pkeys which are valid on the hardware are reserved and not available
for application use.  These keys cannot be allocated.

test_pkey_alloc_exhaust() tries to account for these and has an assertion
which validates if all available pkeys have been exahaustively allocated.
However, the expression that is currently used is only valid for x86.  On
powerpc, a pkey is additionally reserved as compared to x86.  Hence, the
assertion is made to use an arch-specific helper to get the correct count
of reserved pkeys.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: "Desnes A. Nunes do Rosario" <desnesn@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Michal Suchanek <msuchanek@suse.de>
Cc: Shuah Khan <shuah@kernel.org>
Link: http://lkml.kernel.org/r/38b08d0318820ae46af3aa6048384fd8056c3df7.1585646528.git.sandipan@linux.ibm.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tools/testing/selftests/vm/protection_keys.c