perf/x86/msr: Make SMI and PPERF on by default
Subsystems (2)
PATCH v2 1/1 perf/x86/msr: Make SMI and PPERF on by default
From: Kan Liang <[email protected]>
The MSRs, SMI_COUNT and PPERF, are model-specific MSRs. A very long CPU ID list is maintained to indicate the supported platforms. With more and more platforms being introduced, new CPU IDs have to be kept adding. Also, the old kernel has to be updated to apply the new CPU ID.
The MSRs have been introduced for a long time. There is no plan to change them in the near future. Furthermore, the current code utilizes rdmsr_safe() to check the availability of MSRs before using it.
Make them on by default. It should be good enough to only rely on the rdmsr_safe() to check their availability for both existing and future platforms.
---
V2: Removed stale #include <asm/cpu_device_id.h>.
V1: https://lore.kernel.org/lkml/[email protected]/
arch/x86/events/msr.c | 82 ++----------------------------------------- 1 file changed, 3 insertions(+), 79 deletions(-)
arch/x86/events/msr.c +3 -79
@@ -2,7 +2,6 @@#include <linux/perf_event.h> #include <linux/sysfs.h> #include <linux/nospec.h> -#include <asm/cpu_device_id.h> #include <asm/msr.h> #include "probe.h"
@@ -41,86 +40,11 @@ static bool test_therm_status(int idx, void *data)static bool test_intel (int idx,void *data) { -if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL || - boot_cpu_data.x86 !=6 ) +if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return false; -switch (boot_cpu_data.x86_vfm) { -case INTEL_NEHALEM : -case INTEL_NEHALEM_G : -case INTEL_NEHALEM_EP : -case INTEL_NEHALEM_EX : - -case INTEL_WESTMERE : -case INTEL_WESTMERE_EP : -case INTEL_WESTMERE_EX : - -case INTEL_SANDYBRIDGE : -case INTEL_SANDYBRIDGE_X : - -case INTEL_IVYBRIDGE : -case INTEL_IVYBRIDGE_X : - -case INTEL_HASWELL : -case INTEL_HASWELL_X : -case INTEL_HASWELL_L : -case INTEL_HASWELL_G : - -case INTEL_BROADWELL : -case INTEL_BROADWELL_D : -case INTEL_BROADWELL_G : -case INTEL_BROADWELL_X : -case INTEL_SAPPHIRERAPIDS_X : -case INTEL_EMERALDRAPIDS_X : -case INTEL_GRANITERAPIDS_X : -case INTEL_GRANITERAPIDS_D : - -case INTEL_ATOM_SILVERMONT : -case INTEL_ATOM_SILVERMONT_D : -case INTEL_ATOM_AIRMONT : -case INTEL_ATOM_AIRMONT_NP : - -case INTEL_ATOM_GOLDMONT : -case INTEL_ATOM_GOLDMONT_D : -case INTEL_ATOM_GOLDMONT_PLUS : -case INTEL_ATOM_TREMONT_D : -case INTEL_ATOM_TREMONT : -case INTEL_ATOM_TREMONT_L : - -case INTEL_XEON_PHI_KNL : -case INTEL_XEON_PHI_KNM : -if (idx ==PERF_MSR_SMI ) -return true; -break ; - -case INTEL_SKYLAKE_L : -case INTEL_SKYLAKE : -case INTEL_SKYLAKE_X : -case INTEL_KABYLAKE_L : -case INTEL_KABYLAKE : -case INTEL_COMETLAKE_L : -case INTEL_COMETLAKE : -case INTEL_ICELAKE_L : -case INTEL_ICELAKE : -case INTEL_ICELAKE_X : -case INTEL_ICELAKE_D : -case INTEL_TIGERLAKE_L : -case INTEL_TIGERLAKE : -case INTEL_ROCKETLAKE : -case INTEL_ALDERLAKE : -case INTEL_ALDERLAKE_L : -case INTEL_ATOM_GRACEMONT : -case INTEL_RAPTORLAKE : -case INTEL_RAPTORLAKE_P : -case INTEL_RAPTORLAKE_S : -case INTEL_METEORLAKE : -case INTEL_METEORLAKE_L : -if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF ) -return true; -break ; - } - -return false; +/* Rely on perf_msr_probe() to check the availability */ +return true; }PMU_EVENT_ATTR_STRING (tsc, attr_tsc,"event=0x00" );
base-commit: 6ee26b7a224b27aa7e8e1ee8a845a31664d2e97c
Signature · 1 line
2.34.1
Quoted 11 lines · Dapeng Mi
From: Kan Liang <[email protected]>
The MSRs,
SMI_COUNTand PPERF, are model-specific MSRs. A very long CPU ID list is maintained to indicate the supported platforms. With more and more platforms being introduced, new CPU IDs have to be kept adding. Also, the old kernel has to be updated to apply the new CPU ID.The MSRs have been introduced for a long time. There is no plan to change them in the near future. Furthermore, the current code utilizes
rdmsr_safe()to check the availability of MSRs before using it.
Quoted 8 lines
Make them on by default. It should be good enough to only rely on the
rdmsr_safe()to check their availability for both existing and future platforms.Signed-off-by Kan Liang <[email protected]>Co-developed-by Dapeng Mi <[email protected]>Signed-off-by Dapeng Mi <[email protected]>---
Quoted 112 lines
V2: Removed stale #include <
asm/cpu_device_id.h>.V1: https://lore.kernel.org/lkml/[email protected]/
arch/x86/events/msr.c | 82 ++----------------------------------------- 1 file changed, 3 insertions(+), 79 deletions(-)arch/x86/events/msr.c +3
-79@@ -2,7 +2,6 @@#include <linux/perf_event.h> #include <linux/sysfs.h> #include <linux/nospec.h> -#include <asm/cpu_device_id.h> #include <asm/msr.h> #include "probe.h" @@ -41,86 +40,11 @@ static bool test_therm_status(int idx, void *data)static bool test_intel (int idx,void *data) { -if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL || - boot_cpu_data.x86 !=6 ) +if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return false; -switch (boot_cpu_data.x86_vfm) { -case INTEL_NEHALEM : -case INTEL_NEHALEM_G : -case INTEL_NEHALEM_EP : -case INTEL_NEHALEM_EX : - -case INTEL_WESTMERE : -case INTEL_WESTMERE_EP : -case INTEL_WESTMERE_EX : - -case INTEL_SANDYBRIDGE : -case INTEL_SANDYBRIDGE_X : - -case INTEL_IVYBRIDGE : -case INTEL_IVYBRIDGE_X : - -case INTEL_HASWELL : -case INTEL_HASWELL_X : -case INTEL_HASWELL_L : -case INTEL_HASWELL_G : - -case INTEL_BROADWELL : -case INTEL_BROADWELL_D : -case INTEL_BROADWELL_G : -case INTEL_BROADWELL_X : -case INTEL_SAPPHIRERAPIDS_X : -case INTEL_EMERALDRAPIDS_X : -case INTEL_GRANITERAPIDS_X : -case INTEL_GRANITERAPIDS_D : - -case INTEL_ATOM_SILVERMONT : -case INTEL_ATOM_SILVERMONT_D : -case INTEL_ATOM_AIRMONT : -case INTEL_ATOM_AIRMONT_NP : - -case INTEL_ATOM_GOLDMONT : -case INTEL_ATOM_GOLDMONT_D : -case INTEL_ATOM_GOLDMONT_PLUS : -case INTEL_ATOM_TREMONT_D : -case INTEL_ATOM_TREMONT : -case INTEL_ATOM_TREMONT_L : - -case INTEL_XEON_PHI_KNL : -case INTEL_XEON_PHI_KNM : -if (idx ==PERF_MSR_SMI ) -return true; -break ; - -case INTEL_SKYLAKE_L : -case INTEL_SKYLAKE : -case INTEL_SKYLAKE_X : -case INTEL_KABYLAKE_L : -case INTEL_KABYLAKE : -case INTEL_COMETLAKE_L : -case INTEL_COMETLAKE : -case INTEL_ICELAKE_L : -case INTEL_ICELAKE : -case INTEL_ICELAKE_X : -case INTEL_ICELAKE_D : -case INTEL_TIGERLAKE_L : -case INTEL_TIGERLAKE : -case INTEL_ROCKETLAKE : -case INTEL_ALDERLAKE : -case INTEL_ALDERLAKE_L : -case INTEL_ATOM_GRACEMONT : -case INTEL_RAPTORLAKE : -case INTEL_RAPTORLAKE_P : -case INTEL_RAPTORLAKE_S : -case INTEL_METEORLAKE : -case INTEL_METEORLAKE_L : -if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF ) -return true; -break ; - } - -return false; +/* Rely on perf_msr_probe() to check the availability */ +return true; }PMU_EVENT_ATTR_STRING (tsc, attr_tsc,"event=0x00" );base-commit:
6ee26b7a224b27aa7e8e1ee8a845a31664d2e97c
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 9805ed3c91478b08a586861b874bd8b6a2fed648 Gitweb: https://git.kernel.org/tip/9805ed3c91478b08a586861b874bd8b6a2fed648 Author: Kan Liang <[email protected]> AuthorDate: Fri, 27 Mar 2026 13:28:44 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 03 Apr 2026 14:23:43 +02:00
perf/x86/msr: Make SMI and PPERF on by default
The MSRs, SMI_COUNT and PPERF, are model-specific MSRs. A very long CPU ID list is maintained to indicate the supported platforms. With more and more platforms being introduced, new CPU IDs have to be kept adding. Also, the old kernel has to be updated to apply the new CPU ID.
The MSRs have been introduced for a long time. There is no plan to change them in the near future. Furthermore, the current code utilizes rdmsr_safe() to check the availability of MSRs before using it.
Make them on by default. It should be good enough to only rely on the rdmsr_safe() to check their availability for both existing and future platforms.
--- arch/x86/events/msr.c | 82 +----------------------------------------- 1 file changed, 3 insertions(+), 79 deletions(-)
arch/x86/events/msr.c +3 -79
@@ -2,7 +2,6 @@#include <linux/perf_event.h> #include <linux/sysfs.h> #include <linux/nospec.h> -#include <asm/cpu_device_id.h> #include <asm/msr.h> #include "probe.h"
@@ -41,86 +40,11 @@ static bool test_therm_status(int idx, void *data)static bool test_intel (int idx,void *data) { -if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL || - boot_cpu_data.x86 !=6 ) +if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL )return false; -switch (boot_cpu_data.x86_vfm) { -case INTEL_NEHALEM : -case INTEL_NEHALEM_G : -case INTEL_NEHALEM_EP : -case INTEL_NEHALEM_EX : - -case INTEL_WESTMERE : -case INTEL_WESTMERE_EP : -case INTEL_WESTMERE_EX : - -case INTEL_SANDYBRIDGE : -case INTEL_SANDYBRIDGE_X : - -case INTEL_IVYBRIDGE : -case INTEL_IVYBRIDGE_X : - -case INTEL_HASWELL : -case INTEL_HASWELL_X : -case INTEL_HASWELL_L : -case INTEL_HASWELL_G : - -case INTEL_BROADWELL : -case INTEL_BROADWELL_D : -case INTEL_BROADWELL_G : -case INTEL_BROADWELL_X : -case INTEL_SAPPHIRERAPIDS_X : -case INTEL_EMERALDRAPIDS_X : -case INTEL_GRANITERAPIDS_X : -case INTEL_GRANITERAPIDS_D : - -case INTEL_ATOM_SILVERMONT : -case INTEL_ATOM_SILVERMONT_D : -case INTEL_ATOM_AIRMONT : -case INTEL_ATOM_AIRMONT_NP : - -case INTEL_ATOM_GOLDMONT : -case INTEL_ATOM_GOLDMONT_D : -case INTEL_ATOM_GOLDMONT_PLUS : -case INTEL_ATOM_TREMONT_D : -case INTEL_ATOM_TREMONT : -case INTEL_ATOM_TREMONT_L : - -case INTEL_XEON_PHI_KNL : -case INTEL_XEON_PHI_KNM : -if (idx ==PERF_MSR_SMI ) -return true; -break ; - -case INTEL_SKYLAKE_L : -case INTEL_SKYLAKE : -case INTEL_SKYLAKE_X : -case INTEL_KABYLAKE_L : -case INTEL_KABYLAKE : -case INTEL_COMETLAKE_L : -case INTEL_COMETLAKE : -case INTEL_ICELAKE_L : -case INTEL_ICELAKE : -case INTEL_ICELAKE_X : -case INTEL_ICELAKE_D : -case INTEL_TIGERLAKE_L : -case INTEL_TIGERLAKE : -case INTEL_ROCKETLAKE : -case INTEL_ALDERLAKE : -case INTEL_ALDERLAKE_L : -case INTEL_ATOM_GRACEMONT : -case INTEL_RAPTORLAKE : -case INTEL_RAPTORLAKE_P : -case INTEL_RAPTORLAKE_S : -case INTEL_METEORLAKE : -case INTEL_METEORLAKE_L : -if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF ) -return true; -break ; - } - -return false; +/* Rely on perf_msr_probe() to check the availability */ +return true; }PMU_EVENT_ATTR_STRING (tsc, attr_tsc,"event=0x00" );