]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Fix incorrect counting when using multiple perf counters
authorDave Aldridge <david.j.aldridge@oracle.com>
Tue, 29 Mar 2016 10:57:14 +0000 (03:57 -0700)
committerAllen Pais <allen.pais@oracle.com>
Sun, 22 Jan 2017 15:38:05 +0000 (21:08 +0530)
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 <david.j.aldridge@oracle.com>
(cherry picked from commit ef4dab8459ac6dd32538dc9448caf55ab68c2231)
(cherry picked from commit 741d96c0e37d7a73e17433355bb5bf513f2053af)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/perf_event.c

index 8e18fe4b01a2bf5b78e0f428873cd937f8eb77f8..9217e38ebbd76d4e7470255051038b3fd0295dd6 100644 (file)
@@ -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)