Skip to content

x86/perfcounters: x86 and AMD cpu updates

Robert Richter lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest29 patches 56 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29x86: perfcounter: remove X86_FEATURE_ARCH_PERFMON flag for AMD cpusarch/x86/kernel/cpu/amd.c arch/x86/kernel/cpu/perf_counter.c+3 -713 replies
2/29perfcounter: declare perf_max_counters only for CONFIG_PERF_COUNTERSinclude/linux/perf_counter.h+2 -11 reply
3/29x86/perfcounters: add default path to cpu detectionarch/x86/kernel/cpu/perf_counter.c+2 -01 reply
4/29x86/perfcounters: rework pmc_amd_save_disable_all() and pmc_amd_restore_all()arch/x86/kernel/cpu/perf_counter.c+14 -108 replies
5/29x86/perfcounters: protect per-cpu variables with compile barriers onlyarch/x86/kernel/cpu/perf_counter.c+2 -21 reply
6/29perfcounters: rename struct hw_perf_counter_ops into struct pmuarch/powerpc/kernel/perf_counter.c arch/x86/kernel/cpu/perf_counter.c include/linux/perf_counter.h +1 more+66 -731 reply
7/29x86/perfcounters: rename struct pmc_x86_ops into struct x86_pmuarch/x86/kernel/cpu/perf_counter.c+68 -671 reply
8/29x86/perfcounters: make interrupt handler model specificarch/x86/kernel/cpu/perf_counter.c+13 -31 reply
9/29x86/perfcounters: remove get_status() from struct x86_pmuarch/x86/kernel/cpu/perf_counter.c+5 -341 reply
10/29x86/perfcounters: remove ack_status() from struct x86_pmuarch/x86/kernel/cpu/perf_counter.c+2 -171 reply
11/29x86/perfcounters: rename __hw_perf_counter_set_period into x86_perf_counter_set_periodarch/x86/kernel/cpu/perf_counter.c+3 -31 reply
12/29x86/perfcounters: rename intel only functionsarch/x86/kernel/cpu/perf_counter.c+4 -41 reply
13/29x86/perfcounters: modify initialization of struct x86_pmuarch/x86/kernel/cpu/perf_counter.c+16 -111 reply
14/29x86/perfcounters: make x86_pmu data a static structarch/x86/kernel/cpu/perf_counter.c+25 -251 reply
15/29x86/perfcounters: move counter parameters to struct x86_pmuarch/x86/kernel/cpu/perf_counter.c+37 -431 reply
16/29x86/perfcounters: make pmu version genericarch/x86/kernel/cpu/perf_counter.c+13 -111 reply
17/29x86/perfcounters: make x86_pmu_read() static inlinearch/x86/kernel/cpu/perf_counter.c+1 -11 reply
18/29x86/perfcounters: rename cpuc->active_maskarch/x86/kernel/cpu/perf_counter.c+5 -55 replies
19/29x86/perfcounters: generic use of cpuc->activearch/x86/kernel/cpu/perf_counter.c+9 -111 reply
20/29x86/perfcounters: consistent use of type int for counter indexarch/x86/kernel/cpu/perf_counter.c include/linux/perf_counter.h+5 -51 reply
21/29x86/perfcounters: rework counter enable functionsarch/x86/kernel/cpu/perf_counter.c+24 -281 reply
22/29x86/perfcounters: rework counter disable functionsarch/x86/kernel/cpu/perf_counter.c+23 -251 reply
23/29x86/perfcounters: change and remove pmu initialization checksarch/x86/kernel/cpu/perf_counter.c+13 -211 reply
24/29x86/perfcounters: implement the interrupt handler for AMD cpusarch/x86/kernel/cpu/perf_counter.c+37 -81 reply
25/29x86/perfcounters: return raw count with x86_perf_counter_update()arch/x86/kernel/cpu/perf_counter.c+4 -31 reply
26/29x86/perfcounters: introduce max_period variablearch/x86/kernel/cpu/perf_counter.c+12 -82 replies
27/29x86/perfcounters: remove vendor check in fixed_mode_idx()arch/x86/kernel/cpu/perf_counter.c+1 -12 replies
28/29x86/perfcounters: remove unused function argument in intel_pmu_get_status()arch/x86/kernel/cpu/perf_counter.c+3 -31 reply
29/29perfcounters: updating kerneltop documentationDocumentation/perf_counter/builtin-top.c+1 -12 replies

Reviews trailers per patch

All 29 patches have a Reviewed-by or Acked-by.

PatchPeter Zijlstra
1/29A-b
2/29A-b
3/29A-b
4/29A-b
5/29A-b
6/29A-b
7/29A-b
8/29A-b
9/29A-b
10/29A-b
11/29A-b
12/29A-b
13/29A-b
14/29A-b
15/29A-b
16/29A-b
17/29A-b
18/29A-b
19/29A-b
20/29A-b
21/29A-b
22/29A-b
23/29A-b
24/29A-b
25/29A-b
26/29A-b
27/29A-b
28/29A-b
29/29A-b

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

Read the v1 thread

Cover letter [PATCH 0/29] x86/perfcounters: x86 and AMD cpu updates

This patch series updates the perfcounters implementation mainly for the x86 architecture.

Also, it introduces a data structure (struct pmu) describing a generic performance monitoring unit (pmu). This structure is a replacement for struct hw_perf_counter_ops. Similiar, I introduced struct x86_pmu for the x86 architecture (as a replacement for struct pmc_x86_ops).

There are patches for x86 with some fixes and cleanups, a change in the model specific split and a complete rework of AMD pmu code. The result is simplified model specific code and more generalized and unified code. Features that are only supported by AMD or Intel are now implemented in vendor specific functions.

The AMD pmu differs to Intel, especially there is no status register and also there are no fixed counters. This makes a separate interrupt handler for AMD cpus necessary. Also, a global disable/enable of the performance counters (e.g. to avoid NMIs to protect the modification of a list) is expensive on AMD cpus leading to up to 4 msr reads/writes per counter. There is still some more work to do here to avoid this.

This patch series bases on the tip/percounters/core branch.

I developed this patches based on 03ced43 and later rebased to 1b88991. The latest tip/percounters/core branch seems to be broken, no nmis are delivered, only perfcounter interrupts with no results on kerneltop. I am still debugging this. However, I could test successfully the patch series based on 03ced43 and want to release the patches anyway.

-Robert