aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/mm/protection_keys.c
diff options
context:
space:
mode:
authorKevin Brodsky <kevin.brodsky@arm.com>2024-12-09 09:50:13 +0000
committerAndrew Morton <akpm@linux-foundation.org>2025-01-13 22:40:55 -0800
commit21309ac2652068f45ebb78a2e7a7cd3d5417350e (patch)
treeb8adc2de472d9b606bedb032eeb26274de011131 /tools/testing/selftests/mm/protection_keys.c
parentselftests/mm: define types using typedef in pkey-helpers.h (diff)
downloadwireguard-linux-21309ac2652068f45ebb78a2e7a7cd3d5417350e.tar.xz
wireguard-linux-21309ac2652068f45ebb78a2e7a7cd3d5417350e.zip
selftests/mm: ensure pkey-*.h define inline functions only
Headers should not define non-inline functions, as this prevents them from being included more than once in a given program. pkey-helpers.h and the arch-specific headers it includes currently define multiple such non-inline functions. In most cases those functions can simply be made inline - this patch does just that. read_ptr() is an exception as it must not be inlined. Since it is only called from protection_keys.c, we just move it there. Link: https://lkml.kernel.org/r/20241209095019.1732120-9-kevin.brodsky@arm.com Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Joey Gouly <joey.gouly@arm.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/testing/selftests/mm/protection_keys.c')
-rw-r--r--tools/testing/selftests/mm/protection_keys.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index fcbebc4490b4..82ece325b70c 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -54,6 +54,13 @@ int test_nr;
u64 shadow_pkey_reg;
int dprint_in_signal;
+noinline int read_ptr(int *ptr)
+{
+ /* Keep GCC from optimizing this away somehow */
+ barrier();
+ return *ptr;
+}
+
void cat_into_file(char *str, char *file)
{
int fd = open(file, O_RDWR);