2 * Copyright 2014, Michael Ellerman, IBM Corp.
3 * Licensed under GPLv2.
10 #include <sys/types.h>
18 * Tests we can setup an EBB on our child. Nothing interesting happens, because
19 * even though the event is enabled and running the child hasn't enabled the
20 * actual delivery of the EBBs.
23 static int victim_child(union pipe read_pipe
, union pipe write_pipe
)
27 FAIL_IF(wait_for_parent(read_pipe
));
28 FAIL_IF(notify_parent(write_pipe
));
30 /* Parent creates EBB event */
32 FAIL_IF(wait_for_parent(read_pipe
));
33 FAIL_IF(notify_parent(write_pipe
));
35 /* Check the EBB is enabled by writing PMC1 */
38 /* EBB event is enabled here */
39 for (i
= 0; i
< 1000000; i
++) ;
44 int ebb_on_child(void)
46 union pipe read_pipe
, write_pipe
;
50 FAIL_IF(pipe(read_pipe
.fds
) == -1);
51 FAIL_IF(pipe(write_pipe
.fds
) == -1);
55 /* NB order of pipes looks reversed */
56 exit(victim_child(write_pipe
, read_pipe
));
59 FAIL_IF(sync_with_child(read_pipe
, write_pipe
));
61 /* Child is running now */
63 event_init_named(&event
, 0x1001e, "cycles");
64 event_leader_ebb_init(&event
);
66 event
.attr
.exclude_kernel
= 1;
67 event
.attr
.exclude_hv
= 1;
68 event
.attr
.exclude_idle
= 1;
70 FAIL_IF(event_open_with_pid(&event
, pid
));
71 FAIL_IF(ebb_event_enable(&event
));
73 FAIL_IF(sync_with_child(read_pipe
, write_pipe
));
75 /* Child should just exit happily */
76 FAIL_IF(wait_for_child(pid
));
85 return test_harness(ebb_on_child
, "ebb_on_child");
This page took 0.068556 seconds and 6 git commands to generate.