Skip to content

x86/perf/intel/uncore|rapl: Fix error handling and sanitize pmu management

Thomas Gleixner lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest28 patches 2 repliesIn review
  2. v228 patches 18 repliesSuperseded
  3. v111 patches 18 repliesSuperseded

Changes in v3 from the cover letter

- 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.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28x86/perf/intel/uncore: Remove pointless mask checkarch/x86/kernel/cpu/perf_event_intel_uncore.c+0 -60 replies
2/28x86/perf/intel/uncore: Simplify error rollbackarch/x86/kernel/cpu/perf_event_intel_uncore.c+24 -210 replies
3/28x86/perf/intel/uncore: Fix error handlingarch/x86/kernel/cpu/perf_event_intel_uncore.c arch/x86/kernel/cpu/perf_event_intel_uncore.h+94 -430 replies
4/28x86/perf/intel/uncore: Add sanity checks for pci dev package idarch/x86/kernel/cpu/perf_event_intel_uncore.c+1 -10 replies
5/28x86/perf/intel_uncore: Cleanup hardware on exitarch/x86/kernel/cpu/perf_event_intel_uncore.c arch/x86/kernel/cpu/perf_event_intel_uncore.h arch/x86/kernel/cpu/perf_event_intel_uncore_nhmex.c +1 more+33 -10 replies
6/28x86/perf/intel/uncore: Drop pointless hotplug priorityarch/x86/kernel/cpu/perf_event_intel_uncore.c+0 -50 replies
7/28x86/perf/intel_uncore: Make code readablearch/x86/kernel/cpu/perf_event_intel_uncore.c+50 -450 replies
8/28x86/perf/uncore: Make uncore_pcibus_to_physid staticarch/x86/kernel/cpu/perf_event_intel_uncore.c arch/x86/kernel/cpu/perf_event_intel_uncore.h+1 -20 replies
9/28perf: Allow storage of pmu private data in eventinclude/linux/perf_event.h+1 -00 replies
10/28x86/perf/intel_uncore: Store box in event->pmu_privatearch/x86/kernel/cpu/perf_event_intel_uncore.c arch/x86/kernel/cpu/perf_event_intel_uncore.h arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c+12 -160 replies
11/28x86/topology: Create logical package idarch/x86/include/asm/processor.h arch/x86/include/asm/topology.h arch/x86/kernel/apic/apic.c +3 more+141 -00 replies
12/28x86/perf/uncore: Track packages not per cpu dataarch/x86/kernel/cpu/perf_event_intel_uncore.c arch/x86/kernel/cpu/perf_event_intel_uncore.h arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c+197 -2510 replies
13/28x86/perf/intel_uncore: Clear all hardware state on exitarch/x86/kernel/cpu/perf_event_intel_uncore.c+26 -00 replies
14/28x86/perf/intel_uncore: Make PCI and MSR uncore independentarch/x86/kernel/cpu/perf_event_intel_uncore.c+18 -160 replies
15/28cpumask: Export cpumask_any_butlib/cpumask.c+1 -00 replies
16/28x86/perf/intel_uncore: Make it modulararch/x86/Kconfig arch/x86/Kconfig.perf arch/x86/kernel/cpu/Makefile +1 more+38 -110 replies
17/28x86/perf/cqm: Get rid of the silly for_each_cpu lookupsarch/x86/kernel/cpu/perf_event_intel_cqm.c+12 -220 replies
18/28x86/perf/intel_rapl: Make Knights Landings support functionalarch/x86/kernel/cpu/perf_event_intel_rapl.c+1 -10 replies
19/28x86/perf/intel/rapl: Add proper error handlingarch/x86/kernel/cpu/perf_event_intel_rapl.c+21 -80 replies
20/28x86/perf/intel/rapl: Sanitize the quirk handlingarch/x86/kernel/cpu/perf_event_intel_rapl.c+19 -303 replies
21/28x86/perf/intel/rapl: Calculate timing oncearch/x86/kernel/cpu/perf_event_intel_rapl.c+18 -210 replies
22/28x86/perf/intel/rapl: Cleanup the printk outputarch/x86/kernel/cpu/perf_event_intel_rapl.c+23 -190 replies
23/28x86/perf/intel/rapl: Refactor code some morearch/x86/kernel/cpu/perf_event_intel_rapl.c+31 -300 replies
24/28x86/perf/intel/rapl: Make pmu lock rawarch/x86/kernel/cpu/perf_event_intel_rapl.c+10 -100 replies
25/28x86/perf/intel/rapl: Utilize event->pmu_privatearch/x86/kernel/cpu/perf_event_intel_rapl.c+12 -40 replies
26/28x86/perf/intel/rapl: Convert it to a per package facilityarch/x86/kernel/cpu/perf_event_intel_rapl.c+87 -1090 replies
27/28perf: Export perf_event_sysfs_showkernel/events/core.c+1 -00 replies
28/28x86/perf/intel/rapl: Make it modulararch/x86/Kconfig.perf arch/x86/kernel/cpu/Makefile arch/x86/kernel/cpu/perf_event_intel_rapl.c+35 -40 replies

Reviews trailers per patch

None of the 28 patches has a Reviewed-by or Acked-by.

PatchAndi Kleen
1/28
2/28
3/28
4/28
5/28
6/28
7/28
8/28
9/28
10/28
11/28
12/28
13/28
14/28Requested-by
15/28
16/28
17/28
18/28
19/28
20/28
21/28
22/28
23/28
24/28
25/28
26/28
27/28
28/28

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

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

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
---

arch/x86/Kconfig.perf +6 -0
@@ -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
arch/x86/kernel/cpu/perf_event_intel_uncore.c +2 -2
@@ -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());
 }
 
arch/x86/kernel/cpu/perf_event_intel_uncore_snb.c +1 -1
@@ -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;
arch/x86/kernel/cpu/proc.c +0 -1
@@ -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);
kernel/events/core.c +1 -1
@@ -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)
 {