|
@@ -846,17 +846,14 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
|
|
struct hw_perf_event *hwc = &event->hw;
|
|
struct hw_perf_event *hwc = &event->hw;
|
|
unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT;
|
|
unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT;
|
|
|
|
|
|
- /* Always place a cycle counter into the cycle counter. */
|
|
|
|
|
|
+ /* Always prefer to place a cycle counter into the cycle counter. */
|
|
if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {
|
|
if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {
|
|
- if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
|
|
|
|
- return -EAGAIN;
|
|
|
|
-
|
|
|
|
- return ARMV8_IDX_CYCLE_COUNTER;
|
|
|
|
|
|
+ if (!test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
|
|
|
|
+ return ARMV8_IDX_CYCLE_COUNTER;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * For anything other than a cycle counter, try and use
|
|
|
|
- * the events counters
|
|
|
|
|
|
+ * Otherwise use events counters
|
|
*/
|
|
*/
|
|
for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; ++idx) {
|
|
for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; ++idx) {
|
|
if (!test_and_set_bit(idx, cpuc->used_mask))
|
|
if (!test_and_set_bit(idx, cpuc->used_mask))
|