* [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources
@ 2022-01-13 14:25 Arnaldo Carvalho de Melo
2022-01-13 19:14 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-13 14:25 UTC (permalink / raw)
To: Huang Rui
Cc: Rafael J. Wysocki, Jiri Olsa, Namhyung Kim, Adrian Hunter,
Ian Rogers, Linux Kernel Mailing List, linux-perf-users
To pick up the changes in:
89aa94b4a218339b ("x86/msr: Add AMD CPPC MSR definitions")
Addressing these tools/perf build warnings:
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
That makes the beautification scripts to pick some new entries:
$ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
$ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
$ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
$ diff -u before after
--- before 2022-01-13 10:59:51.743416890 -0300
+++ after 2022-01-13 11:00:00.776644178 -0300
@@ -303,6 +303,11 @@
[0xc0010299 - x86_AMD_V_KVM_MSRs_offset] = "AMD_RAPL_POWER_UNIT",
[0xc001029a - x86_AMD_V_KVM_MSRs_offset] = "AMD_CORE_ENERGY_STATUS",
[0xc001029b - x86_AMD_V_KVM_MSRs_offset] = "AMD_PKG_ENERGY_STATUS",
+ [0xc00102b0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP1",
+ [0xc00102b1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_ENABLE",
+ [0xc00102b2 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP2",
+ [0xc00102b3 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_REQ",
+ [0xc00102b4 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_STATUS",
[0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
[0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
};
$
And this gets rebuilt:
CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
INSTALL trace_plugins
LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
LD /tmp/build/perf/trace/beauty/perf-in.o
LD /tmp/build/perf/perf-in.o
LINK /tmp/build/perf/perf
Now one can trace systemwide asking to see backtraces to where those
MSRs are being read/written with:
# perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<="
Failed to set filter "(msr>=0xc00102b0 && msr<=) && (common_pid != 2612094 && common_pid != 3841)" on event msr:read_msr with 22 (Invalid argument)
# ^C
If we use -v (verbose mode) we can see what it does behind the scenes:
# perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<=AMD_CPPC_STATUS"
<SNIP>
New filter for msr:read_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
New filter for msr:write_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
<SNIP>
^C[root@five ~]#
Example with a frequent msr:
# perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
Using CPUID AuthenticAMD-25-21-0
0x48
New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
0x48
New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
mmap size 528384B
Looking at the vmlinux_path (8 entries long)
symsrc__init: build id mismatch for vmlinux.
Using /proc/kcore for kernel data
Using /proc/kallsyms for symbols
0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
do_trace_write_msr ([kernel.kallsyms])
do_trace_write_msr ([kernel.kallsyms])
__switch_to_xtra ([kernel.kallsyms])
__switch_to ([kernel.kallsyms])
__schedule ([kernel.kallsyms])
schedule ([kernel.kallsyms])
futex_wait_queue_me ([kernel.kallsyms])
futex_wait ([kernel.kallsyms])
do_futex ([kernel.kallsyms])
__x64_sys_futex ([kernel.kallsyms])
do_syscall_64 ([kernel.kallsyms])
entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
__futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
do_trace_write_msr ([kernel.kallsyms])
do_trace_write_msr ([kernel.kallsyms])
__switch_to_xtra ([kernel.kallsyms])
__switch_to ([kernel.kallsyms])
__schedule ([kernel.kallsyms])
schedule_idle ([kernel.kallsyms])
do_idle ([kernel.kallsyms])
cpu_startup_entry ([kernel.kallsyms])
secondary_startup_64_no_verify ([kernel.kallsyms])
#
Cc: Huang Rui <ray.huang@amd.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/x86/include/asm/msr-index.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
index 01e2650b958591e0..3faf0f97edb1bcd3 100644
--- a/tools/arch/x86/include/asm/msr-index.h
+++ b/tools/arch/x86/include/asm/msr-index.h
@@ -486,6 +486,23 @@
#define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
+/* AMD Collaborative Processor Performance Control MSRs */
+#define MSR_AMD_CPPC_CAP1 0xc00102b0
+#define MSR_AMD_CPPC_ENABLE 0xc00102b1
+#define MSR_AMD_CPPC_CAP2 0xc00102b2
+#define MSR_AMD_CPPC_REQ 0xc00102b3
+#define MSR_AMD_CPPC_STATUS 0xc00102b4
+
+#define AMD_CPPC_LOWEST_PERF(x) (((x) >> 0) & 0xff)
+#define AMD_CPPC_LOWNONLIN_PERF(x) (((x) >> 8) & 0xff)
+#define AMD_CPPC_NOMINAL_PERF(x) (((x) >> 16) & 0xff)
+#define AMD_CPPC_HIGHEST_PERF(x) (((x) >> 24) & 0xff)
+
+#define AMD_CPPC_MAX_PERF(x) (((x) & 0xff) << 0)
+#define AMD_CPPC_MIN_PERF(x) (((x) & 0xff) << 8)
+#define AMD_CPPC_DES_PERF(x) (((x) & 0xff) << 16)
+#define AMD_CPPC_ENERGY_PERF_PREF(x) (((x) & 0xff) << 24)
+
/* Fam 17h MSRs */
#define MSR_F17H_IRPERF 0xc00000e9
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources
2022-01-13 14:25 [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources Arnaldo Carvalho de Melo
@ 2022-01-13 19:14 ` Rafael J. Wysocki
2022-01-14 0:15 ` Huang Rui
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2022-01-13 19:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Huang Rui
Cc: Jiri Olsa, Namhyung Kim, Adrian Hunter, Ian Rogers,
Linux Kernel Mailing List, linux-perf-users
On 1/13/2022 3:25 PM, Arnaldo Carvalho de Melo wrote:
> To pick up the changes in:
>
> 89aa94b4a218339b ("x86/msr: Add AMD CPPC MSR definitions")
>
> Addressing these tools/perf build warnings:
>
> diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
> Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
>
> That makes the beautification scripts to pick some new entries:
>
> $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
> $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
> $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
> $ diff -u before after
> --- before 2022-01-13 10:59:51.743416890 -0300
> +++ after 2022-01-13 11:00:00.776644178 -0300
> @@ -303,6 +303,11 @@
> [0xc0010299 - x86_AMD_V_KVM_MSRs_offset] = "AMD_RAPL_POWER_UNIT",
> [0xc001029a - x86_AMD_V_KVM_MSRs_offset] = "AMD_CORE_ENERGY_STATUS",
> [0xc001029b - x86_AMD_V_KVM_MSRs_offset] = "AMD_PKG_ENERGY_STATUS",
> + [0xc00102b0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP1",
> + [0xc00102b1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_ENABLE",
> + [0xc00102b2 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP2",
> + [0xc00102b3 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_REQ",
> + [0xc00102b4 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_STATUS",
> [0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
> [0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
> };
> $
>
> And this gets rebuilt:
>
> CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
> INSTALL trace_plugins
> LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
> LD /tmp/build/perf/trace/beauty/perf-in.o
> LD /tmp/build/perf/perf-in.o
> LINK /tmp/build/perf/perf
>
> Now one can trace systemwide asking to see backtraces to where those
> MSRs are being read/written with:
>
> # perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<="
> Failed to set filter "(msr>=0xc00102b0 && msr<=) && (common_pid != 2612094 && common_pid != 3841)" on event msr:read_msr with 22 (Invalid argument)
> # ^C
>
> If we use -v (verbose mode) we can see what it does behind the scenes:
>
> # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<=AMD_CPPC_STATUS"
> <SNIP>
> New filter for msr:read_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
> New filter for msr:write_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
> <SNIP>
> ^C[root@five ~]#
>
> Example with a frequent msr:
>
> # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
> Using CPUID AuthenticAMD-25-21-0
> 0x48
> New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
> 0x48
> New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
> mmap size 528384B
> Looking at the vmlinux_path (8 entries long)
> symsrc__init: build id mismatch for vmlinux.
> Using /proc/kcore for kernel data
> Using /proc/kallsyms for symbols
> 0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
> do_trace_write_msr ([kernel.kallsyms])
> do_trace_write_msr ([kernel.kallsyms])
> __switch_to_xtra ([kernel.kallsyms])
> __switch_to ([kernel.kallsyms])
> __schedule ([kernel.kallsyms])
> schedule ([kernel.kallsyms])
> futex_wait_queue_me ([kernel.kallsyms])
> futex_wait ([kernel.kallsyms])
> do_futex ([kernel.kallsyms])
> __x64_sys_futex ([kernel.kallsyms])
> do_syscall_64 ([kernel.kallsyms])
> entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
> __futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
> 0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
> do_trace_write_msr ([kernel.kallsyms])
> do_trace_write_msr ([kernel.kallsyms])
> __switch_to_xtra ([kernel.kallsyms])
> __switch_to ([kernel.kallsyms])
> __schedule ([kernel.kallsyms])
> schedule_idle ([kernel.kallsyms])
> do_idle ([kernel.kallsyms])
> cpu_startup_entry ([kernel.kallsyms])
> secondary_startup_64_no_verify ([kernel.kallsyms])
> #
>
> Cc: Huang Rui <ray.huang@amd.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> tools/arch/x86/include/asm/msr-index.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
> index 01e2650b958591e0..3faf0f97edb1bcd3 100644
> --- a/tools/arch/x86/include/asm/msr-index.h
> +++ b/tools/arch/x86/include/asm/msr-index.h
> @@ -486,6 +486,23 @@
>
> #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
>
> +/* AMD Collaborative Processor Performance Control MSRs */
> +#define MSR_AMD_CPPC_CAP1 0xc00102b0
> +#define MSR_AMD_CPPC_ENABLE 0xc00102b1
> +#define MSR_AMD_CPPC_CAP2 0xc00102b2
> +#define MSR_AMD_CPPC_REQ 0xc00102b3
> +#define MSR_AMD_CPPC_STATUS 0xc00102b4
> +
> +#define AMD_CPPC_LOWEST_PERF(x) (((x) >> 0) & 0xff)
> +#define AMD_CPPC_LOWNONLIN_PERF(x) (((x) >> 8) & 0xff)
> +#define AMD_CPPC_NOMINAL_PERF(x) (((x) >> 16) & 0xff)
> +#define AMD_CPPC_HIGHEST_PERF(x) (((x) >> 24) & 0xff)
> +
> +#define AMD_CPPC_MAX_PERF(x) (((x) & 0xff) << 0)
> +#define AMD_CPPC_MIN_PERF(x) (((x) & 0xff) << 8)
> +#define AMD_CPPC_DES_PERF(x) (((x) & 0xff) << 16)
> +#define AMD_CPPC_ENERGY_PERF_PREF(x) (((x) & 0xff) << 24)
> +
> /* Fam 17h MSRs */
> #define MSR_F17H_IRPERF 0xc00000e9
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources
2022-01-13 19:14 ` Rafael J. Wysocki
@ 2022-01-14 0:15 ` Huang Rui
2022-01-14 14:35 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Huang Rui @ 2022-01-14 0:15 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim, Adrian Hunter,
Ian Rogers, Linux Kernel Mailing List,
linux-perf-users@vger.kernel.org
On Fri, Jan 14, 2022 at 03:14:32AM +0800, Rafael J. Wysocki wrote:
> On 1/13/2022 3:25 PM, Arnaldo Carvalho de Melo wrote:
> > To pick up the changes in:
> >
> > 89aa94b4a218339b ("x86/msr: Add AMD CPPC MSR definitions")
> >
> > Addressing these tools/perf build warnings:
> >
> > diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
> > Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
> >
> > That makes the beautification scripts to pick some new entries:
> >
> > $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
> > $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
> > $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
> > $ diff -u before after
> > --- before 2022-01-13 10:59:51.743416890 -0300
> > +++ after 2022-01-13 11:00:00.776644178 -0300
> > @@ -303,6 +303,11 @@
> > [0xc0010299 - x86_AMD_V_KVM_MSRs_offset] = "AMD_RAPL_POWER_UNIT",
> > [0xc001029a - x86_AMD_V_KVM_MSRs_offset] = "AMD_CORE_ENERGY_STATUS",
> > [0xc001029b - x86_AMD_V_KVM_MSRs_offset] = "AMD_PKG_ENERGY_STATUS",
> > + [0xc00102b0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP1",
> > + [0xc00102b1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_ENABLE",
> > + [0xc00102b2 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_CAP2",
> > + [0xc00102b3 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_REQ",
> > + [0xc00102b4 - x86_AMD_V_KVM_MSRs_offset] = "AMD_CPPC_STATUS",
> > [0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
> > [0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
> > };
> > $
> >
> > And this gets rebuilt:
> >
> > CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
> > INSTALL trace_plugins
> > LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
> > LD /tmp/build/perf/trace/beauty/perf-in.o
> > LD /tmp/build/perf/perf-in.o
> > LINK /tmp/build/perf/perf
> >
> > Now one can trace systemwide asking to see backtraces to where those
> > MSRs are being read/written with:
> >
> > # perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<="
> > Failed to set filter "(msr>=0xc00102b0 && msr<=) && (common_pid != 2612094 && common_pid != 3841)" on event msr:read_msr with 22 (Invalid argument)
> > # ^C
> >
> > If we use -v (verbose mode) we can see what it does behind the scenes:
> >
> > # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=AMD_CPPC_CAP1 && msr<=AMD_CPPC_STATUS"
> > <SNIP>
> > New filter for msr:read_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
> > New filter for msr:write_msr: (msr>=0xc00102b0 && msr<=0xc00102b4) && (common_pid != 2612102 && common_pid != 3841)
> > <SNIP>
> > ^C[root@five ~]#
> >
> > Example with a frequent msr:
> >
> > # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
> > Using CPUID AuthenticAMD-25-21-0
> > 0x48
> > New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
> > 0x48
> > New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
> > mmap size 528384B
> > Looking at the vmlinux_path (8 entries long)
> > symsrc__init: build id mismatch for vmlinux.
> > Using /proc/kcore for kernel data
> > Using /proc/kallsyms for symbols
> > 0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
> > do_trace_write_msr ([kernel.kallsyms])
> > do_trace_write_msr ([kernel.kallsyms])
> > __switch_to_xtra ([kernel.kallsyms])
> > __switch_to ([kernel.kallsyms])
> > __schedule ([kernel.kallsyms])
> > schedule ([kernel.kallsyms])
> > futex_wait_queue_me ([kernel.kallsyms])
> > futex_wait ([kernel.kallsyms])
> > do_futex ([kernel.kallsyms])
> > __x64_sys_futex ([kernel.kallsyms])
> > do_syscall_64 ([kernel.kallsyms])
> > entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
> > __futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
> > 0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
> > do_trace_write_msr ([kernel.kallsyms])
> > do_trace_write_msr ([kernel.kallsyms])
> > __switch_to_xtra ([kernel.kallsyms])
> > __switch_to ([kernel.kallsyms])
> > __schedule ([kernel.kallsyms])
> > schedule_idle ([kernel.kallsyms])
> > do_idle ([kernel.kallsyms])
> > cpu_startup_entry ([kernel.kallsyms])
> > secondary_startup_64_no_verify ([kernel.kallsyms])
> > #
> >
> > Cc: Huang Rui <ray.huang@amd.com>
> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
Thanks!
Acked-by: Huang Rui <ray.huang@amd.com>
>
> > ---
> > tools/arch/x86/include/asm/msr-index.h | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
> > index 01e2650b958591e0..3faf0f97edb1bcd3 100644
> > --- a/tools/arch/x86/include/asm/msr-index.h
> > +++ b/tools/arch/x86/include/asm/msr-index.h
> > @@ -486,6 +486,23 @@
> >
> > #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
> >
> > +/* AMD Collaborative Processor Performance Control MSRs */
> > +#define MSR_AMD_CPPC_CAP1 0xc00102b0
> > +#define MSR_AMD_CPPC_ENABLE 0xc00102b1
> > +#define MSR_AMD_CPPC_CAP2 0xc00102b2
> > +#define MSR_AMD_CPPC_REQ 0xc00102b3
> > +#define MSR_AMD_CPPC_STATUS 0xc00102b4
> > +
> > +#define AMD_CPPC_LOWEST_PERF(x) (((x) >> 0) & 0xff)
> > +#define AMD_CPPC_LOWNONLIN_PERF(x) (((x) >> 8) & 0xff)
> > +#define AMD_CPPC_NOMINAL_PERF(x) (((x) >> 16) & 0xff)
> > +#define AMD_CPPC_HIGHEST_PERF(x) (((x) >> 24) & 0xff)
> > +
> > +#define AMD_CPPC_MAX_PERF(x) (((x) & 0xff) << 0)
> > +#define AMD_CPPC_MIN_PERF(x) (((x) & 0xff) << 8)
> > +#define AMD_CPPC_DES_PERF(x) (((x) & 0xff) << 16)
> > +#define AMD_CPPC_ENERGY_PERF_PREF(x) (((x) & 0xff) << 24)
> > +
> > /* Fam 17h MSRs */
> > #define MSR_F17H_IRPERF 0xc00000e9
> >
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources
2022-01-14 0:15 ` Huang Rui
@ 2022-01-14 14:35 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-14 14:35 UTC (permalink / raw)
To: Huang Rui
Cc: Rafael J. Wysocki, Jiri Olsa, Namhyung Kim, Adrian Hunter,
Ian Rogers, Linux Kernel Mailing List,
linux-perf-users@vger.kernel.org
Em Fri, Jan 14, 2022 at 08:15:31AM +0800, Huang Rui escreveu:
> On Fri, Jan 14, 2022 at 03:14:32AM +0800, Rafael J. Wysocki wrote:
> > On 1/13/2022 3:25 PM, Arnaldo Carvalho de Melo wrote:
> > > To pick up the changes in:
> > >
> > > 89aa94b4a218339b ("x86/msr: Add AMD CPPC MSR definitions")
<SNIP>
> > > Cc: Huang Rui <ray.huang@amd.com>
> > > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
>
> Thanks!
>
> Acked-by: Huang Rui <ray.huang@amd.com>
Thanks, added both Acked-by tags to the patch.
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources
@ 2020-04-01 15:33 Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-04-01 15:33 UTC (permalink / raw)
To: Peter Zijlstra, Borislav Petkov
Cc: Adrian Hunter, Jiri Olsa, Namhyung Kim, linux-perf-users,
Linux Kernel Mailing List
Peter,
Just a FYI about this tooling capability:
perf trace -e msr:* --filter=msr==IA32_CORE_CAPS
or:
perf trace -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
And see only those MSRs being accessed via:
# perf trace -v -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
New filter for msr:read_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
New filter for msr:write_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
New filter for msr:rdpmc: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
Cheers,
- Arnaldo
---
To pick up the changes in:
6650cdd9a8cc ("x86/split_lock: Enable split lock detection by kernel")
Addressing this warning when build tools/perf:
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
Which causes these changes in tooling:
$ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
$ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
$ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
$ diff -u before after
--- before 2020-04-01 12:11:14.789344795 -0300
+++ after 2020-04-01 12:11:56.907798879 -0300
@@ -10,6 +10,7 @@
[0x00000029] = "KNC_EVNTSEL1",
[0x0000002a] = "IA32_EBL_CR_POWERON",
[0x0000002c] = "EBC_FREQUENCY_ID",
+ [0x00000033] = "TEST_CTRL",
[0x00000034] = "SMI_COUNT",
[0x0000003a] = "IA32_FEAT_CTL",
[0x0000003b] = "IA32_TSC_ADJUST",
@@ -27,6 +28,7 @@
[0x000000c2] = "IA32_PERFCTR1",
[0x000000cd] = "FSB_FREQ",
[0x000000ce] = "PLATFORM_INFO",
+ [0x000000cf] = "IA32_CORE_CAPS",
[0x000000e2] = "PKG_CST_CONFIG_CONTROL",
[0x000000e7] = "IA32_MPERF",
[0x000000e8] = "IA32_APERF",
$
$ make -C tools/perf O=/tmp/build/perf install-bin
<SNIP>
CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
LD /tmp/build/perf/trace/beauty/perf-in.o
LD /tmp/build/perf/perf-in.o
LINK /tmp/build/perf/perf
<SNIP>
Now one can do:
perf trace -e msr:* --filter=msr==IA32_CORE_CAPS
or:
perf trace -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
And see only those MSRs being accessed via:
# perf trace -v -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
New filter for msr:read_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
New filter for msr:write_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
New filter for msr:rdpmc: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/x86/include/asm/msr-index.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
index d5e517d1c3dd..12c9684d59ba 100644
--- a/tools/arch/x86/include/asm/msr-index.h
+++ b/tools/arch/x86/include/asm/msr-index.h
@@ -41,6 +41,10 @@
/* Intel MSRs. Some also available on other CPUs */
+#define MSR_TEST_CTRL 0x00000033
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT 29
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT BIT(MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT)
+
#define MSR_IA32_SPEC_CTRL 0x00000048 /* Speculation Control */
#define SPEC_CTRL_IBRS BIT(0) /* Indirect Branch Restricted Speculation */
#define SPEC_CTRL_STIBP_SHIFT 1 /* Single Thread Indirect Branch Predictor (STIBP) bit */
@@ -70,6 +74,11 @@
*/
#define MSR_IA32_UMWAIT_CONTROL_TIME_MASK (~0x03U)
+/* Abbreviated from Intel SDM name IA32_CORE_CAPABILITIES */
+#define MSR_IA32_CORE_CAPS 0x000000cf
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT 5
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT BIT(MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT)
+
#define MSR_PKG_CST_CONFIG_CONTROL 0x000000e2
#define NHM_C3_AUTO_DEMOTE (1UL << 25)
#define NHM_C1_AUTO_DEMOTE (1UL << 26)
--
2.21.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-14 14:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-13 14:25 [PATCH 1/1 FYI] tools arch x86: Sync the msr-index.h copy with the kernel sources Arnaldo Carvalho de Melo
2022-01-13 19:14 ` Rafael J. Wysocki
2022-01-14 0:15 ` Huang Rui
2022-01-14 14:35 ` Arnaldo Carvalho de Melo
-- strict thread matches above, loose matches on Subject: below --
2020-04-01 15:33 Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).