2 * Copyright 2014, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
10 #include <sys/types.h>
18 * Tests a per-task event vs an EBB - in that order. The EBB should push the
19 * per-task event off the PMU.
22 static int setup_child_event(struct event
*event
, pid_t child_pid
)
24 event_init_named(event
, 0x400FA, "PM_RUN_INST_CMPL");
26 event
->attr
.exclude_kernel
= 1;
27 event
->attr
.exclude_hv
= 1;
28 event
->attr
.exclude_idle
= 1;
30 FAIL_IF(event_open_with_pid(event
, child_pid
));
31 FAIL_IF(event_enable(event
));
36 int task_event_vs_ebb(void)
38 union pipe read_pipe
, write_pipe
;
43 SKIP_IF(!ebb_is_supported());
45 FAIL_IF(pipe(read_pipe
.fds
) == -1);
46 FAIL_IF(pipe(write_pipe
.fds
) == -1);
50 /* NB order of pipes looks reversed */
51 exit(ebb_child(write_pipe
, read_pipe
));
54 /* We setup the task event first */
55 rc
= setup_child_event(&event
, pid
);
57 kill_child_and_wait(pid
);
61 /* Signal the child to install its EBB event and wait */
62 if (sync_with_child(read_pipe
, write_pipe
))
63 /* If it fails, wait for it to exit */
66 /* Signal the child to run */
67 FAIL_IF(sync_with_child(read_pipe
, write_pipe
));
70 /* The EBB event should push the task event off so the child should succeed */
71 FAIL_IF(wait_for_child(pid
));
72 FAIL_IF(event_disable(&event
));
73 FAIL_IF(event_read(&event
));
77 /* The task event may have run, or not so we can't assert anything about it */
84 return test_harness(task_event_vs_ebb
, "task_event_vs_ebb");
This page took 0.035913 seconds and 5 git commands to generate.