Skip to content
Snippets Groups Projects
  1. Aug 12, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers kvm s390: Sync headers with the kernel sources · 23db762b
      Arnaldo Carvalho de Melo authored
      
      To pick the changes in:
      
        23a60f83 ("s390/kvm: diagnose 0x318 sync and reset")
      
      None of them trigger any changes in tooling, this time this is just to silence
      these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'
        diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Collin Walling <walling@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      23db762b
  2. Aug 07, 2020
    • Athira Rajeev's avatar
      perf tools powerpc: Add support for extended regs in power10 · 66655986
      Athira Rajeev authored
      
      Added support for supported regs which are new in power10 ( MMCR3,
      SIER2, SIER3 ) to sample_reg_mask in the tool side to use with `-I?`
      option. Also added PVR check to send extended mask for power10 at kernel
      while capturing extended regs in each sample.
      
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      66655986
    • Anju T Sudhakar's avatar
      perf tools powerpc: Add support for extended register capability · 33583e69
      Anju T Sudhakar authored
      
      Add extended regs to sample_reg_mask in the tool side to use with `-I?`
      option. Perf tools side uses extended mask to display the platform
      supported register names (with -I? option) to the user and also send
      this mask to the kernel to capture the extended registers in each
      sample. Hence decide the mask value based on the processor version.
      
      Currently definitions for `mfspr`, `SPRN_PVR` are part of
      `arch/powerpc/util/header.c`. Move this to a header file so that these
      definitions can be re-used in other source files as well.
      
      Signed-off-by: default avatarAnju T Sudhakar <anju@linux.vnet.ibm.com>
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Reviewed--by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Tested-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michael Neuling <mikey@neuling.org> <mikey@neuling.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      [Decide extended mask at run time based on platform]
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      33583e69
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · dd4a5c22
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from:
      
        85b23fbc ("x86/cpufeatures: Add enumeration for SERIALIZE instruction")
        bd657aa3 ("x86/cpufeatures: Add Architectural LBRs feature bit")
        fbd5969d ("x86/cpufeatures: Mark two free bits in word 3")
      
      These should't cause any changes in tooling, it just gets rebuilt by
      including those headers:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
        LD       /tmp/build/perf/bench/perf-in.o
        LD       /tmp/build/perf/perf-in.o
        LINK     /tmp/build/perf/perf
      
      And silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      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: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd4a5c22
    • 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
  3. Jul 30, 2020
  4. Jul 22, 2020
  5. Jul 17, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools arch kvm: Sync kvm headers with the kernel sources · 25d4e7f5
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from:
      
        83d31e52 ("KVM: nVMX: fixes for preemption timer migration")
      
      That don't entail changes in tooling.
      
      This silences these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'
        diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      25d4e7f5
  6. Jul 03, 2020
  7. Jun 22, 2020
    • Borislav Petkov's avatar
      x86/msr: Move the F15h MSRs where they belong · 99e40204
      Borislav Petkov authored
      
      1068ed45 ("x86/msr: Lift AMD family 0x15 power-specific MSRs")
      
      moved the three F15h power MSRs to the architectural list but that was
      wrong as they belong in the family 0x15 list. That also caused:
      
        In file included from trace/beauty/tracepoints/x86_msr.c:10:
        perf/trace/beauty/generated/x86_arch_MSRs_array.c:292:45: error: initialized field overwritten [-Werror=override-init]
          292 |  [0xc0010280 - x86_AMD_V_KVM_MSRs_offset] = "F15H_PTSC",
              |                                             ^~~~~~~~~~~
        perf/trace/beauty/generated/x86_arch_MSRs_array.c:292:45: note: (near initialization for 'x86_AMD_V_KVM_MSRs[640]')
      
      due to MSR_F15H_PTSC ending up being defined twice. Move them where they
      belong and drop the duplicate.
      
      Also, drop the respective tools/ changes of the msr-index.h copy the
      above commit added because perf tool developers prefer to go through
      those changes themselves in order to figure out whether changes to the
      kernel headers would need additional handling in perf.
      
      Fixes: 1068ed45 ("x86/msr: Lift AMD family 0x15 power-specific MSRs")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lkml.kernel.org/r/20200621163323.14e8533f@canb.auug.org.au
      99e40204
  8. Jun 17, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 25ca7e5c
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes in:
      
        7e5b3c26 ("x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation")
      
      Addressing these tools/perf build warnings:
      
        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
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      With this one will be able to use these new AMD MSRs in filters, by
      name, e.g.:
      
        # perf trace -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
        ^C#
      
      Using -v we can see how it sets up the tracepoint filters, converting
      from the string in the filter to the numeric value:
      
        # perf trace -v -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
        Using CPUID GenuineIntel-6-8E-A
        0x123
        New filter for msr:read_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        0x123
        New filter for msr:write_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        0x123
        New filter for msr:rdpmc: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
        mmap size 528384B
        ^C#
      
      The updating process shows how this affects tooling in more detail:
      
        $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
        --- tools/arch/x86/include/asm/msr-index.h	2020-06-03 10:36:09.959910238 -0300
        +++ arch/x86/include/asm/msr-index.h	2020-06-17 10:04:20.235052901 -0300
        @@ -128,6 +128,10 @@
         #define TSX_CTRL_RTM_DISABLE		BIT(0)	/* Disable RTM feature */
         #define TSX_CTRL_CPUID_CLEAR		BIT(1)	/* Disable TSX enumeration */
      
        +/* SRBDS support */
        +#define MSR_IA32_MCU_OPT_CTRL		0x00000123
        +#define RNGDS_MITG_DIS			BIT(0)
        +
         #define MSR_IA32_SYSENTER_CS		0x00000174
         #define MSR_IA32_SYSENTER_ESP		0x00000175
         #define MSR_IA32_SYSENTER_EIP		0x00000176
        $ set -o vi
        $ 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-06-17 10:05:49.653114752 -0300
        +++ after	2020-06-17 10:06:01.777258731 -0300
        @@ -51,6 +51,7 @@
         	[0x0000011e] = "IA32_BBL_CR_CTL3",
         	[0x00000120] = "IDT_MCR_CTRL",
         	[0x00000122] = "IA32_TSX_CTRL",
        +	[0x00000123] = "IA32_MCU_OPT_CTRL",
         	[0x00000140] = "MISC_FEATURES_ENABLES",
         	[0x00000174] = "IA32_SYSENTER_CS",
         	[0x00000175] = "IA32_SYSENTER_ESP",
        $
      
      The related change to cpu-features.h affects this:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      This shouldn't be affecting that 'perf bench' entry:
      
        $ find tools/perf/ -type f | xargs grep SRBDS
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Gross <mgross@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      25ca7e5c
  9. Jun 15, 2020
  10. Jun 09, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync kvm.h headers with the kernel sources · dd76c302
      Arnaldo Carvalho de Melo authored
      
      To pick the changes in:
      
        f97f5a56 ("x86/kvm/hyper-v: Add support for synthetic debugger interface")
        850448f3 ("KVM: nVMX: Fix VMX preemption timer migration")
        2c4c4132 ("KVM: x86: Print symbolic names of VMX VM-Exit flags in traces")
        cc440cda ("KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE")
        f7d31e65 ("x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit")
        72de5fa4 ("KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT")
        acd05785 ("kvm: add capability for halt polling")
        3ecad8c2 ("docs: fix broken references for ReST files that moved around")
      
      That do not result in any change in tooling, as the additions are not
      being used in any table generator.
      
      This silences these perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'
        diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/vmx.h' differs from latest version at 'arch/x86/include/uapi/asm/vmx.h'
        diff -u tools/arch/x86/include/uapi/asm/vmx.h arch/x86/include/uapi/asm/vmx.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Matlack <dmatlack@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jon Doron <arilou@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Shier <pshier@google.com>
      Cc: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd76c302
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86 uapi: Synch asm/unistd.h with the kernel sources · 7e579f3a
      Arnaldo Carvalho de Melo authored
      
      To pick up the change in:
      
        700d3a5a ("x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"")
      
      That doesn't trigger any changes in tooling and silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h'
        diff -u tools/arch/x86/include/uapi/asm/unistd.h arch/x86/include/uapi/asm/unistd.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e579f3a
  11. Jun 02, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 3b1f47d6
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes in:
      
        5cde2653 ("perf/x86/rapl: Add AMD Fam17h RAPL support")
      
      Addressing this tools/perf build warning:
      
        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
      
      With this one will be able to use these new AMD MSRs in filters, by
      name, e.g.:
      
         # perf trace -e msr:* --filter="msr==AMD_PKG_ENERGY_STATUS || msr==AMD_RAPL_POWER_UNIT"
      
      Just like it is now possible with other MSRs:
      
        [root@five ~]# uname -a
        Linux five 5.5.17-200.fc31.x86_64 #1 SMP Mon Apr 13 15:29:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
        [root@five ~]# grep 'model name' -m1 /proc/cpuinfo
        model name	: AMD Ryzen 5 3600X 6-Core Processor
        [root@five ~]#
        [root@five ~]# perf trace -e msr:*/max-stack=16/ --filter="msr==AMD_PERF_CTL" --max-events=2
             0.000 kworker/1:1-ev/2327824 msr:write_msr(msr: AMD_PERF_CTL, val: 2)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               [0xffffffffc01d71c3] ([acpi_cpufreq])
                                               [0] ([unknown])
                                               __cpufreq_driver_target ([kernel.kallsyms])
                                               od_dbs_update ([kernel.kallsyms])
                                               dbs_work_handler ([kernel.kallsyms])
                                               process_one_work ([kernel.kallsyms])
                                               worker_thread ([kernel.kallsyms])
                                               kthread ([kernel.kallsyms])
                                               ret_from_fork ([kernel.kallsyms])
             8.597 kworker/2:2-ev/2338099 msr:write_msr(msr: AMD_PERF_CTL, val: 2)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               [0] ([unknown])
                                               [0] ([unknown])
                                               __cpufreq_driver_target ([kernel.kallsyms])
                                               od_dbs_update ([kernel.kallsyms])
                                               dbs_work_handler ([kernel.kallsyms])
                                               process_one_work ([kernel.kallsyms])
                                               worker_thread ([kernel.kallsyms])
                                               kthread ([kernel.kallsyms])
                                               ret_from_fork ([kernel.kallsyms])
        [root@five ~]#
      
      Longer explanation with what happens in the perf build process,
      automatically after this is made in synch with the kernel sources:
      
        $ make -C tools/perf O=/tmp/build/perf install-bin
        <SNIP>
        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
        <SNIP>
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $
        $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
        --- tools/arch/x86/include/asm/msr-index.h	2020-06-02 10:46:36.217782288 -0300
        +++ arch/x86/include/asm/msr-index.h	2020-05-28 10:41:23.313794627 -0300
        @@ -301,6 +301,9 @@
         #define MSR_PP1_ENERGY_STATUS		0x00000641
         #define MSR_PP1_POLICY			0x00000642
      
        +#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
        +#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
        +
         /* Config TDP MSRs */
         #define MSR_CONFIG_TDP_NOMINAL		0x00000648
         #define MSR_CONFIG_TDP_LEVEL_1		0x00000649
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $
        $ 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>
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        --- before	2020-06-02 10:47:08.486334348 -0300
        +++ after	2020-06-02 10:47:33.075008948 -0300
        @@ -286,6 +286,8 @@
         	[0xc0010240 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTL",
         	[0xc0010241 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTR",
         	[0xc0010280 - x86_AMD_V_KVM_MSRs_offset] = "F15H_PTSC",
        +	[0xc0010299 - x86_AMD_V_KVM_MSRs_offset] = "AMD_RAPL_POWER_UNIT",
        +	[0xc001029b - x86_AMD_V_KVM_MSRs_offset] = "AMD_PKG_ENERGY_STATUS",
         	[0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
         	[0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
         };
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3b1f47d6
  12. Jun 01, 2020
  13. May 26, 2020
  14. Apr 22, 2020
  15. Apr 14, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · e00a2d90
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from:
      
        077168e2 ("x86/mce/amd: Add PPIN support for AMD MCE")
        753039ef ("x86/cpu/amd: Call init_amd_zn() om Family 19h processors too")
        6650cdd9 ("x86/split_lock: Enable split lock detection by kernel")
      
      These don't cause any changes in tooling, just silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Wei Huang <wei.huang2@amd.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e00a2d90
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · bab1a501
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        6650cdd9 ("x86/split_lock: Enable split lock detection by kernel")
      
        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>
      Link: https://lore.kernel.org/lkml/20200401153325.GC12534@kernel.org/
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bab1a501
  16. Mar 27, 2020
  17. Mar 26, 2020
  18. Mar 16, 2020
  19. Feb 27, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Update tools's copy of kvm.h headers · 0d6f94fd
      Arnaldo Carvalho de Melo authored
      
      Picking the changes from:
      
        5ef8acbd ("KVM: nVMX: Emulate MTF when performing instruction emulation")
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'
        diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
      
      No change in tooling ensues, just the x86 kvm tooling gets rebuilt as
      those headers are included in its build:
      
        $ cp arch/x86/include/uapi/asm/kvm.h tools/arch/x86/include/uapi/asm/kvm.h
        $ make -C tools/perf
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        <SNIP>
        ...        disassembler-four-args: [ on  ]
      
          DESCEND  plugins
          CC       /tmp/build/perf/arch/x86/util/kvm-stat.o
        <SNIP>
          LD       /tmp/build/perf/arch/x86/util/perf-in.o
          LD       /tmp/build/perf/arch/x86/perf-in.o
          LD       /tmp/build/perf/arch/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
        $
      
      As it doesn't seem to be used there:
      
        $ grep STATE tools/perf/arch/x86/util/kvm-stat.c
        $
      
      And the 'perf trace' beautifier table generator isn't interested in
      these things:
      
        $ grep regex= tools/perf/trace/beauty/kvm_ioctl.sh
        regex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0d6f94fd
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · d8e3ee2e
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from these csets:
      
        21b5ee59 ("x86/cpu/amd: Enable the fixed Instructions Retired counter IRPERF")
      
        $ 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
        $ git diff
        diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
        index ebe1685e92dd..d5e517d1c3dd 100644
        --- a/tools/arch/x86/include/asm/msr-index.h
        +++ b/tools/arch/x86/include/asm/msr-index.h
        @@ -512,6 +512,8 @@
         #define MSR_K7_HWCR                    0xc0010015
         #define MSR_K7_HWCR_SMMLOCK_BIT                0
         #define MSR_K7_HWCR_SMMLOCK            BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
        +#define MSR_K7_HWCR_IRPERF_EN_BIT      30
        +#define MSR_K7_HWCR_IRPERF_EN          BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
         #define MSR_K7_FID_VID_CTL             0xc0010041
         #define MSR_K7_FID_VID_STATUS          0xc0010042
        $
      
      That don't result in any change in tooling:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        $
      
      To silence this perf build warning:
      
        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
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d8e3ee2e
  20. Feb 12, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers kvm: Sync kvm headers with the kernel sources · 391df72f
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from:
      
        290a6bb0 ("arm64: KVM: Add UAPI notes for swapped registers")
      
      No tools changes are caused by this.
      
      This addresses these tools/perf build warnings:
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Jones <drjones@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      391df72f
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · 71dd6528
      Arnaldo Carvalho de Melo authored
      
      To pick up the changes from:
      
        85c17291 ("x86/cpufeatures: Add flag to track whether MSR IA32_FEAT_CTL is configured")
        f444a5ff ("x86/cpufeatures: Add support for fast short REP; MOVSB")
      
      These don't cause any changes in tooling, just silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      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: Sean Christopherson <sean.j.christopherson@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71dd6528
    • Arnaldo Carvalho de Melo's avatar
      tools headers x86: Sync disabled-features.h · 7636b586
      Arnaldo Carvalho de Melo authored
      
      To silence the following tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
      
      Picking up the changes in:
      
        45fc24e8 ("x86/mpx: remove MPX from arch/x86")
      
      that didn't entail any functionality change in the tooling side.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7636b586
  21. Feb 11, 2020
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync copy of arm64's asm/unistd.h with the kernel sources · c75bec79
      Arnaldo Carvalho de Melo authored
      
      To get the changes in:
      
        3e3c8ca5 ("arm64: Move __ARCH_WANT_SYS_CLONE3 definition to uapi headers")
      
      Silencing this tools/perf/ build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/unistd.h' differs from latest version at 'arch/arm64/include/uapi/asm/unistd.h'
        diff -u tools/arch/arm64/include/uapi/asm/unistd.h arch/arm64/include/uapi/asm/unistd.h
      
      Which will probably end up enabling the use of "clone3" in 'perf trace -e',
      haven't checked the build with this change on an arm64 system.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Amanieu d'Antras <amanieu@gmail.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c75bec79
  22. Jan 22, 2020
    • Masami Hiramatsu's avatar
      x86/decoder: Add TEST opcode to Group3-2 · 8b7e20a7
      Masami Hiramatsu authored
      
      Add TEST opcode to Group3-2 reg=001b as same as Group3-1 does.
      
      Commit
      
        12a78d43 ("x86/decoder: Add new TEST instruction pattern")
      
      added a TEST opcode assignment to f6 XX/001/XXX (Group 3-1), but did
      not add f7 XX/001/XXX (Group 3-2).
      
      Actually, this TEST opcode variant (ModRM.reg /1) is not described in
      the Intel SDM Vol2 but in AMD64 Architecture Programmer's Manual Vol.3,
      Appendix A.2 Table A-6. ModRM.reg Extensions for the Primary Opcode Map.
      
      Without this fix, Randy found a warning by insn_decoder_test related
      to this issue as below.
      
          HOSTCC  arch/x86/tools/insn_decoder_test
          HOSTCC  arch/x86/tools/insn_sanity
          TEST    posttest
        arch/x86/tools/insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
        arch/x86/tools/insn_decoder_test: warning: ffffffff81000bf1:	f7 0b 00 01 08 00    	testl  $0x80100,(%rbx)
        arch/x86/tools/insn_decoder_test: warning: objdump says 6 bytes, but insn_get_length() says 2
        arch/x86/tools/insn_decoder_test: warning: Decoded and checked 11913894 instructions with 1 failures
          TEST    posttest
        arch/x86/tools/insn_sanity: Success: decoded and checked 1000000 random instructions with 0 errors (seed:0x871ce29c)
      
      To fix this error, add the TEST opcode according to AMD64 APM Vol.3.
      
       [ bp: Massage commit message. ]
      
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Link: https://lkml.kernel.org/r/157966631413.9580.10311036595431878351.stgit@devnote2
      8b7e20a7
  23. Jan 13, 2020
  24. Jan 08, 2020
  25. Dec 02, 2019
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · a717ab38
      Arnaldo Carvalho de Melo authored
      To pick up the changes from:
      
        a25bbc26 ("Merge branches 'x86-cpu-for-linus' and 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
        db4d30fb ("x86/bugs: Add ITLB_MULTIHIT bug infrastructure")
        1b42f017 ("x86/speculation/taa: Add mitigation for TSX Async Abort")
        9d40b85b ("x86/cpufeatures: Add feature bit RDPRU on AMD")
      
      These don't cause any changes in tooling, just silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Babu Moger <babu.moger@amd.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vineela Tummalapalli <vineela.tummalapalli@intel.com>
      Link: https://lkml.kernel.org/n/tip-yufg9yt2nbkh45r9xvxnnscq@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a717ab38
    • Arnaldo Carvalho de Melo's avatar
      tools headers kvm: Sync kvm headers with the kernel sources · 1fc3d0ee
      Arnaldo Carvalho de Melo authored
      To pick up the changes from:
      
        14edff88 Merge tag 'kvmarm-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
        a4b28f5c Merge remote-tracking branch 'kvmarm/kvm-arm64/stolen-time' into kvmarm-master/next
        58772e9a ("KVM: arm64: Provide VCPU attributes for stolen time")
        da345174 ("KVM: arm/arm64: Allow user injection of external data aborts")
        c726200d ("KVM: arm/arm64: Allow reporting non-ISV data aborts to userspace")
        efe5ddca ("KVM: PPC: Book3S HV: XIVE: Allow userspace to set the # of VPs")
      
      No tools changes are caused by this, as the only defines so far used
      from these files are for syscall arg pretty printing are:
      
        $ grep KVM tools/perf/trace/beauty/*.sh
        tools/perf/trace/beauty/kvm_ioctl.sh:regex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
        $
      
      Some are also include by:
      
        tools/perf/arch/x86/util/kvm-stat.c
        tools/perf/arch/powerpc/util/kvm-stat.c
      
      This addresses these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
        Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h'
        diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm/include/uapi/asm/kvm.h arch/arm/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christoffer Dall <christoffer.dall@arm.com>
      Cc: Fabiano Rosas <farosas@linux.ibm.com>
      Cc: Greg Kurz <groug@kaod.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Steven Price <steven.price@arm.com>
      Link: https://lkml.kernel.org/n/tip-qrjdudhq25mk5bfnhveofbm4@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1fc3d0ee
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 8122b047
      Arnaldo Carvalho de Melo authored
      To pick up the changes from these csets:
      
        3f3c8be9 Merge tag 'for-linus-5.5a-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
        4e3f77d8 ("xen/mcelog: add PPIN to record when available")
        db4d30fb ("x86/bugs: Add ITLB_MULTIHIT bug infrastructure")
        1b42f017 ("x86/speculation/taa: Add mitigation for TSX Async Abort")
        c2955f27 ("x86/msr: Add the IA32_TSX_CTRL MSR")
      
      These are the changes in tooling that this udpate ensues:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > /tmp/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 > /tmp/after
        $ diff -u /tmp/before /tmp/after
        --- /tmp/before	2019-12-02 11:54:44.371035723 -0300
        +++ /tmp/after	2019-12-02 11:55:31.847859784 -0300
        @@ -48,6 +48,7 @@
         	[0x00000119] = "IA32_BBL_CR_CTL",
         	[0x0000011e] = "IA32_BBL_CR_CTL3",
         	[0x00000120] = "IDT_MCR_CTRL",
        +	[0x00000122] = "IA32_TSX_CTRL",
         	[0x00000140] = "MISC_FEATURES_ENABLES",
         	[0x00000174] = "IA32_SYSENTER_CS",
         	[0x00000175] = "IA32_SYSENTER_ESP",
        @@ -283,4 +284,6 @@
         	[0xc0010240 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTL",
         	[0xc0010241 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTR",
         	[0xc0010280 - x86_AMD_V_KVM_MSRs_offset] = "F15H_PTSC",
        +	[0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
        +	[0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
         };
        $
      
        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
      
      Now it is possible to use these strings when setting up filters for the msr:*
      tracepoints, like:
      
        # perf trace -e msr:* --filter=msr==IA32_TSX_CTRL
        ^C[root@quaco ~]#
      
      If we use an invalid operator we can check what is the filter that is put in
      place:
      
        # perf trace -e msr:* --filter=msr=IA32_TSX_CTRL
        Failed to set filter "(msr=0x122) && (common_pid != 25976 && common_pid != 25860)" on event msr:read_msr with 22 (Invalid argument)
      
      One can as well use -v to see the tracepoints and its filters:
      
        # perf trace -v -e msr:* --filter=msr==IA32_TSX_CTRL
        Using CPUID GenuineIntel-6-8E-A
        New filter for msr:read_msr: (msr==0x122) && (common_pid != 26110 && common_pid != 25860)
        New filter for msr:write_msr: (msr==0x122) && (common_pid != 26110 && common_pid != 25860)
        New filter for msr:rdpmc: (msr==0x122) && (common_pid != 26110 && common_pid != 25860)
        mmap size 528384B
        ^C#
      
      Better than keep looking up those numbers, works with callchains as
      well, e.g. for something more common:
      
        # perf trace -e msr:*/max-stack=16/ --filter="msr==IA32_SPEC_CTRL" --max-events=2
             0.000 SCTP timer/6158 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])
                                               __sched_text_start ([kernel.kallsyms])
                                               schedule ([kernel.kallsyms])
                                               schedule_hrtimeout_range_clock ([kernel.kallsyms])
                                               poll_schedule_timeout.constprop.0 ([kernel.kallsyms])
                                               do_select ([kernel.kallsyms])
                                               core_sys_select ([kernel.kallsyms])
                                               kern_select ([kernel.kallsyms])
                                               __x64_sys_select ([kernel.kallsyms])
                                               do_syscall_64 ([kernel.kallsyms])
                                               entry_SYSCALL_64 ([kernel.kallsyms])
                                               __select (/usr/lib64/libc-2.29.so)
                                               [0] ([unknown])
             0.024 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               __switch_to_xtra ([kernel.kallsyms])
                                               __switch_to ([kernel.kallsyms])
                                               __sched_text_start ([kernel.kallsyms])
                                               schedule_idle ([kernel.kallsyms])
                                               do_idle ([kernel.kallsyms])
                                               cpu_startup_entry ([kernel.kallsyms])
                                               start_secondary ([kernel.kallsyms])
                                               [0x2000d4] ([kernel.kallsyms])
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jan Beulich <jbeulich@suse.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vineela Tummalapalli <vineela.tummalapalli@intel.com>
      Link: https://lkml.kernel.org/n/tip-n1xd78fpd5lxn4q1brqi2jl6@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8122b047
    • Arnaldo Carvalho de Melo's avatar
      perf bench: Update the copies of x86's mem{cpy,set}_64.S · bd5c6b81
      Arnaldo Carvalho de Melo authored
      And update linux/linkage.h, which requires in turn that we make these
      files switch from ENTRY()/ENDPROC() to SYM_FUNC_START()/SYM_FUNC_END():
      
        tools/perf/arch/arm64/tests/regs_load.S
        tools/perf/arch/arm/tests/regs_load.S
        tools/perf/arch/powerpc/tests/regs_load.S
        tools/perf/arch/x86/tests/regs_load.S
      
      We also need to switch SYM_FUNC_START_LOCAL() to SYM_FUNC_START() for
      the functions used directly by 'perf bench', and update
      tools/perf/check_headers.sh to ignore those changes when checking if the
      kernel original files drifted from the copies we carry.
      
      This is to get the changes from:
      
        6dcc5627 ("x86/asm: Change all ENTRY+ENDPROC to SYM_FUNC_*")
        ef1e0315 ("x86/asm: Make some functions local")
        e9b9d020 ("x86/asm: Annotate aliases")
      
      And address these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
        diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-tay3l8x8k11p7y3qcpqh9qh5@git.kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd5c6b81
  26. Nov 26, 2019
    • Adrian Hunter's avatar
      x86/insn: Add some more Intel instructions to the opcode map · af4933c1
      Adrian Hunter authored
      
      Add to the opcode map the following instructions:
      
      	v4fmaddps
      	v4fmaddss
      	v4fnmaddps
      	v4fnmaddss
      	vaesdec
      	vaesdeclast
      	vaesenc
      	vaesenclast
      	vcvtne2ps2bf16
      	vcvtneps2bf16
      	vdpbf16ps
      	gf2p8affineinvqb
      	vgf2p8affineinvqb
      	gf2p8affineqb
      	vgf2p8affineqb
      	gf2p8mulb
      	vgf2p8mulb
      	vp2intersectd
      	vp2intersectq
      	vp4dpwssd
      	vp4dpwssds
      	vpclmulqdq
      	vpcompressb
      	vpcompressw
      	vpdpbusd
      	vpdpbusds
      	vpdpwssd
      	vpdpwssds
      	vpexpandb
      	vpexpandw
      	vpopcntb
      	vpopcntd
      	vpopcntq
      	vpopcntw
      	vpshldd
      	vpshldq
      	vpshldvd
      	vpshldvq
      	vpshldvw
      	vpshldw
      	vpshrdd
      	vpshrdq
      	vpshrdvd
      	vpshrdvq
      	vpshrdvw
      	vpshrdw
      	vpshufbitqmb
      
      For information about the instructions, refer Intel SDM May 2019
      (325462-070US) and Intel Architecture Instruction Set Extensions May
      2019 (319433-037).
      
      The instruction decoding can be tested using the perf tools' "x86
      instruction decoder - new instructions" test e.g.
      
        $ perf test -v "new " 2>&1 | grep -i 'v4fmaddps'
        Decoded ok: 62 f2 7f 48 9a 20                   v4fmaddps (%eax),%zmm0,%zmm4
        Decoded ok: 62 f2 7f 48 9a a4 c8 78 56 34 12    v4fmaddps 0x12345678(%eax,%ecx,8),%zmm0,%zmm4
        Decoded ok: 62 f2 7f 48 9a 20                   v4fmaddps (%rax),%zmm0,%zmm4
        Decoded ok: 67 62 f2 7f 48 9a 20                v4fmaddps (%eax),%zmm0,%zmm4
        Decoded ok: 62 f2 7f 48 9a a4 c8 78 56 34 12    v4fmaddps 0x12345678(%rax,%rcx,8),%zmm0,%zmm4
        Decoded ok: 67 62 f2 7f 48 9a a4 c8 78 56 34 12 v4fmaddps 0x12345678(%eax,%ecx,8),%zmm0,%zmm4
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20191125125044.31879-3-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      af4933c1
  27. Nov 18, 2019
    • Adrian Hunter's avatar
      x86/insn: Add some Intel instructions to the opcode map · b980be18
      Adrian Hunter authored
      
      Add to the opcode map the following instructions:
              cldemote
              tpause
              umonitor
              umwait
              movdiri
              movdir64b
              enqcmd
              enqcmds
              encls
              enclu
              enclv
              pconfig
              wbnoinvd
      
      For information about the instructions, refer Intel SDM May 2019
      (325462-070US) and Intel Architecture Instruction Set Extensions
      May 2019 (319433-037).
      
      The instruction decoding can be tested using the perf tools'
      "x86 instruction decoder - new instructions" test as folllows:
      
        $ perf test -v "new " 2>&1 | grep -i cldemote
        Decoded ok: 0f 1c 00                    cldemote (%eax)
        Decoded ok: 0f 1c 05 78 56 34 12        cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%eax,%ecx,8)
        Decoded ok: 0f 1c 00                    cldemote (%rax)
        Decoded ok: 41 0f 1c 00                 cldemote (%r8)
        Decoded ok: 0f 1c 04 25 78 56 34 12     cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%rax,%rcx,8)
        Decoded ok: 41 0f 1c 84 c8 78 56 34 12  cldemote 0x12345678(%r8,%rcx,8)
        $ perf test -v "new " 2>&1 | grep -i tpause
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 41 0f ae f0              tpause %r8d
        $ perf test -v "new " 2>&1 | grep -i umonitor
        Decoded ok: 67 f3 0f ae f0              umonitor %ax
        Decoded ok: f3 0f ae f0                 umonitor %eax
        Decoded ok: 67 f3 0f ae f0              umonitor %eax
        Decoded ok: f3 0f ae f0                 umonitor %rax
        Decoded ok: 67 f3 41 0f ae f0           umonitor %r8d
        $ perf test -v "new " 2>&1 | grep -i umwait
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 41 0f ae f0              umwait %r8d
        $ perf test -v "new " 2>&1 | grep -i movdiri
        Decoded ok: 0f 38 f9 03                 movdiri %eax,(%ebx)
        Decoded ok: 0f 38 f9 88 78 56 34 12     movdiri %ecx,0x12345678(%eax)
        Decoded ok: 48 0f 38 f9 03              movdiri %rax,(%rbx)
        Decoded ok: 48 0f 38 f9 88 78 56 34 12  movdiri %rcx,0x12345678(%rax)
        $ perf test -v "new " 2>&1 | grep -i movdir64b
        Decoded ok: 66 0f 38 f8 18              movdir64b (%eax),%ebx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%eax),%ecx
        Decoded ok: 67 66 0f 38 f8 1c           movdir64b (%si),%bx
        Decoded ok: 67 66 0f 38 f8 8c 34 12     movdir64b 0x1234(%si),%cx
        Decoded ok: 66 0f 38 f8 18              movdir64b (%rax),%rbx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%rax),%rcx
        Decoded ok: 67 66 0f 38 f8 18           movdir64b (%eax),%ebx
        Decoded ok: 67 66 0f 38 f8 88 78 56 34 12       movdir64b 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmd
        Decoded ok: f2 0f 38 f8 18              enqcmd (%eax),%ebx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%eax),%ecx
        Decoded ok: 67 f2 0f 38 f8 1c           enqcmd (%si),%bx
        Decoded ok: 67 f2 0f 38 f8 8c 34 12     enqcmd 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f2 0f 38 f8 18              enqcmd (%rax),%rbx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%rax),%rcx
        Decoded ok: 67 f2 0f 38 f8 18           enqcmd (%eax),%ebx
        Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12       enqcmd 0x12345678(%eax),%ecx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmds
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i encls
        Decoded ok: 0f 01 cf                    encls
        Decoded ok: 0f 01 cf                    encls
        $ perf test -v "new " 2>&1 | grep -i enclu
        Decoded ok: 0f 01 d7                    enclu
        Decoded ok: 0f 01 d7                    enclu
        $ perf test -v "new " 2>&1 | grep -i enclv
        Decoded ok: 0f 01 c0                    enclv
        Decoded ok: 0f 01 c0                    enclv
        $ perf test -v "new " 2>&1 | grep -i pconfig
        Decoded ok: 0f 01 c5                    pconfig
        Decoded ok: 0f 01 c5                    pconfig
        $ perf test -v "new " 2>&1 | grep -i wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20191115135447.6519-3-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b980be18
Loading