diff options
| author | Thadeu Lima de Souza Cascardo <cascardo@canonical.com> | 2021-02-25 17:19:49 +1100 |
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-04-23 01:38:03 +1000 |
| commit | da650ada100956b0f00aa4fe9ce33103378ce9ca (patch) | |
| tree | ec672731aae76998d1c665d5c47731f2e47ab51a /tools/testing/selftests/powerpc/security/flush_utils.c | |
| parent | 8a87a507714386efc39c3ae6fa24d4f79846b522 (diff) | |
selftests/powerpc: Add uaccess flush test
Also based on the RFI and entry flush tests, it counts the L1D misses
by doing a syscall that does user access: uname, in this case.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
[dja: forward port, rename function]
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210225061949.1213404-1-dja@axtens.net
Diffstat (limited to 'tools/testing/selftests/powerpc/security/flush_utils.c')
| -rw-r--r-- | tools/testing/selftests/powerpc/security/flush_utils.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/security/flush_utils.c b/tools/testing/selftests/powerpc/security/flush_utils.c index 0c3c4c40c7fb..4d95965cb751 100644 --- a/tools/testing/selftests/powerpc/security/flush_utils.c +++ b/tools/testing/selftests/powerpc/security/flush_utils.c @@ -13,6 +13,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <sys/utsname.h> #include "utils.h" #include "flush_utils.h" @@ -35,6 +36,18 @@ void syscall_loop(char *p, unsigned long iterations, } } +void syscall_loop_uaccess(char *p, unsigned long iterations, + unsigned long zero_size) +{ + struct utsname utsname; + + for (unsigned long i = 0; i < iterations; i++) { + for (unsigned long j = 0; j < zero_size; j += CACHELINE_SIZE) + load(p + j); + uname(&utsname); + } +} + static void sigill_handler(int signr, siginfo_t *info, void *unused) { static int warned; |
