• Arnaldo Carvalho de Melo's avatar
    tools arch x86: Sync the msr-index.h copy with the kernel sources · f815fe51
    Arnaldo Carvalho de Melo authored
    To pick up the changes in:
    
      d6a162a4 x86/msr-index: Add bunch of MSRs for Arch LBR
      ed7bde7a cpufreq: intel_pstate: Allow enable/disable energy efficiency
      99e40204 (tip/x86/cleanups) x86/msr: Move the F15h MSRs where they belong
      1068ed45 x86/msr: Lift AMD family 0x15 power-specific MSRs
      5cde2653 (tag: perf-core-2020-06-01) perf/x86/rapl: Add AMD Fam17h RAPL support
    
    Addressing these tools/perf build warnings:
    
    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	2020-08-07 08:45:18.801298854 -0300
      +++ after	2020-08-07 08:45:28.654456422 -0300
      @@ -271,6 +271,8 @@
       	[0xc0010062 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PERF_CTL",
       	[0xc0010063 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PERF_STATUS",
       	[0xc0010064 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PSTATE_DEF_BASE",
      +	[0xc001007a - x86_AMD_V_KVM_MSRs_offset] = "F15H_CU_PWR_ACCUMULATOR",
      +	[0xc001007b - x86_AMD_V_KVM_MSRs_offset] = "F15H_CU_MAX_PWR_ACCUMULATOR",
       	[0xc0010112 - x86_AMD_V_KVM_MSRs_offset] = "K8_TSEG_ADDR",
       	[0xc0010113 - x86_AMD_V_KVM_MSRs_offset] = "K8_TSEG_MASK",
       	[0xc0010114 - x86_AMD_V_KVM_MSRs_offset] = "VM_CR",
      $
    
    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==F15H_CU_PWR_ACCUMULATOR || msr==F15H_CU_MAX_PWR_ACCUMULATOR"
      ^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==F15H_CU_PWR_ACCUMULATOR || msr==F15H_CU_MAX_PWR_ACCUMULATOR"
      Using CPUID GenuineIntel-6-8E-A
      0xc001007a
      0xc001007b
      New filter for msr:read_msr: (msr==0xc001007a || msr==0xc001007b) && (common_pid != 2448054 && common_pid != 2782)
      0xc001007a
      0xc001007b
      New filter for msr:write_msr: (msr==0xc001007a || msr==0xc001007b) && (common_pid != 2448054 && common_pid != 2782)
      mmap size 528384B
      ^C#
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Cc: Stephane Eranian <eranian@google.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    f815fe51
msr-index.h 34.1 KB