|
10 | 10 | #include "header.h"
|
11 | 11 | #include "../perf-sys.h"
|
12 | 12 |
|
13 |
| -/* hw: cycles, sw: context-switch, uncore: [arch dependent] */ |
| 13 | +/* hw: cycles,instructions sw: context-switch, uncore: [arch dependent] */ |
14 | 14 | static int types[] = {0, 1, -1};
|
15 | 15 | static unsigned long configs[] = {0, 3, 0};
|
| 16 | +static unsigned long configs_hw[] = {1}; |
16 | 17 |
|
17 | 18 | #define NR_UNCORE_PMUS 5
|
18 | 19 |
|
@@ -93,7 +94,18 @@ static int run_test(int i, int j, int k)
|
93 | 94 | return erroneous ? 0 : -1;
|
94 | 95 | }
|
95 | 96 |
|
96 |
| - sibling_fd2 = event_open(types[k], configs[k], group_fd); |
| 97 | + /* |
| 98 | + * if all three events (leader and two sibling events) |
| 99 | + * are hardware events, use instructions as one of the |
| 100 | + * sibling event. There is event constraint in powerpc that |
| 101 | + * events using same counter cannot be programmed in a group. |
| 102 | + * Since PERF_COUNT_HW_INSTRUCTIONS is a generic hardware |
| 103 | + * event and present in all platforms, lets use that. |
| 104 | + */ |
| 105 | + if (!i && !j && !k) |
| 106 | + sibling_fd2 = event_open(types[k], configs_hw[k], group_fd); |
| 107 | + else |
| 108 | + sibling_fd2 = event_open(types[k], configs[k], group_fd); |
97 | 109 | if (sibling_fd2 == -1) {
|
98 | 110 | close(sibling_fd1);
|
99 | 111 | close(group_fd);
|
@@ -124,9 +136,18 @@ static int test__event_groups(struct test_suite *text __maybe_unused, int subtes
|
124 | 136 | if (r)
|
125 | 137 | ret = TEST_FAIL;
|
126 | 138 |
|
127 |
| - pr_debug("0x%x 0x%lx, 0x%x 0x%lx, 0x%x 0x%lx: %s\n", |
128 |
| - types[i], configs[i], types[j], configs[j], |
129 |
| - types[k], configs[k], r ? "Fail" : "Pass"); |
| 139 | + /* |
| 140 | + * For all three events as HW events, second sibling |
| 141 | + * event is picked from configs_hw. So print accordingly |
| 142 | + */ |
| 143 | + if (!i && !j && !k) |
| 144 | + pr_debug("0x%x 0x%lx, 0x%x 0x%lx, 0x%x 0x%lx: %s\n", |
| 145 | + types[i], configs[i], types[j], configs[j], |
| 146 | + types[k], configs_hw[k], r ? "Fail" : "Pass"); |
| 147 | + else |
| 148 | + pr_debug("0x%x 0x%lx, 0x%x 0x%lx, 0x%x 0x%lx: %s\n", |
| 149 | + types[i], configs[i], types[j], configs[j], |
| 150 | + types[k], configs[k], r ? "Fail" : "Pass"); |
130 | 151 | }
|
131 | 152 | }
|
132 | 153 | }
|
|
0 commit comments