From: Dave Aldridge Date: Tue, 29 Mar 2016 10:57:14 +0000 (-0700) Subject: sparc64: Fix incorrect counting when using multiple perf counters X-Git-Tag: v4.1.12-92~12^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c9750824ff585fdb8519bdb14f432d15463b919d;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 8e18fe4b01a2b..9217e38ebbd76 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)