diff options
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index b5798ba21189..372317667773 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -846,17 +846,14 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
846 | struct hw_perf_event *hwc = &event->hw; | 846 | struct hw_perf_event *hwc = &event->hw; |
847 | unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT; | 847 | unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT; |
848 | 848 | ||
849 | /* Always place a cycle counter into the cycle counter. */ | 849 | /* Always prefer to place a cycle counter into the cycle counter. */ |
850 | if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) { | 850 | if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) { |
851 | if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask)) | 851 | if (!test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask)) |
852 | return -EAGAIN; | 852 | return ARMV8_IDX_CYCLE_COUNTER; |
853 | |||
854 | return ARMV8_IDX_CYCLE_COUNTER; | ||
855 | } | 853 | } |
856 | 854 | ||
857 | /* | 855 | /* |
858 | * For anything other than a cycle counter, try and use | 856 | * Otherwise use events counters |
859 | * the events counters | ||
860 | */ | 857 | */ |
861 | for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; ++idx) { | 858 | for (idx = ARMV8_IDX_COUNTER0; idx < cpu_pmu->num_events; ++idx) { |
862 | if (!test_and_set_bit(idx, cpuc->used_mask)) | 859 | if (!test_and_set_bit(idx, cpuc->used_mask)) |