summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/dscr/dscr.h
diff options
context:
space:
mode:
authorBenjamin Gray <bgray@linux.ibm.com>2023-04-06 14:33:18 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2023-04-20 13:21:45 +1000
commit3067b89ab62305c54ec15b00a2c4dbaf64809c59 (patch)
tree6a0510188657f203925daa32b1f9ffebb5fb8c9d /tools/testing/selftests/powerpc/dscr/dscr.h
parentfda8158870063b99b88a0904bbb95188973b4297 (diff)
downloadlinux-next-3067b89ab62305c54ec15b00a2c4dbaf64809c59.tar.gz
selftests/powerpc/dscr: Improve DSCR explicit random test case
The tests currently have a single writer thread updating the system DSCR with a 1/1000 chance looped only 100 times. So only around one in 10 runs actually do anything. * Add multiple threads to the dscr_explicit_random_test case. * Use a barrier to make all the threads start work as simultaneously as possible. * Use a rwlock and make all threads have a reasonable chance to write to the DSCR on each iteration. PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is used to prevent writers from starving while all the other threads keep reading. Logging the reads/writes shows a decent mix across the whole test. * Allow all threads a chance to write. * Make the chance of writing more likely. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230406043320.125138-6-bgray@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/dscr/dscr.h')
-rw-r--r--tools/testing/selftests/powerpc/dscr/dscr.h4
1 files changed, 0 insertions, 4 deletions
diff --git a/tools/testing/selftests/powerpc/dscr/dscr.h b/tools/testing/selftests/powerpc/dscr/dscr.h
index 2c54998d4715..b281659071e8 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr.h
+++ b/tools/testing/selftests/powerpc/dscr/dscr.h
@@ -86,8 +86,4 @@ void set_default_dscr(unsigned long val)
}
}
-double uniform_deviate(int seed)
-{
- return seed * (1.0 / (RAND_MAX + 1.0));
-}
#endif /* _SELFTESTS_POWERPC_DSCR_DSCR_H */