aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/tm/tm-unavailable.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/powerpc/tm/tm-unavailable.c')
-rw-r--r--tools/testing/selftests/powerpc/tm/tm-unavailable.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
index 96c37f84ce54..e6a0fad2bfd0 100644
--- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c
+++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#define _GNU_SOURCE 17#define _GNU_SOURCE
18#include <error.h>
18#include <stdio.h> 19#include <stdio.h>
19#include <stdlib.h> 20#include <stdlib.h>
20#include <unistd.h> 21#include <unistd.h>
@@ -33,6 +34,11 @@
33#define VSX_UNA_EXCEPTION 2 34#define VSX_UNA_EXCEPTION 2
34 35
35#define NUM_EXCEPTIONS 3 36#define NUM_EXCEPTIONS 3
37#define err_at_line(status, errnum, format, ...) \
38 error_at_line(status, errnum, __FILE__, __LINE__, format ##__VA_ARGS__)
39
40#define pr_warn(code, format, ...) err_at_line(0, code, format, ##__VA_ARGS__)
41#define pr_err(code, format, ...) err_at_line(1, code, format, ##__VA_ARGS__)
36 42
37struct Flags { 43struct Flags {
38 int touch_fp; 44 int touch_fp;
@@ -303,10 +309,19 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
303 * checking if the failure cause is the one we expect. 309 * checking if the failure cause is the one we expect.
304 */ 310 */
305 do { 311 do {
312 int rc;
313
306 /* Bind 'ping' to CPU 0, as specified in 'attr'. */ 314 /* Bind 'ping' to CPU 0, as specified in 'attr'. */
307 pthread_create(&t0, attr, ping, (void *) &flags); 315 rc = pthread_create(&t0, attr, ping, (void *) &flags);
308 pthread_setname_np(t0, "ping"); 316 if (rc)
309 pthread_join(t0, &ret_value); 317 pr_err(rc, "pthread_create()");
318 rc = pthread_setname_np(t0, "ping");
319 if (rc)
320 pr_warn(rc, "pthread_setname_np");
321 rc = pthread_join(t0, &ret_value);
322 if (rc)
323 pr_err(rc, "pthread_join");
324
310 retries--; 325 retries--;
311 } while (ret_value != NULL && retries); 326 } while (ret_value != NULL && retries);
312 327
@@ -320,7 +335,7 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
320 335
321int main(int argc, char **argv) 336int main(int argc, char **argv)
322{ 337{
323 int exception; /* FP = 0, VEC = 1, VSX = 2 */ 338 int rc, exception; /* FP = 0, VEC = 1, VSX = 2 */
324 pthread_t t1; 339 pthread_t t1;
325 pthread_attr_t attr; 340 pthread_attr_t attr;
326 cpu_set_t cpuset; 341 cpu_set_t cpuset;
@@ -330,13 +345,23 @@ int main(int argc, char **argv)
330 CPU_SET(0, &cpuset); 345 CPU_SET(0, &cpuset);
331 346
332 /* Init pthread attribute. */ 347 /* Init pthread attribute. */
333 pthread_attr_init(&attr); 348 rc = pthread_attr_init(&attr);
349 if (rc)
350 pr_err(rc, "pthread_attr_init()");
334 351
335 /* Set CPU 0 mask into the pthread attribute. */ 352 /* Set CPU 0 mask into the pthread attribute. */
336 pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset); 353 rc = pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
337 354 if (rc)
338 pthread_create(&t1, &attr /* Bind 'pong' to CPU 0 */, pong, NULL); 355 pr_err(rc, "pthread_attr_setaffinity_np()");
339 pthread_setname_np(t1, "pong"); /* Name it for systemtap convenience */ 356
357 rc = pthread_create(&t1, &attr /* Bind 'pong' to CPU 0 */, pong, NULL);
358 if (rc)
359 pr_err(rc, "pthread_create()");
360
361 /* Name it for systemtap convenience */
362 rc = pthread_setname_np(t1, "pong");
363 if (rc)
364 pr_warn(rc, "pthread_create()");
340 365
341 flags.result = 0; 366 flags.result = 0;
342 367