.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright 2017, Gustavo Romero, IBM Corp. |
---|
3 | | - * Licensed under GPLv2. |
---|
4 | 4 | * |
---|
5 | 5 | * Check if thread endianness is flipped inadvertently to BE on trap |
---|
6 | 6 | * caught in TM whilst MSR.FP and MSR.VEC are zero (i.e. just after |
---|
.. | .. |
---|
247 | 247 | int tm_trap_test(void) |
---|
248 | 248 | { |
---|
249 | 249 | uint16_t k = 1; |
---|
250 | | - |
---|
251 | | - int rc; |
---|
| 250 | + int cpu, rc; |
---|
252 | 251 | |
---|
253 | 252 | pthread_attr_t attr; |
---|
254 | 253 | cpu_set_t cpuset; |
---|
.. | .. |
---|
267 | 266 | usr1_sa.sa_sigaction = usr1_signal_handler; |
---|
268 | 267 | sigaction(SIGUSR1, &usr1_sa, NULL); |
---|
269 | 268 | |
---|
270 | | - /* Set only CPU 0 in the mask. Both threads will be bound to cpu 0. */ |
---|
| 269 | + cpu = pick_online_cpu(); |
---|
| 270 | + FAIL_IF(cpu < 0); |
---|
| 271 | + |
---|
| 272 | + // Set only one CPU in the mask. Both threads will be bound to that CPU. |
---|
271 | 273 | CPU_ZERO(&cpuset); |
---|
272 | | - CPU_SET(0, &cpuset); |
---|
| 274 | + CPU_SET(cpu, &cpuset); |
---|
273 | 275 | |
---|
274 | 276 | /* Init pthread attribute */ |
---|
275 | 277 | rc = pthread_attr_init(&attr); |
---|