From c9750824ff585fdb8519bdb14f432d15463b919d Mon Sep 17 00:00:00 2001 From: Dave Aldridge Date: Tue, 29 Mar 2016 03:57:14 -0700 Subject: [PATCH] sparc64: Fix incorrect counting when using multiple perf counters Commit 165050c1 introduced a change to the way we deal with performance counter overflow interrupts. This change had the side effect that when a performance counter overflow was detected it assumed all performance counters in use had overflowed. Thus, when using multiple performance counters the event counting was incorrect. This commit fixes this incorrect counting behaviour. Orabug: 23106709 Signed-off-by: Dave Aldridge (cherry picked from commit ef4dab8459ac6dd32538dc9448caf55ab68c2231) (cherry picked from commit 741d96c0e37d7a73e17433355bb5bf513f2053af) Signed-off-by: Allen Pais --- arch/sparc/kernel/perf_event.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 8e18fe4b01a2..9217e38ebbd7 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c @@ -1682,6 +1682,12 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self, int idx = cpuc->current_idx[i]; struct hw_perf_event *hwc; u64 val; + u64 pcr = pcr_ops->read_pcr(idx); + + /* If this 'event' didn't cause the interrupt just continue */ + if ((pcr & (sparc_pmu->irq_bit | PCR_N4_OV)) != + (sparc_pmu->irq_bit | PCR_N4_OV)) + continue; if (sparc_pmu->irq_bit && sparc_pmu->num_pcrs > 1) -- 2.50.1