summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/math/fpu_preempt.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/powerpc/math/fpu_preempt.c')
-rw-r--r--tools/testing/selftests/powerpc/math/fpu_preempt.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/tools/testing/selftests/powerpc/math/fpu_preempt.c b/tools/testing/selftests/powerpc/math/fpu_preempt.c
index 3e5b5663d244..24b5abacccdc 100644
--- a/tools/testing/selftests/powerpc/math/fpu_preempt.c
+++ b/tools/testing/selftests/powerpc/math/fpu_preempt.c
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2015, Cyril Bur, IBM Corp.
+ * Copyright 2023, Michael Ellerman, IBM Corp.
*
* This test attempts to see if the FPU registers change across preemption.
- * Two things should be noted here a) The check_fpu function in asm only checks
- * the non volatile registers as it is reused from the syscall test b) There is
- * no way to be sure preemption happened so this test just uses many threads
- * and a long wait. As such, a successful test doesn't mean much but a failure
- * is bad.
+ * There is no way to be sure preemption happened so this test just uses many
+ * threads and a long wait. As such, a successful test doesn't mean much but
+ * a failure is bad.
*/
#include <stdio.h>
@@ -30,9 +29,7 @@
#define THREAD_FACTOR 8
-__thread double darray[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
- 2.1};
+__thread double darray[32];
int threads_starting;
int running;
@@ -45,7 +42,7 @@ void *preempt_fpu_c(void *p)
int i;
srand(pthread_self());
- for (i = 0; i < 21; i++)
+ for (i = 0; i < ARRAY_SIZE(darray); i++)
darray[i] = rand();
rc = preempt_fpu(darray, &threads_starting, &running);