[patch V3 00/28] x86/perf/intel/uncore|rapl: Fix error handling and sanitize pmu management

From: Thomas Gleixner
Date: Mon Feb 22 2016 - 17:26:24 EST


This series addresses the following issues:

- Add proper error handling to uncore and rapl drivers

- Get rid of the pseudo per cpuness of these drivers and do a proper per
package storage

- Allow them to be modular

In order to do proper per package storage I added a facility which sanity
checks the physical package id of the processors which is supplied by bios and
does a logical package id translation. That allows drivers to do allocations
for the maximum number of possible packages independent of possible BIOS
creativity.

The module patches are optional. Andi pointed out that they miss the proper
auto loading/probing machinery, but I kept them and let Peter decide what to
do with them.

Changes vs. V2:

- Change export to GPL

- Fix the leftover while loop

- Fix the snb pmu_private bogosity

- Explain in the changelogs why we want to keep pmu_private

- Drop the proc/cpuinfo change

- Add an explanation to the Kconfig help text why selecting 'm' might break
existing setups.

Delta patch below.

Thanks,

tglx
---

--- a/arch/x86/Kconfig.perf
+++ b/arch/x86/Kconfig.perf
@@ -8,6 +8,9 @@ config PERF_EVENTS_INTEL_UNCORE
Include support for Intel uncore performance events. These are
available on NehalemEX and more modern processors.

+ Note: Selecting 'm' might break existing setups as the drivers
+ lack the autoprobe/load magic. If you need them select: y.
+
If unsure say y.

config PERF_EVENTS_INTEL_RAPL
@@ -18,6 +21,9 @@ config PERF_EVENTS_INTEL_RAPL
Include support for Intel rapl performance events for power
monitoring on modern processors.

+ Note: Selecting 'm' might break existing setups as the drivers
+ lack the autoprobe/load magic. If you need them select: y.
+
If unsure say y.

endmenu
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -774,9 +774,9 @@ static void __uncore_exit_boxes(struct i

static void uncore_exit_boxes(void *dummy)
{
- struct intel_uncore_type **types = uncore_msr_uncores;
+ struct intel_uncore_type **types;

- while (*types)
+ for (types = uncore_msr_uncores; *types; types++)
__uncore_exit_boxes(*types++, smp_processor_id());
}

--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c
@@ -313,7 +313,7 @@ static int snb_uncore_imc_event_init(str
return -EINVAL;

event->cpu = box->cpu;
- event->pmu_private = pmu;
+ event->pmu_private = box;

event->hw.idx = -1;
event->hw.last_tag = ~0ULL;
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -12,7 +12,6 @@ static void show_cpuinfo_core(struct seq
{
#ifdef CONFIG_SMP
seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
- seq_printf(m, "logical id\t: %d\n", c->logical_proc_id);
seq_printf(m, "siblings\t: %d\n",
cpumask_weight(topology_core_cpumask(cpu)));
seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9335,7 +9335,7 @@ ssize_t perf_event_sysfs_show(struct dev

return 0;
}
-EXPORT_SYMBOL(perf_event_sysfs_show);
+EXPORT_SYMBOL_GPL(perf_event_sysfs_show);

static int __init perf_event_sysfs_init(void)
{