Commit 0c9108b0 authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Michael Ellerman

Powerpc/perf: Wire up PMI throttling

Commit 14c63f17 ("perf: Drop sample rate when sampling is too
slow") introduced a way to throttle PMU interrupts if we're spending
too much time just processing those. Wire up powerpc PMI handler to
use this infrastructure.

We have throttling of the *rate* of interrupts, but this adds
throttling based on the *time taken* to process the interrupts.
Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent c2057701
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/clock.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
...@@ -2166,7 +2167,7 @@ static bool pmc_overflow(unsigned long val) ...@@ -2166,7 +2167,7 @@ static bool pmc_overflow(unsigned long val)
/* /*
* Performance monitor interrupt stuff * Performance monitor interrupt stuff
*/ */
static void perf_event_interrupt(struct pt_regs *regs) static void __perf_event_interrupt(struct pt_regs *regs)
{ {
int i, j; int i, j;
struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events); struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events);
...@@ -2250,6 +2251,14 @@ static void perf_event_interrupt(struct pt_regs *regs) ...@@ -2250,6 +2251,14 @@ static void perf_event_interrupt(struct pt_regs *regs)
irq_exit(); irq_exit();
} }
static void perf_event_interrupt(struct pt_regs *regs)
{
u64 start_clock = sched_clock();
__perf_event_interrupt(regs);
perf_sample_event_took(sched_clock() - start_clock);
}
static int power_pmu_prepare_cpu(unsigned int cpu) static int power_pmu_prepare_cpu(unsigned int cpu)
{ {
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment