perf/x86: Move cpuc->running into P4 specific code
authorKan Liang <kan.liang@linux.intel.com>
Wed, 14 Apr 2021 14:36:29 +0000 (07:36 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 16 Apr 2021 14:32:42 +0000 (16:32 +0200)
commit46ade4740bbf9bf4e804ddb2c85845cccd219f3c
treef9daafc5262424ad7e8d20404c07999d59bd2863
parent6216798bf98e82c382922f1b71ecc4a13d6e65cb
perf/x86: Move cpuc->running into P4 specific code

The 'running' variable is only used in the P4 PMU. Current perf sets the
variable in the critical function x86_pmu_start(), which wastes cycles
for everybody not running on P4.

Move cpuc->running into the P4 specific p4_pmu_enable_event().

Add a static per-CPU 'p4_running' variable to replace the 'running'
variable in the struct cpu_hw_events. Saves space for the generic
structure.

The p4_pmu_enable_all() also invokes the p4_pmu_enable_event(), but it
should not set cpuc->running. Factor out __p4_pmu_enable_event() for
p4_pmu_enable_all().

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1618410990-21383-1-git-send-email-kan.liang@linux.intel.com
arch/x86/events/core.c
arch/x86/events/intel/p4.c
arch/x86/events/perf_event.h