diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2020-08-13 04:34:43 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-09-08 15:23:42 +0300 |
commit | c0176429b7b07893a5c1fd38baff055c919ba9e3 (patch) | |
tree | 620f668966ad6c1b4a75a918f22f8d509f62757b /tools/testing/selftests/powerpc/tm/tm-unavailable.c | |
parent | 10bf59d923c2766ec8d6f0243481c865c7db9979 (diff) | |
download | linux-c0176429b7b07893a5c1fd38baff055c919ba9e3.tar.xz |
selftests/powerpc: Fix TM tests when CPU 0 is offline
Several of the TM tests fail spuriously if CPU 0 is offline, because
they blindly try to affinitise to CPU 0.
Fix them by picking any online CPU and using that instead.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200813013445.686464-1-mpe@ellerman.id.au
Diffstat (limited to 'tools/testing/selftests/powerpc/tm/tm-unavailable.c')
-rw-r--r-- | tools/testing/selftests/powerpc/tm/tm-unavailable.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c index 2ca2fccb0a3e..a1348a5f721a 100644 --- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c +++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c @@ -338,16 +338,19 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr) int tm_unavailable_test(void) { - int rc, exception; /* FP = 0, VEC = 1, VSX = 2 */ + int cpu, rc, exception; /* FP = 0, VEC = 1, VSX = 2 */ pthread_t t1; pthread_attr_t attr; cpu_set_t cpuset; SKIP_IF(!have_htm()); - /* Set only CPU 0 in the mask. Both threads will be bound to CPU 0. */ + cpu = pick_online_cpu(); + FAIL_IF(cpu < 0); + + // Set only one CPU in the mask. Both threads will be bound to that CPU. CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); + CPU_SET(cpu, &cpuset); /* Init pthread attribute. */ rc = pthread_attr_init(&attr); |