1. 27 Jan, 2024 2 commits
    • Ian Rogers's avatar
      perf vendor events intel: Alderlake/sapphirerapids metric fixes · becc24e9
      Ian Rogers authored
      As events are deduplicated by name, ensure PMU prefixes are always
      used in metrics. Previously they may be missed on the first event in a
      formula.
      
      Update metric constraints for architectures with topdown l2 events.
      
      Conversion script updated in:
      https://github.com/intel/perfmon/pull/128Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Closes: https://lore.kernel.org/lkml/ZZam-EG-UepcXtWw@kernel.org/
      Link: https://lore.kernel.org/r/20240104231903.775717-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      becc24e9
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync kvm headers with the kernel sources · e30dca91
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        a5d3df8a ("KVM: remove deprecated UAPIs")
        6d722835 ("KVM x86/xen: add an override for PVCLOCK_TSC_STABLE_BIT")
        89ea60c2 ("KVM: x86: Add support for "protected VMs" that can utilize private memory")
        8dd2eee9 ("KVM: x86/mmu: Handle page fault for private memory")
        a7800aa8 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory")
        5a475554 ("KVM: Introduce per-page memory attributes")
        16f95f3b ("KVM: Add KVM_EXIT_MEMORY_FAULT exit to report faults to userspace")
        bb58b90b ("KVM: Introduce KVM_SET_USER_MEMORY_REGION2")
        3f9cd0ca ("KVM: arm64: Allow userspace to get the writable masks for feature ID registers")
      
      That automatically adds support for some new ioctls and remove a bunch
      of deprecated ones.
      
      This ends up making the new binary to forget about the deprecated one,
      so when used in an older system it will not be able to resolve those
      codes to strings.
      
        $ tools/perf/trace/beauty/kvm_ioctl.sh > before
        $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
        $ tools/perf/trace/beauty/kvm_ioctl.sh > after
        $ diff -u before after
        --- before	2024-01-27 14:48:16.523014020 -0300
        +++ after	2024-01-27 14:48:24.183932866 -0300
        @@ -14,6 +14,7 @@
         	[0x46] = "SET_USER_MEMORY_REGION",
         	[0x47] = "SET_TSS_ADDR",
         	[0x48] = "SET_IDENTITY_MAP_ADDR",
        +	[0x49] = "SET_USER_MEMORY_REGION2",
         	[0x60] = "CREATE_IRQCHIP",
         	[0x61] = "IRQ_LINE",
         	[0x62] = "GET_IRQCHIP",
        @@ -22,14 +23,8 @@
         	[0x65] = "GET_PIT",
         	[0x66] = "SET_PIT",
         	[0x67] = "IRQ_LINE_STATUS",
        -	[0x69] = "ASSIGN_PCI_DEVICE",
         	[0x6a] = "SET_GSI_ROUTING",
        -	[0x70] = "ASSIGN_DEV_IRQ",
         	[0x71] = "REINJECT_CONTROL",
        -	[0x72] = "DEASSIGN_PCI_DEVICE",
        -	[0x73] = "ASSIGN_SET_MSIX_NR",
        -	[0x74] = "ASSIGN_SET_MSIX_ENTRY",
        -	[0x75] = "DEASSIGN_DEV_IRQ",
         	[0x76] = "IRQFD",
         	[0x77] = "CREATE_PIT2",
         	[0x78] = "SET_BOOT_CPU_ID",
        @@ -66,7 +61,6 @@
         	[0x9f] = "GET_VCPU_EVENTS",
         	[0xa0] = "SET_VCPU_EVENTS",
         	[0xa3] = "ENABLE_CAP",
        -	[0xa4] = "ASSIGN_SET_INTX_MASK",
         	[0xa5] = "SIGNAL_MSI",
         	[0xa6] = "GET_XCRS",
         	[0xa7] = "SET_XCRS",
        @@ -97,6 +91,8 @@
         	[0xcd] = "SET_SREGS2",
         	[0xce] = "GET_STATS_FD",
         	[0xd0] = "XEN_HVM_EVTCHN_SEND",
        +	[0xd2] = "SET_MEMORY_ATTRIBUTES",
        +	[0xd4] = "CREATE_GUEST_MEMFD",
         	[0xe0] = "CREATE_DEVICE",
         	[0xe1] = "SET_DEVICE_ATTR",
         	[0xe2] = "GET_DEVICE_ATTR",
        $
      
      This silences these perf build warnings:
      
        Warning: Kernel ABI header differences:
          diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/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: Chao Peng <chao.p.peng@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jing Zhang <jingzhangos@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oliver Upton <oliver.upton@linux.dev>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paul Durrant <pdurrant@amazon.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Link: https://lore.kernel.org/lkml/ZbVLbkngp4oq13qN@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e30dca91
  2. 26 Jan, 2024 13 commits
    • Sun Haiyong's avatar
      perf tools: Fix calloc() arguments to address error introduced in gcc-14 · 7bbe8f00
      Sun Haiyong authored
      the definition of calloc is as follows:
      
          void *calloc(size_t nmemb, size_t size);
      
      number of members is in the first parameter and the size is in the
      second parameter.
      
      Fix error messages on gcc 14 20240102:
      
        error: 'calloc' sizes specified with 'sizeof' in the earlier argument and
        not in the later argument [-Werror=calloc-transposed-args]
      
      Committer notes:
      
      I noticed this on fedora 40 and rawhide.
      Signed-off-by: default avatarSun Haiyong <sunhaiyong@loongson.cn>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240106094129.3337057-1-siyanteng@loongson.cnSigned-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7bbe8f00
    • Sun Haiyong's avatar
      perf top: Remove needless malloc(0) call that triggers -Walloc-size · 79baac8a
      Sun Haiyong authored
      GCC 14 introduces a new -Walloc-size included in -Wextra which errors out
      like:
      
        builtin-top.c: In function ‘prompt_integer’:
        builtin-top.c:360:21: error: allocation of insufficient size ‘0’ for
        type ‘char’ with size ‘1’ [-Werror=alloc-size]
          360 |         char *buf = malloc(0), *p;
              |                     ^~~~~~
      
      Just set it to NULL, getline() will do the allocation.
      Signed-off-by: default avatarSun Haiyong <sunhaiyong@loongson.cn>
      Signed-off-by: default avatarYanteng Si <siyanteng@loongson.cn>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20231204082055.91877-1-siyanteng@loongson.cnSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      79baac8a
    • Yicong Yang's avatar
      perf build: Make minimal shellcheck version to v0.6.0 · 39af6741
      Yicong Yang authored
      The perf build failed due to the shellcheck on my machine (v0.4.6 on Ubuntu
      18.04.1 LTS) doesn't support -a/--check-sourced and -S/--severity option.
      
      These two options are introduced in shellcheck v0.4.7 and v0.6.0
      respectively. So restrict the minimal version of shellcheck to v0.6.0.
      
      Fixes: b809fc65 ("perf build: Shellcheck support for OUTPUT directory")
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Junhao He <hejunhao3@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linuxarm@huawei.com
      Link: https://lore.kernel.org/r/20240122080406.28678-1-yangyicong@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      39af6741
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Update tools's copy of drm.h headers to pick DRM_IOCTL_MODE_CLOSEFB · 1233d1d5
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        8570c279 ("drm/syncobj: Add deadline support for syncobj waits")
        9724ed6c ("drm: Introduce DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT")
        e4d983ac ("drm: introduce DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP")
        d208d875 ("drm: introduce CLOSEFB IOCTL")
        afa5cf31 ("drm/i915/uapi: fix typos/spellos and punctuation")
      
      Addressing these perf build warnings:
      
        Warning: Kernel ABI header differences:
      
      Now 'perf trace' and other code that might use the
      tools/perf/trace/beauty autogenerated tables will be able to translate
      this new ioctl command into a string:
      
        $ tools/perf/trace/beauty/drm_ioctl.sh > before
        $ cp include/uapi/drm/drm.h tools/include/uapi/drm/drm.h
        $ tools/perf/trace/beauty/drm_ioctl.sh > after
        $ diff -u before after
        --- before	2024-01-26 10:54:23.486381862 -0300
        +++ after	2024-01-26 10:54:35.767902442 -0300
        @@ -109,6 +109,7 @@
         	[0xCD] = "SYNCOBJ_TIMELINE_SIGNAL",
         	[0xCE] = "MODE_GETFB2",
         	[0xCF] = "SYNCOBJ_EVENTFD",
        +	[0xD0] = "MODE_CLOSEFB",
         	[DRM_COMMAND_BASE + 0x00] = "I915_INIT",
         	[DRM_COMMAND_BASE + 0x01] = "I915_FLUSH",
         	[DRM_COMMAND_BASE + 0x02] = "I915_FLIP",
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Javier Martinez Canillas <javierm@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Rob Clark <robdclark@chromium.org>
      Cc: Simon Ser <contact@emersion.fr>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Zack Rusin <zack.rusin@broadcom.com>
      Link: https://lore.kernel.org/lkml/ZbPIN9Dcc5AM0uxo@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1233d1d5
    • Ian Rogers's avatar
      perf test shell daemon: Make signal test less racy · 9a8dd2f2
      Ian Rogers authored
      The daemon signal test sends signals and then expects files to be
      written. It was observed on an Intel Alderlake that the signals were
      sent too quickly leading to the 3 expected files not appearing.
      
      To avoid this send the next signal only after the expected previous file
      has appeared. To avoid an infinite loop the number of retries is
      limited.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Shirisha G <shirisha@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240124043015.1388867-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a8dd2f2
    • Ian Rogers's avatar
      perf test shell script: Fix test for python being disabled · 1c2124ec
      Ian Rogers authored
      "grep -cv" can exit with an error code that causes the "set -e" to abort
      the script. Switch to using the grep exit code in the if condition to
      avoid this.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Shirisha G <shirisha@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240124043015.1388867-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1c2124ec
    • Ian Rogers's avatar
      perf test: Workaround debug output in list test · a734c7f9
      Ian Rogers authored
      Write the JSON output to a specific file to avoid debug output
      breaking it.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Shirisha G <shirisha@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240124043015.1388867-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a734c7f9
    • Ian Rogers's avatar
      perf list: Add output file option · 79bacb6a
      Ian Rogers authored
      Add an option to write the 'perf list' output to a specific file. This
      can avoid issues with debug output being written into the output stream.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Shirisha G <shirisha@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240124043015.1388867-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      79bacb6a
    • Ian Rogers's avatar
      perf list: Switch error message to pr_err() to respect debug settings (-v) · 9d95c6be
      Ian Rogers authored
      Using printf() can interrupt 'perf list output', use pr_err() which can
      respect debug settings and the debug file.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Ross Zwisler <zwisler@chromium.org>
      Cc: Shirisha G <shirisha@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240124043015.1388867-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9d95c6be
    • Thomas Richter's avatar
      perf test: Fix 'perf script' tests on s390 · 2dac1f08
      Thomas Richter authored
      In linux next repo, test case 'perf script tests' fails on s390.
      
      The root case is a command line invocation of 'perf record' with
      call-graph information. On s390 only DWARF formatted call-graphs are
      supported and only on software events.
      
      Change the command line parameters for s390.
      
      Output before:
      
        # perf test 89
        89: perf script tests              : FAILED!
        #
      
      Output after:
      
        # perf test 89
        89: perf script tests              : Ok
        #
      
      Fixes: 0dd5041c ("perf addr_location: Add init/exit/copy functions")
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240125100351.936262-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2dac1f08
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/fcntl.h with the kernel sources · b0dc9921
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        8a924db2 ("fs: Pass AT_GETATTR_NOSEC flag to getattr interface function")
      
      That don't add anything that is handled by existing hard coded tables or
      table generation scripts.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header differences:
          diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stefan Berger <stefanb@linux.ibm.com>
      Link: https://lore.kernel.org/lkml/ZbJv9fGF_k2xXEdr@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b0dc9921
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources to pick... · 17437266
      Arnaldo Carvalho de Melo authored
      tools arch x86: Sync the msr-index.h copy with the kernel sources to pick IA32_MKTME_KEYID_PARTITIONING
      
      To pick up the changes in:
      
        765a0542 ("x86/virt/tdx: Detect TDX during kernel boot")
      
      Addressing this tools/perf build warning:
      
        Warning: Kernel ABI header differences:
          diff -u tools/arch/x86/include/asm/msr-index.h 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	2024-01-25 11:08:12.363223880 -0300
        +++ after	2024-01-25 11:08:24.839307699 -0300
        @@ -21,6 +21,7 @@
         	[0x0000004f] = "PPIN",
         	[0x00000060] = "LBR_CORE_TO",
         	[0x00000079] = "IA32_UCODE_WRITE",
        +	[0x00000087] = "IA32_MKTME_KEYID_PARTITIONING",
         	[0x0000008b] = "AMD64_PATCH_LEVEL",
         	[0x0000008C] = "IA32_SGXLEPUBKEYHASH0",
         	[0x0000008D] = "IA32_SGXLEPUBKEYHASH1",
        $
      
      Now one can trace systemwide asking to see backtraces to where that MSR
      is being read/written, see this example with a previous update:
      
        # perf trace -e msr:*_msr/max-stack=32/ --filter="msr==IA32_MKTME_KEYID_PARTITIONING"
        ^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==IA32_MKTME_KEYID_PARTITIONING"
        Using CPUID GenuineIntel-6-8E-A
        0x87
        New filter for msr:read_msr: (msr==0x87) && (common_pid != 58627 && common_pid != 3792)
        0x87
        New filter for msr:write_msr: (msr==0x87) && (common_pid != 58627 && common_pid != 3792)
        mmap size 528384B
        ^C#
      
      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: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kai Huang <kai.huang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZbJt27rjkQVU1YoP@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17437266
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Sync linux/stat.h with the kernel sources to pick STATX_MNT_ID_UNIQUE · 690811f0
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        98d2b430 ("add unique mount ID")
      
      That add STATX_MNT_ID_UNIQUE that was manually added to
      tools/perf/trace/beauty/statx.c, at some point this should move to the
      shell based automated way.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header differences:
          diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZbJq08s19890WDo-@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      690811f0
  3. 25 Jan, 2024 25 commits