Skip to content
Permalink
Browse files
powerpc/64s/perf: add power_pmu_running to query whether perf is bein…
…g used

Interrupt handling code would like to know whether perf is enabled, to
know whether it should enable MSR[EE] to improve PMI coverage.

Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
  • Loading branch information
npiggin authored and intel-lab-lkp committed Aug 16, 2021
1 parent 63afe4e commit 98b8a35aa718c93ace9df66df6274fe392633f80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
@@ -306,6 +306,8 @@ static inline bool lazy_irq_pending_nocheck(void)
return __lazy_irq_pending(local_paca->irq_happened);
}

bool power_pmu_running(void);

/*
* This is called by asynchronous interrupts to conditionally
* re-enable hard interrupts after having cleared the source
@@ -2389,6 +2389,19 @@ static void perf_event_interrupt(struct pt_regs *regs)
perf_sample_event_took(sched_clock() - start_clock);
}

bool power_pmu_running(void)
{
struct cpu_hw_events *cpuhw;

/* Could this simply test local_paca->pmcregs_in_use? */

if (!ppmu)
return false;

cpuhw = this_cpu_ptr(&cpu_hw_events);
return cpuhw->n_events;
}

static int power_pmu_prepare_cpu(unsigned int cpu)
{
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);

0 comments on commit 98b8a35

Please sign in to comment.