Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 08, 2022
    • Anup Patel's avatar
      KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table · fac37253
      Anup Patel authored
      Supporting hardware updates of PTE A and D bits is optional for any
      RISC-V implementation so current software strategy is to always set
      these bits in both G-stage (hypervisor) and VS-stage (guest kernel).
      
      If PTE A and D bits are not set by software (hypervisor or guest)
      then RISC-V implementations not supporting hardware updates of these
      bits will cause traps even for perfectly valid PTEs.
      
      Based on above explanation, the VS-stage page table created by various
      KVM selftest applications is not correct because PTE A and D bits are
      not set. This patch fixes VS-stage page table programming of PTE A and
      D bits for KVM selftests.
      
      Fixes: 3e06cdf1
      
       ("KVM: selftests: Add initial support for RISC-V
      64-bit")
      Signed-off-by: default avatarAnup Patel <apatel@ventanamicro.com>
      Tested-by: default avatarMayuresh Chitale <mchitale@ventanamicro.com>
      Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
      fac37253
  2. Apr 07, 2022
  3. Apr 06, 2022
  4. Apr 01, 2022
    • Tanu M's avatar
      perf python: Convert tracepoint.py example to python3 · 7e2022af
      Tanu M authored
      
      Convert the tracepoint.py file to python3 as many of the files in
      tools/perf are already written in python3.
      
      Committer testing:
      
        # export PYTHONPATH=/tmp/build/perf/python/
        # python3 ~acme/git/perf/tools/perf/python/tracepoint.py | head
        time 67394457376909 prev_comm=swapper/12 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=gnome-terminal- next_pid=3313 next_prio=120
        time 67394457807669 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
        time 67394457811859 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
        time 67394457824929 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
        time 67394457831899 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
        time 67394457842299 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
        time 67394457844179 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
        time 67394457853879 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
        time 67394457856339 prev_comm=swapper/13 prev_pid=0 prev_prio=120 prev_state=0x0 ==> next_comm=python3 next_pid=1485930 next_prio=120
        time 67394457865659 prev_comm=python3 prev_pid=1485930 prev_prio=120 prev_state=0x1 ==> next_comm=swapper/13 next_pid=0 next_prio=120
        Traceback (most recent call last):
          File "/var/home/acme/git/perf/tools/perf/python/tracepoint.py", line 48, in <module>
            main()
          File "/var/home/acme/git/perf/tools/perf/python/tracepoint.py", line 37, in main
            print("time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
        BrokenPipeError: [Errno 32] Broken pipe
        #
      
      Signed-off-by: default avatarTanu M <tanu235m@gmail.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/linux-perf-users/CAPS78prawYzRZnyhWjgOnGw4EwoswNwztvfZFdCOPOydFzVwzQ@mail.gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e2022af
    • Haowen Bai's avatar
      perf evlist: Directly return instead of using local ret variable · f717d89a
      Haowen Bai authored
      
      Addresses this coccinelle warning:
      
        ./tools/perf/util/evlist.c:1333:5-8: Unneeded variable: "err". Return
        "- ENOMEM" on line 1358
      
      Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/1648432532-23151-1-git-send-email-baihaowen@meizu.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f717d89a
    • Ian Rogers's avatar
      perf cpumap: More cpu map reuse by merge. · da0bfb9f
      Ian Rogers authored
      
      perf_cpu_map__merge() will reuse one of its arguments if they are equal or
      the other argument is NULL.
      
      The arguments could be reused if it is known one set of values is a
      subset of the other.
      
      For example, a map of 0-1 and a map of just 0 when merged yields the map
      of 0-1.
      
      Currently a new map is created rather than adding a reference count to
      the original 0-1 map.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da0bfb9f
    • Ian Rogers's avatar
      perf cpumap: Add is_subset function · c3ad8d23
      Ian Rogers authored
      
      Returns true if the second argument is a subset of the first.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c3ad8d23
    • Ian Rogers's avatar
      perf evlist: Rename cpus to user_requested_cpus · 0df6ade7
      Ian Rogers authored
      
      evlist contains cpus and all_cpus. all_cpus is the union of the cpu maps
      of all evsels.
      
      For non-task targets, cpus is set to be cpus requested from the command
      line, defaulting to all online cpus if no cpus are specified.
      
      For an uncore event, all_cpus may be just CPU 0 or every online CPU.
      
      This causes all_cpus to have fewer values than the cpus variable which
      is confusing given the 'all' in the name.
      
      To try to make the behavior clearer, rename cpus to user_requested_cpus
      and add comments on the two struct variables.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0df6ade7
    • John Garry's avatar
      perf tools: Stop depending on .git files for building PERF-VERSION-FILE · d4ff9265
      John Garry authored
      This essentially reverts commit c72e3f04 ("tools/perf/build:
      Speed up git-version test on re-make") and commit 4e666cdb
      ("perf tools: Fix dependency for version file creation")
      
      In commit c72e3f04 ("tools/perf/build: Speed up git-version test
      on re-make"), a makefile dependency on .git/HEAD was added. The
      background is that running PERF-VERSION-FILE is relatively slow, and
      commands like "git describe" are particularly slow.
      
      In commit 4e666cdb ("perf tools: Fix dependency for version file
      creation"), an additional dependency on .git/ORIG_HEAD was added, as
      .git/HEAD may not change for "git reset --hard HEAD^" command. However,
      depending on whether we're on a branch or not, a "git cherry-pick" may
      not lead to the version being updated.
      
      As discussed with the git community in [0], using git internal files for
      dependencies is not reliable. Commit 4e666cdb also breaks some build
      scenarios [1].
      
      As mentioned, c72e3f04 ("tools/perf/build: Speed up git-version
      test on re-make") was added to speed up the build. However in commit
      7572733b ("perf tools: Fix version kernel tag") we removed the
      call to "git describe", so just revert Makefile.perf back to same as pre
      c72e3f04 ("tools/perf/build: Speed up git-version test on
      re-make") and the build should not be so slow, as below:
      
      Pre 7572733b:
      
        $> time util/PERF-VERSION-GEN
          PERF_VERSION = 5.17.rc8.g4e666cdb06ee
      
        real    0m0.110s
        user    0m0.091s
        sys     0m0.019s
      
      Post 7572733b:
      
        $> time util/PERF-VERSION-GEN
          PERF_VERSION = 5.17.rc8.g7572733b8499
      
        real    0m0.039s
        user    0m0.036s
        sys     0m0.007s
      
      [0] https://lore.kernel.org/git/87wngkpddp.fsf@igel.home/T/#m4a4dd6de52fdbe21179306cd57b3761eb07f45f8
      [1] https://lore.kernel.org/linux-perf-users/20220329093120.4173283-1-matthieu.baerts@tessares.net/T/#u
      
      Committer testing:
      
      After a fresh rebuild using 'make -C tools/perf O=/tmp/build/perf install-bin':
      
        $ perf -v
        perf version 5.17.g162f9db407b6
        $ git log --oneline -1
        162f9db407b6a6e5 (HEAD -> perf/core) perf tools: Stop depending on .git files for building PERF-VERSION-FILE
        $
      
      Now using a detached tarball, i.e. outside the kernel source tree:
      
        $ ls -la perf*tar
        ls: cannot access 'perf*tar': No such file or directory
        $ make perf-tar-src-pkg
          TAR
          PERF_VERSION = 5.17.g31d10b3ef133
        $ ls -la perf*tar
        -rw-r--r--. 1 acme acme 22241280 Mar 30 13:26 perf-5.17.0.tar
        $ mv perf-5.17.0.tar /tmp
        $ cd /tmp
        $ tar xf perf-5.17.0.tar
        $ cd perf-5.17.0/
        $ make -C tools/perf |& tail
          CC      util/pmu.o
          CC      util/pmu-flex.o
          CC      util/expr-flex.o
          CC      util/expr.o
          LD      util/scripting-engines/perf-in.o
          LD      util/intel-pt-decoder/perf-in.o
          LD      util/perf-in.o
          LD      perf-in.o
          LINK    perf
        make: Leaving directory '/tmp/perf-5.17.0/tools/perf'
        $ tools/perf/perf -v
        perf version 5.17.g31d10b3ef133
        $ pwd
        /tmp/perf-5.17.0
        $ cat PERF-VERSION-FILE
        #define PERF_VERSION "5.17.g31d10b3ef133"
        $
      
      Fixes: 4e666cdb
      
       ("perf tools: Fix dependency for version file creation")
      Reported-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      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: John Garry <john.garry@huawei.com>
      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/1648635774-14581-1-git-send-email-john.garry@huawei.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d4ff9265
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 5ced8124
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        991625f3 ("x86/ibt: Add IBT feature, MSR and #CP handling")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses 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: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/lkml/YkSCx2kr4ambH+Qe@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ced8124
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · f444b2d1
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        caa574ff ("drm/i915/uapi: document behaviour for DG2 64K support")
      
      That don't add any new ioctl, so no changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Link: http://lore.kernel.org/lkml/YkSChHqaOApscFQ0@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f444b2d1
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 7ceda0cf
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        6d849191 ("KVM: x86: Introduce KVM_CAP_DISABLE_QUIRKS2")
        ef11c946 ("KVM: s390: Add vm IOCTL for key checked guest absolute memory access")
        e9e9feeb ("KVM: s390: Add optional storage key checking to MEMOP IOCTL")
      
      That just rebuilds perf, as these patches don't add any new KVM ioctl to
      be harvested for the the 'perf trace' ioctl syscall argument
      beautifiers.
      
      This is also by now used by tools/testing/selftests/kvm/, a simple test
      build succeeded.
      
      This silences this 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
      
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/YkSCOWHQdir1lhdJ@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ceda0cf
    • Arnaldo Carvalho de Melo's avatar
      tools kvm headers arm64: Update KVM headers from the kernel sources · 8db38afd
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        34739fd9 ("KVM: arm64: Indicate SYSTEM_RESET2 in kvm_run::system_event flags field")
        583cda1b ("KVM: arm64: Refuse to run VCPU if the PMU doesn't match the physical CPU")
      
      That don't causes any changes in tooling (when built on x86), only
      addresses this perf build warning:
      
        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: Marc Zyngier <maz@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Alexandru Elisei <alexandru.elisei@arm.com>
      Link: https://lore.kernel.org/lkml/YkSB4Q7kWmnaqeZU@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8db38afd
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 672b259f
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        991625f3 ("x86/ibt: Add IBT feature, MSR and #CP handling")
      
      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-03-29 16:23:07.678740040 -0300
        +++ after	2022-03-29 16:23:16.960978524 -0300
        @@ -220,6 +220,13 @@
         	[0x00000669] = "MC6_DEMOTION_POLICY_CONFIG",
         	[0x00000680] = "LBR_NHM_FROM",
         	[0x00000690] = "CORE_PERF_LIMIT_REASONS",
        +	[0x000006a0] = "IA32_U_CET",
        +	[0x000006a2] = "IA32_S_CET",
        +	[0x000006a4] = "IA32_PL0_SSP",
        +	[0x000006a5] = "IA32_PL1_SSP",
        +	[0x000006a6] = "IA32_PL2_SSP",
        +	[0x000006a7] = "IA32_PL3_SSP",
        +	[0x000006a8] = "IA32_INT_SSP_TAB",
         	[0x000006B0] = "GFX_PERF_LIMIT_REASONS",
         	[0x000006B1] = "RING_PERF_LIMIT_REASONS",
         	[0x000006c0] = "LBR_NHM_TO",
        $
      
      And this gets rebuilt:
      
        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
        CC      /tmp/build/perf/util/amd-sample-raw.o
        LD      /tmp/build/perf/util/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>=IA32_U_CET && msr<=IA32_INT_SSP_TAB"
        ^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_U_CET && msr<=IA32_INT_SSP_TAB"
        Using CPUID AuthenticAMD-25-21-0
        0x6a0
        0x6a8
        New filter for msr:read_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        0x6a0
        0x6a8
        New filter for msr:write_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        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: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/YkNd7Ky+vi7H2Zl2@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      672b259f
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync asm-generic/mman-common.h with the kernel · 6d05e139
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        9457056a ("mm: madvise: MADV_DONTNEED_LOCKED")
      
      That result in these changes in the tools:
      
        $ diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
        --- tools/include/uapi/asm-generic/mman-common.h	2022-03-29 16:17:50.461694991 -0300
        +++ include/uapi/asm-generic/mman-common.h	2022-03-27 19:12:48.923250468 -0300
        @@ -75,6 +75,8 @@
         #define MADV_POPULATE_READ	22	/* populate (prefault) page tables readable */
         #define MADV_POPULATE_WRITE	23	/* populate (prefault) page tables writable */
      
        +#define MADV_DONTNEED_LOCKED	24	/* like DONTNEED, but drop locked pages too */
        +
         /* compatibility flags */
         #define MAP_FILE	0
      
        $ tools/perf/trace/beauty/madvise_behavior.sh > before
        $ cp include/uapi/asm-generic/mman-common.h tools/include/uapi/asm-generic/mman-common.h
        $ tools/perf/trace/beauty/madvise_behavior.sh > after
        $ diff -u before after
        --- before	2022-03-29 16:18:04.091044244 -0300
        +++ after	2022-03-29 16:18:11.692238906 -0300
        @@ -20,6 +20,7 @@
         	[21] = "PAGEOUT",
         	[22] = "POPULATE_READ",
         	[23] = "POPULATE_WRITE",
        +	[24] = "DONTNEED_LOCKED",
         	[100] = "HWPOISON",
         	[101] = "SOFT_OFFLINE",
         };
        $
      
      I.e. now when madvise gets those behaviours as args, 'perf trace' will
      be able to translate from the number to a human readable string and to
      use the strings in tracepoint filter expressions.
      
      This addresses the following perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h'
        diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkNcUfeh795yqGMV@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d05e139
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Update copy of linux/socket.h with the kernel sources · 9a195da4
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        a6a6fe27 ("net/smc: Dynamic control handshake limitation by socket options")
      
      This automagically adds support for the SOL_MNC socket level:
      
        $ diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
        --- tools/perf/trace/beauty/include/linux/socket.h	2022-03-14 17:55:22.277148656 -0300
        +++ include/linux/socket.h	2022-03-27 19:12:48.908250063 -0300
        @@ -366,6 +366,7 @@
         #define SOL_XDP		283
         #define SOL_MPTCP	284
         #define SOL_MCTP	285
        +#define SOL_SMC		286
      
         /* IPX options */
         #define IPX_TYPE	1
        $ tools/perf/trace/beauty/socket.sh > before
        $ cp include/linux/socket.h tools/perf/trace/beauty/include/linux/socket.h
        $ tools/perf/trace/beauty/socket.sh > after
        $ diff -u before after
        --- before	2022-03-29 11:47:56.390258780 -0300
        +++ after	2022-03-29 11:48:03.158436189 -0300
        @@ -67,6 +67,7 @@
         	[283] = "XDP",
         	[284] = "MPTCP",
         	[285] = "MCTP",
        +	[286] = "SMC",
         };
      
         DEFINE_STRARRAY(socket_level, "SOL_");
        $
      
      This will allow 'perf trace' to translate 286 into "SMC" as is done with
      the other socket levels:
      
        # perf trace -e setsockopt --max-events 4
         344.916 ( 0.003 ms): Socket Thread/3816 setsockopt(fd: 168, level: TCP, optname: 5, optval: 0x7f5797b9c4f8, optlen: 4) = 0
         344.920 ( 0.002 ms): Socket Thread/3816 setsockopt(fd: 168, level: TCP, optname: 6, optval: 0x7f5797b9c4f4, optlen: 4) = 0
        1246.974 ( 0.010 ms): systemd-resolv/1128 setsockopt(fd: 22, level: IP, optname: 11, optval: 0x7ffc96cd7244, optlen: 4) = 0
        1246.986 ( 0.002 ms): systemd-resolv/1128 setsockopt(fd: 22, level: IP, optname: 8, optval: 0x7ffc96cd7264, optlen: 4) = 0
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/trace/beauty/include/linux/socket.h' differs from latest version at 'include/linux/socket.h'
        diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: D. Wythe <alibuda@linux.alibaba.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkMdpzzjPu5VZtW3@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a195da4
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Update copy of libbpf's hashmap.c · 4d4d00dd
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        fba60b17 ("libbpf: Use IS_ERR_OR_NULL() in hashmap__free()")
      
      That don't entail any changes in tools/perf.
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
        diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
      
      Not a kernel ABI, its just that this uses the mechanism in place for
      checking kernel ABI files drift.
      
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mauricio Vásquez <mauricio@kinvolk.io>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkMb2SAIai2VeuUD@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4d4d00dd
    • Ian Rogers's avatar
      perf stat: Avoid SEGV if core.cpus isn't set · 8a96f454
      Ian Rogers authored
      
      Passing NULL to perf_cpu_map__max doesn't make sense as there is no
      valid max. Avoid this problem by null checking in
      perf_stat_init_aggr_mode.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328062414.1893550-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a96f454
    • Yinan Zhang's avatar
      tools/vm/page_owner_sort.c: remove -c option · d8b7b3fa
      Yinan Zhang authored
      The -c option is used to cull by stacktrace.  Now, --cull option has
      been Added in page_owner_sort.c.  Culling by stacktrace is one of the
      function of "--cull".  No need to set an extra parameter.  So remove -c
      option.
      
      Remove parsing of -c when parse parameter and remove "-c" from usage.
      
      This work is coauthored by
              Shenghong Han
              Yixuan Cao
              Chongxi Zhao
              Jiajian Ye
              Yuhong Feng
              Yongqiang Liu
      
      Link: https://lkml.kernel.org/r/20220326085920.1470081-1-zhangyinan2019@email.szu.edu.cn
      
      
      Signed-off-by: default avatarYinan Zhang <zhangyinan2019@email.szu.edu.cn>
      Cc: Chongxi Zhao <zhaochongxi2019@email.szu.edu.cn>
      Cc: Georgi Djakov <georgi.djakov@linaro.org>
      Cc: Jiajian Ye <yejiajian2018@email.szu.edu.cn>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Sean Anderson <seanga2@gmail.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Tang Bin <tangbin@cmss.chinamobile.com>
      Cc: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
      Cc: Yongqiang Liu <liuyongqiang13@huawei.com>
      Cc: Yuhong Feng <yuhongf@szu.edu.cn>
      Cc: Zhenliang Wei <weizhenliang@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8b7b3fa
  5. Mar 30, 2022
    • Nathan Chancellor's avatar
      kbuild: Make $(LLVM) more flexible · e9c28192
      Nathan Chancellor authored
      The LLVM make variable allows a developer to quickly switch between the
      GNU and LLVM tools. However, it does not handle versioned binaries, such
      as the ones shipped by Debian, as LLVM=1 just defines the tool variables
      with the unversioned binaries.
      
      There was some discussion during the review of the patch that introduces
      LLVM=1 around versioned binaries, ultimately coming to the conclusion
      that developers can just add the folder that contains the unversioned
      binaries to their PATH, as Debian's versioned suffixed binaries are
      really just symlinks to the unversioned binaries in /usr/lib/llvm-#/bin:
      
      $ realpath /usr/bin/clang-14
      /usr/lib/llvm-14/bin/clang
      
      $ PATH=/usr/lib/llvm-14/bin:$PATH make ... LLVM=1
      
      However, that can be cumbersome to developers who are constantly testing
      series with different toolchains and versions. It is simple enough to
      support these versioned binaries directly in the Kbuild system by
      allowing the developer to specify the version suffix with LLVM=, which
      is shorter than the above suggestion:
      
      $ make ... LLVM=-14
      
      It does not change the meaning of LLVM=1 (which will continue to use
      unversioned binaries) and it does not add too much additional complexity
      to the existing $(LLVM) code, while allowing developers to quickly test
      their series with different versions of the whole LLVM suite of tools.
      
      Some developers may build LLVM from source but not add the binaries to
      their PATH, as they may not want to use that toolchain systemwide.
      Support those developers by allowing them to supply the directory that
      the LLVM tools are available in, as it is no more complex to support
      than the version suffix change above.
      
      $ make ... LLVM=/path/to/llvm/
      
      Update and reorder the documentation to reflect these new additions.
      At the same time, notate that LLVM=0 is not the same as just omitting it
      altogether, which has confused people in the past.
      
      Link: https://lore.kernel.org/r/20200317215515.226917-1-ndesaulniers@google.com/
      Link: https://lore.kernel.org/r/20220224151322.072632223@infradead.org/
      
      
      Suggested-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e9c28192
    • Jason A. Donenfeld's avatar
      wireguard: selftests: simplify RNG seeding · ca93ca23
      Jason A. Donenfeld authored
      
      The seed_rng() function was written to work across lots of old kernels,
      back when WireGuard used a big compatibility layer. Now that things have
      evolved, we can vastly simplify this, by just marking the RNG as seeded.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ca93ca23
  6. Mar 28, 2022
  7. Mar 26, 2022
    • Jakub Kicinski's avatar
      selftests: tls: skip cmsg_to_pipe tests with TLS=n · 5c7e49be
      Jakub Kicinski authored
      
      These are negative tests, testing TLS code rejects certain
      operations. They won't pass without TLS enabled, pure TCP
      accepts those operations.
      
      Reported-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Fixes: d87d67fd
      
       ("selftests: tls: test splicing cmsgs")
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c7e49be
    • Kim Phillips's avatar
      perf evsel: Improve AMD IBS (Instruction-Based Sampling) error handling messages · ab0809af
      Kim Phillips authored
      
      Improve the error message returned on failed perf_event_open() on AMD
      systems when using IBS (Instruction-Based Sampling).
      
      Output of executing 'perf record -e ibs_op// true' as a non root user
      BEFORE this patch (perf will add the 'u' modifier at the end to exclude
      kernel/hypervisor sampling):
      
        The sys_perf_event_open() syscall returned with 22 (Invalid argument)for event (ibs_op//u).
        /bin/dmesg | grep -i perf may provide additional information.
      
      Output after:
      
        AMD IBS can't exclude kernel events.  Try running at a higher privilege level.
      
      Output of executing 'sudo perf record -e ibs_op// true' BEFORE this patch:
      
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (ibs_op//).
        /bin/dmesg | grep -i perf may provide additional information.
      
      Output after:
      
        Error:
        Invalid event (ibs_op//) in per-thread mode, enable system wide with '-a'.
      
      Folowing the suggestion:
      
        $ sudo perf record -a -e ibs_op// true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.664 MB perf.data (194 samples) ]
        $
      
      Signed-off-by: default avatarKim Phillips <kim.phillips@amd.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: João Martins <joao.m.martins@oracle.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20220322221517.2510440-12-eranian@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ab0809af
    • Arnaldo Carvalho de Melo's avatar
      perf python: Add perf_env stubs that will be needed in evsel__open_strerror() · b58230de
      Arnaldo Carvalho de Melo authored
      
      The AMD IBS error message enhancements will use these, but we're not
      using evsel__open_strerror() in the python binding so far.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b58230de
    • Wei Li's avatar
      perf tools: Enhance the matching of sub-commands abbreviations · ae0f4eb3
      Wei Li authored
      
      We support short command 'rec*' for 'record' and 'rep*' for 'report' in
      lots of sub-commands, but the matching is not quite strict currnetly.
      
      It may be puzzling sometime, like we mis-type a 'recport' to report but
      it will perform 'record' in fact without any message.
      
      To fix this, add a check to ensure that the short cmd is valid prefix
      of the real command.
      
      Committer testing:
      
        [root@quaco ~]# perf c2c re sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c rec sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ]
        # perf c2c recport sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ]
        # perf c2c records sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        #
      
      Signed-off-by: default avatarWei Li <liwei391@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rui Xiang <rui.xiang@huawei.com>
      Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ae0f4eb3
    • Shunsuke Nakamura's avatar
      libperf tests: Fix typo in perf_evlist__open() failure error messages · c2eeac98
      Shunsuke Nakamura authored
      This patch corrects typos in error messages. I should be "evlist", not
      "evsel" as the function that fails is perf_evlist__open().
      
      Fixes: 3ce311af ("libperf: Move to tools/lib/perf")
      Fixes: a7f3713f
      
       ("libperf tests: Add test_stat_multiplexing test")
      Signed-off-by: default avatarShunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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: http://lore.kernel.org/lkml/20220325043829.224045-2-nakamura.shun@fujitsu.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c2eeac98
    • Ali Saidi's avatar
      tools arm64: Import cputype.h · 1314376d
      Ali Saidi authored
      
      Bring-in the kernel's arch/arm64/include/asm/cputype.h into tools/
      for arm64 to make use of all the core-type definitions in perf.
      
      Replace sysreg.h with the version already imported into tools/.
      
      Committer notes:
      
      Added an entry to tools/perf/check-headers.sh, so that we get notified
      when the original file in the kernel sources gets modified.
      
      Tester notes:
      
      LGTM. I did the testing on both my x86 and Arm64 platforms, thanks for
      the fixing up.
      
      Signed-off-by: default avatarAli Saidi <alisaidi@amazon.com>
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Li Huafei <lihuafei1@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick.Forrington@arm.com
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20220324183323.31414-2-alisaidi@amazon.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1314376d
  8. Mar 25, 2022
    • Ido Schimmel's avatar
      selftests: test_vxlan_under_vrf: Fix broken test case · b50d3b46
      Ido Schimmel authored
      The purpose of the last test case is to test VXLAN encapsulation and
      decapsulation when the underlay lookup takes place in a non-default VRF.
      This is achieved by enslaving the physical device of the tunnel to a
      VRF.
      
      The binding of the VXLAN UDP socket to the VRF happens when the VXLAN
      device itself is opened, not when its physical device is opened. This
      was also mentioned in the cited commit ("tests that moving the underlay
      from a VRF to another works when down/up the VXLAN interface"), but the
      test did something else.
      
      Fix it by reopening the VXLAN device instead of its physical device.
      
      Before:
      
       # ./test_vxlan_under_vrf.sh
       Checking HV connectivity                                           [ OK ]
       Check VM connectivity through VXLAN (underlay in the default VRF)  [ OK ]
       Check VM connectivity through VXLAN (underlay in a VRF)            [FAIL]
      
      After:
      
       # ./test_vxlan_under_vrf.sh
       Checking HV connectivity                                           [ OK ]
       Check VM connectivity through VXLAN (underlay in the default VRF)  [ OK ]
       Check VM connectivity through VXLAN (underlay in a VRF)            [ OK ]
      
      Fixes: 03f1c26b
      
       ("test/net: Add script for VXLAN underlay in a VRF")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220324200514.1638326-1-idosch@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b50d3b46
    • Namhyung Kim's avatar
      perf lock: Add -F/--field option to control output · 4bd9cab5
      Namhyung Kim authored
      
      The -F/--field option is to customize the list of fields to output:
      
        $ perf lock report -F contended,wait_max -k avg_wait
                        Name  contended   max wait (ns)   avg wait (ns)
      
              slock-AF_INET6          1           23543           23543
           &lruvec->lru_lock          5           18317           11254
              slock-AF_INET6          1           10379           10379
                  rcu_node_1          1            2104            2104
         &dentry->d_lockr...          1            1844            1844
         &dentry->d_lockr...          1            1672            1672
            &newf->file_lock         15            2279            1025
         &dentry->d_lockr...          1             792             792
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220323230259.288494-3-namhyung@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4bd9cab5