Skip to content
  1. Sep 03, 2021
    • Jin Yao's avatar
      perf tests: Add test for PMU aliases · c7a3828d
      Jin Yao authored
      
      
      A perf uncore PMU may have two PMU names, a real name and an alias.
      
      Add one test case to verify that the real and alias names have the same
      effect.
      
      Iterate sysfs to get one event which has an alias and create an evlist
      by adding two evsels. Evsel1 is created by event and evsel2 is created
      by alias.
      
      Test asserts:
      
        evsel1->core.attr.type == evsel2->core.attr.type
        evsel1->core.attr.config == evsel2->core.attr.config
      
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Link: http://lore.kernel.org/lkml/20210902065955.1299-3-yao.jin@linux.intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c7a3828d
    • Kan Liang's avatar
      perf pmu: Add PMU alias support · 13d60ba0
      Kan Liang authored
      
      
      A perf uncore PMU may have two PMU names, a real name and an alias. The
      alias is exported at /sys/bus/event_source/devices/uncore_*/alias.
      The perf tool should support the alias as well.
      
      Add alias_name in the struct perf_pmu to store the alias. For the PMU
      which doesn't have an alias. It's NULL.
      
      Introduce two X86 specific functions to retrieve the real name and the
      alias separately.
      
      Only go through the sysfs to retrieve the mapping between the real name
      and the alias once. The result is cached in a list, uncore_pmu_list.
      
      Nothing changed for the other ARCHs.
      
      With the patch, the perf tool can monitor the PMU with either the real
      name or the alias.
      
      Use the real name,
       $ perf stat -e uncore_cha_2/event=1/ -x,
         4044879584,,uncore_cha_2/event=1/,2528059205,100.00,,
      
      Use the alias,
       $ perf stat -e uncore_type_0_2/event=1/ -x,
         3659675336,,uncore_type_0_2/event=1/,2287306455,100.00,,
      
      Committer notes:
      
      Rename 'struct perf_pmu_alias_name' to 'pmu_alias', the 'perf_' prefix
      should be used for libperf, things inside just tools/perf/ are being
      moved away from that prefix.
      
      Also 'pmu_alias' is shorter and reflects the abstraction.
      
      Also don't use 'pmu' as the name for variables for that type, we should
      use that for the 'struct perf_pmu' variables, avoiding confusion. Use
      'pmu_alias' for 'struct pmu_alias' variables.
      
      Co-developed-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Co-developed-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Link: http://lore.kernel.org/lkml/20210902065955.1299-2-yao.jin@linux.intel.com
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      13d60ba0
    • Suzuki K Poulose's avatar
      perf session: Report collisions in AUX records · c68b421d
      Suzuki K Poulose authored
      
      
      Just like the other flags in the AUX records, report a summary of the
      Collisions if there were any.
      
      Signed-off-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      LPU-Reference: 20210728091219.527886-1-suzuki.poulose@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c68b421d
    • Stephen Brennan's avatar
      perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event · 538d9c18
      Stephen Brennan authored
      
      
      perf_events may sometimes throttle an event due to creating too many
      samples during a given timer tick.
      
      As of now, the perf tool will not report on throttling, which means this
      is a silent error.
      
      Implement a callback for the throttle and unthrottle events within the
      Python scripting engine, which can allow scripts to detect and report
      when events may have been lost due to throttling.
      
      The simplest script to report throttle events is:
      
        def throttle(*args):
            print("throttle" + repr(args))
      
        def unthrottle(*args):
            print("unthrottle" + repr(args))
      
      Signed-off-by: default avatarStephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/20210901210815.133251-1-stephen.s.brennan@oracle.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      538d9c18
    • Leo Yan's avatar
      perf build: Report failure for testing feature libopencsd · 71f7f897
      Leo Yan authored
      
      
      When build perf tool with passing option 'CORESIGHT=1' explicitly, if
      the feature test fails for library libopencsd, the build doesn't
      complain the feature failure and continue to build the tool with
      disabling the CoreSight feature insteadly.
      
      This patch changes the building behaviour, when build perf tool with the
      option 'CORESIGHT=1' and detect the failure for testing feature
      libopencsd, the build process will be aborted and it shows the complaint
      info.
      
      Committer testing:
      
      First make sure there is no opencsd library installed:
      
        $ rpm -qa | grep -i csd
        $ sudo rm -rf `find /usr/local -name "*csd*"`
        $ find /usr/local -name "*csd*"
        $
      
      Then cleanup the perf build output directory:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
        $
      
      And try to build explicitely asking for coresight:
      
        $ make O=/tmp/build/perf CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j24' parallel build
          HOSTCC  /tmp/build/perf/fixdep.o
          HOSTLD  /tmp/build/perf/fixdep-in.o
          LINK    /tmp/build/perf/fixdep
        Makefile.config:493: *** Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1.  Stop.
        make[1]: *** [Makefile.perf:238: sub-make] Error 2
        make: *** [Makefile:113: install-bin] Error 2
        make: Leaving directory '/var/home/acme/git/perf/tools/perf'
        $
      
      Now install the opencsd library present in Fedora 34:
      
        $ sudo dnf install opencsd-devel
        <SNIP>
        Installed:
          opencsd-1.0.0-1.fc34.x86_64 opencsd-devel-1.0.0-1.fc34.x86_64
        Complete!
        $
      
      Try again building with coresight:
      
        $ make O=/tmp/build/perf CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j24' parallel build
        Makefile.config:493: *** Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1.  Stop.
        make[1]: *** [Makefile.perf:238: sub-make] Error 2
        make: *** [Makefile:113: install-bin] Error 2
        make: Leaving directory '/var/home/acme/git/perf/tools/perf'
        $
      
      Since Fedora 34 is pretty recent, one assumes we need to get it from its
      upstream git repository, use rpm to find where that is:
      
        $ rpm -q --qf "%{URL}\n" opencsd
        https://github.com/Linaro/OpenCSD
        $
      
      Go there, clone the repo, build it and install into /usr/local, then try
      again:
      
        $ cd ~acme/git/perf
        $ make O=/tmp/build/perf VF=1 CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin | grep -i opencsd
        ...                    libopencsd: [ on  ]
          PERF_VERSION = 5.14.g454719f67a3d
        $ export LD_LIBRARY_PATH=/usr/local/lib
        $ ldd ~/bin/perf | grep opencsd
        	libopencsd_c_api.so.1 => /usr/local/lib/libopencsd_c_api.so.1 (0x00007f28f78a4000)
        	libopencsd.so.1 => /usr/local/lib/libopencsd.so.1 (0x00007f28f6a2e000)
        $
      
      Now it works.
      
      Requested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.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: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: coresight@lists.linaro.org
      Link: http://lore.kernel.org/lkml/20210902081800.550016-1-leo.yan@linaro.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71f7f897
    • James Clark's avatar
      perf cs-etm: Show a warning for an unknown magic number · a80aea64
      James Clark authored
      
      
      Currently perf reports "Cannot allocate memory" which isn't very helpful
      for a potentially user facing issue. If we add a new magic number in
      the future, perf will be able to report unrecognised magic numbers.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-10-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a80aea64
    • James Clark's avatar
      perf cs-etm: Print the decoder name · 56c62f52
      James Clark authored
      
      
      Use the real name of the decoder instead of hard-coding "ETM" to avoid
      confusion when the trace is ETE. This also now distinguishes between
      ETMv3 and ETMv4.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Reviewed-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-9-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56c62f52
    • James Clark's avatar
      perf cs-etm: Create ETE decoder · 779f414a
      James Clark authored
      
      
      If the magic number indicates ETE instantiate a OCSD_BUILTIN_DCD_ETE
      decoder instead of OCSD_BUILTIN_DCD_ETMV4I. ETE is the new trace feature
      for Armv9.
      
      Testing performed
      =================
      
      * Old files with v0 and v1 headers for ETMv4 still open correctly
      * New files with new magic number open on new versions of perf
      * New files with new magic number fail to open on old versions of perf
      * Decoding with the ETE decoder results in the same output as the ETMv4
        decoder as long as there are no new ETE packet types
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-8-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      779f414a
    • James Clark's avatar
      perf cs-etm: Update OpenCSD decoder for ETE · 212095f7
      James Clark authored
      
      
      OpenCSD v1.1.1 has a bug fix for the installation of the ETE decoder
      headers. This also means that including headers separately for each
      decoder is unnecessary so remove these.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-7-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      212095f7
    • James Clark's avatar
      perf cs-etm: Fix typo · 050a0fc4
      James Clark authored
      
      
      TRCIRD2 should be TRCIDR2
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-6-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      050a0fc4
    • James Clark's avatar
      perf cs-etm: Save TRCDEVARCH register · 51ba8811
      James Clark authored
      
      
      When ETE is present save the TRCDEVARCH register and set a new magic
      number. It will be used to configure the decoder in a later commit.
      
      Old versions of perf will not be able to open files with this new magic
      number, but old files will still work with newer versions of perf.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-5-james.clark@arm.com
      [ Addressed some cosmetic suggestions by Suzuki Poulouse ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      51ba8811
    • James Clark's avatar
      perf cs-etm: Refactor out ETMv4 header saving · c9ccc96b
      James Clark authored
      
      
      Extract a function for saving the ETMv4 header because this will be used
      for ETE in a later commit.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-4-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9ccc96b
    • James Clark's avatar
      perf cs-etm: Initialise architecture based on TRCIDR1 · f4aef1ea
      James Clark authored
      
      
      Currently the architecture is hard coded as ARCH_V8, but from ETMv4.4
      onwards this should be ARCH_AA64.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-3-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f4aef1ea
    • James Clark's avatar
      perf cs-etm: Refactor initialisation of decoder params. · 991f69e9
      James Clark authored
      
      
      The initialisation of the decoder params is duplicated between
      creation of the packet printer and packet decoder. Put them both
      into one function so that future changes only need to be made in one
      place.
      
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-2-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      991f69e9
  2. Sep 01, 2021
    • James Clark's avatar
      tools build: Fix feature detect clean for out of source builds · 8af52e69
      James Clark authored
      Currently the clean target when using O= isn't cleaning the feature
      detect output. This is because O= and OUTPUT= are set to canonical
      paths. For example in tools/perf/Makefile:
      
        FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))
      
      This means that OUTPUT ends in a / and most usages prepend it to a file
      without adding an extra /. This line that was changed adds an extra /
      before the 'feature' folder but not to the end, resulting in a clean
      command like this:
      
        rm -f /tmp/build//featuretest-all.bin ...
      
      After the change the clean command looks like this:
      
        rm -f /tmp/build/feature/test-all.bin ...
      
      Fixes: 762323eb
      
       ("perf build: Move feature cleanup under tools/build")
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lore.kernel.org/lkml/20210816130705.1331868-1-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8af52e69
    • Riccardo Mancini's avatar
      perf evlist: Add evlist__for_each_entry_from() macro · 79e7ed56
      Riccardo Mancini authored
      
      
      This patch adds a new iteration macro for evlist that resumes iteration
      from a given evsel in the evlist.
      
      This macro will be used in the workqueue series.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/2386505f8b598adf0dbcd04ec21804c6bcf00826.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      79e7ed56
    • Riccardo Mancini's avatar
      perf evsel: Handle precise_ip fallback in evsel__open_cpu() · 28667a52
      Riccardo Mancini authored
      
      
      This is another patch in the effort to separate the fallback mechanisms
      from the open itself.
      
      In case of precise_ip fallback, the original precise_ip will be stored
      in the evsel (it was stored in a local variable) and the open will be
      retried. Since the precise_ip fallback will be the first in the chain of
      fallbacks, there should be no functional change with this patch.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/74208c433d2024a6c4af9c0b140b54ed6b5ea810.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      28667a52
    • Riccardo Mancini's avatar
      perf evsel: Move bpf_counter__install_pe() to success path in evsel__open_cpu() · 91233d00
      Riccardo Mancini authored
      
      
      I don't see why bpf_counter__install_pe() should get called even if
      fd = -1, so I'm moving it to the success path.
      
      This will be useful in following patches to separate the actual open and
      the related operations from the fallback mechanisms.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Link: http://lore.kernel.org/lkml/64f8a1b0a838a6e6049cd43c1beafd432999ae57.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      91233d00
    • Riccardo Mancini's avatar
      perf evsel: Move test_attr__open() to success path in evsel__open_cpu() · ebfb045a
      Riccardo Mancini authored
      
      
      test_attr__open() ignores the fd if -1, therefore it is safe to move it to
      the success path (fd >= 0).
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/b3baf11360ca96541c9631730614fd7d217496fc.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ebfb045a
    • Riccardo Mancini's avatar
      perf evsel: Move ignore_missing_thread() to fallback code · da7c3b46
      Riccardo Mancini authored
      
      
      This patch moves ignore_missing_thread outside the perf_event_open loop.
      
      Doing so, we need to move the retry_open flag a few places higher, with
      minimal impact. Furthermore, thread need not be decreased since it won't
      get increased by the for loop (since we're jumping back inside), but we
      need to check that the nthreads decrease didn't put thread out of range.
      
      The goal is to have fallbacks handled in one place only, since in the
      future parallel code, these would be handled separately.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/4eca51443c786baaf6811b7cd8e73aafd97f7606.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da7c3b46
    • Riccardo Mancini's avatar
      perf evsel: Separate rlimit increase from evsel__open_cpu() · 71efc48a
      Riccardo Mancini authored
      
      
      This is a preparatory patch for the workqueue patches with the goal to
      separate from evlist__open_cpu() the actual opening (which could be
      performed in parallel), from the existing fallback mechanisms, which
      should be handled sequentially.
      
      This patch separates the rlimit increase from evsel__open_cpu().
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/2f256de8ec37b9809a5cef73c2fa7bce416af5d3.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71efc48a
    • Riccardo Mancini's avatar
      perf evsel: Separate missing feature detection from evsel__open_cpu() · d21fc5f0
      Riccardo Mancini authored
      
      
      This is a preparatory patch for the workqueue patches with the goal to
      separate in evlist__open_cpu() the actual opening, which could be
      performed in parallel, from the existing fallback mechanisms, which
      should be handled sequentially.
      
      This patch separates the missing feature detection in evsel__open_cpu()
      into a new evsel__detect_missing_features() function.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/cba0b7d939862473662adeedb0f9c9b69566ee9a.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d21fc5f0
    • Riccardo Mancini's avatar
      perf evsel: Add evsel__prepare_open() · 6efd06e3
      Riccardo Mancini authored
      
      
      This function will prepare the evsel and disable the missing features.
      It will be used in one of the following patches.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/fa5e78bbb92c848226f044278fdcf777b3ce4583.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6efd06e3
    • Riccardo Mancini's avatar
      perf evsel: Separate missing feature disabling from evsel__open_cpu · 588f4ac7
      Riccardo Mancini authored
      
      
      This is a preparatory patch for the patches in the workqueue series with
      the goal to separate in evlist__open_cpu() the actual opening, which
      could be performed in parallel, from the existing fallback mechanisms,
      which should be handled sequentially.
      
      This patch separates the disabling of missing features from
      evlist__open_cpu() into a new function evsel__disable_missing_features(().
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/48138bd2932646dde315505da733c2ca635ad2ee.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      588f4ac7
    • Riccardo Mancini's avatar
      perf evsel: Save open flags in evsel in prepare_open() · 46def08f
      Riccardo Mancini authored
      
      
      This patch caches the flags used in perf_event_open() inside evsel, so
      that they can be set in __evsel__prepare_open() (this will be useful in
      patches in the workqueue series, when the fallback mechanisms will be
      handled outside the open itself).
      
      This also optimizes the code, by not having to recompute them everytime.
      
      Since flags are now saved in evsel, the flags argument in
      perf_event_open() is removed.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/d9f63159098e56fa518eecf25171d72e6f74df37.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      46def08f
    • Riccardo Mancini's avatar
      perf evsel: Separate open preparation from open itself · d45ce034
      Riccardo Mancini authored
      
      
      This is a preparatory patch for the following patches with the goal to
      separate in evlist__open_cpu the actual perf_event_open, which could be
      performed in parallel, from the existing fallback mechanisms, which
      should be handled sequentially.
      
      This patch separates the first lines of evsel__open_cpu into a new
      __evsel__prepare_open function.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/e14118b934c338dbbf68b8677f20d0d7dbf9359a.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d45ce034
    • Riccardo Mancini's avatar
      perf evsel: Remove retry_sample_id goto label · bc049604
      Riccardo Mancini authored
      
      
      As far as I can tell, there is no good reason, apart from optimization
      to have the retry_sample_id separate from fallback_missing_features.
      
      Probably, this label was added to avoid reapplying patches for missing
      features that had already been applied.
      
      However, missing features that have been added later have not used this
      optimization, always jumping to fallback_missing_features and reapplying
      all missing features.
      
      This patch removes that label, replacing it with
      fallback_missing_features.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/340af0d03408d6621fd9c742e311db18b3585b3b.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc049604
    • Riccardo Mancini's avatar
      perf mmap: Add missing bitops.h header · 5d4da30f
      Riccardo Mancini authored
      
      
      MMAP_CPU_MASK_BYTES uses the BITS_TO_LONGS macro, which is defined in
      linux/bitops.h.
      
      However, this header is not included directly, but gets imported
      indirectly in files using the macro.
      
      This patch adds the missing include.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/c5b91ee432a2e28e7f16337c740b43b4d0b0e86c.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d4da30f
    • Riccardo Mancini's avatar
      libperf cpumap: Take into advantage it is sorted to optimize perf_cpu_map__max() · 6e93bc53
      Riccardo Mancini authored
      From commit 7074674e
      
       ("perf cpumap: Maintain cpumaps ordered and
      without dups"), perf_cpu_map elements are sorted in ascending order.
      
      This patch improves the perf_cpu_map__max function by returning the last
      element.
      
      Committer notes:
      
      Do it as a ternary to keep it in just one return line, add a comment
      explaining it is sorted and what functions does it.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/fb79f02e7b86ea8044d563adb1e9890c906f982f.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6e93bc53
    • Riccardo Mancini's avatar
      libsubcmd: add OPT_UINTEGER_OPTARG option type · b75f299d
      Riccardo Mancini authored
      
      
      This patch adds OPT_UINTEGER_OPTARG, which is the same as OPT_UINTEGER,
      but also makes it possible to use the option without any value, setting
      the variable to a default value, d.
      
      Signed-off-by: default avatarRiccardo Mancini <rickyman7@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/c46749b3dff796729078352ff164d363457a3587.1629490974.git.rickyman7@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b75f299d
    • James Clark's avatar
      perf tools: Fix LLVM download hint link · 40a72c64
      James Clark authored
      
      
      http://llvm.org/apt returns 404, it has moved to https://apt.llvm.org/
      
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: clang-built-linux@googlegroups.com
      Link: http://lore.kernel.org/lkml/20210831145501.2135754-3-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      40a72c64
    • James Clark's avatar
      perf tools: Fix LLVM test failure when running in verbose mode · 792adb1a
      James Clark authored
      
      
      A CI system might want to run all tests in verbose mode so that there is
      enough information to diagnose issues. This LLVM test is the only test
      that uses "-v" to signify to not skip the test if the preconditions
      aren't met (LLVM isn't installed). This means that running the test in
      verbose mode without LLVM installed causes a test failure.
      
      For consistency with the other tests, remove this verbose/skip check. An
      alternate solution would be to make _all_ tests not skip when run in
      verbose mode, but I don't think that would be intuitive.
      
      Also change the search_program() call to search_program_and_warn().
      Previously the hint about installing LLVM was only printed by the actual
      test because this check was skipped in verbose mode. To maintain the old
      behaviour, the precondition check must also print the full warning.
      
      Previous output:
      
        $ ./perf test llvm
        40: LLVM search and compile                                     :
        40.1: Basic BPF llvm compile                                    : Skip
      
        $ ./perf test -v llvm
        40: LLVM search and compile                                     :
        40.1: Basic BPF llvm compile                                    :
        --- start ---
        test child forked, pid 2085835
        ERROR:	unable to find clang.
        Hint:	Try to install latest clang/llvm to support BPF. Check your $PATH
        ...
        test child finished with -1
        ---- end ----
        LLVM search and compile subtest 1: FAILED!
      
      New output (non verbose mode is identical, verbose changes from fail to
      skip):
      
        $ ./perf test llvm
        40: LLVM search and compile                                     :
        40.1: Basic BPF llvm compile                                    : Skip
      
        $ ./perf test -v llvm
        40: LLVM search and compile                                     :
        40.1: Basic BPF llvm compile                                    :
        --- start ---
        test child forked, pid 2087680
        ERROR:	unable to find clang.
        Hint:	Try to install latest clang/llvm to support BPF. Check your $PATH
        ...
        No clang, skip this test
        test child finished with -2
        ---- end ----
        LLVM search and compile subtest 1: Skip
      
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: clang-built-linux@googlegroups.com
      Link: http://lore.kernel.org/lkml/20210831145501.2135754-2-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      792adb1a
    • James Clark's avatar
      perf tools: Refactor LLVM test warning for missing binary · a8a2d5c0
      James Clark authored
      
      
      The same warning is duplicated in two places so refactor it into a
      single function "search_program_and_warn". This will be used a third
      time in a later commit.
      
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: clang-built-linux@googlegroups.com
      Link: http://lore.kernel.org/lkml/20210831145501.2135754-1-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a8a2d5c0
    • Leo Yan's avatar
      perf auxtrace arm: Support compat_auxtrace_mmap__{read_head|write_tail} · 474b3f28
      Leo Yan authored
      
      
      When the tool runs with compat mode on Arm platform, the kernel is in
      64-bit mode and user space is in 32-bit mode; the user space can use
      instructions "ldrd" and "strd" for 64-bit value atomicity.
      
      This patch adds compat_auxtrace_mmap__{read_head|write_tail} for arm
      building, it uses "ldrd" and "strd" instructions to ensure accessing
      atomicity for aux head and tail.  The file arch/arm/util/auxtrace.c is
      built for arm and arm64 building, these two functions are not needed for
      arm64, so check the compiler macro "__arm__" to only include them for
      arm building.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.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: "Russell King (oracle)" <linux@armlinux.org.uk>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20210829102238.19693-3-leo.yan@linaro.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      474b3f28
    • Leo Yan's avatar
      perf auxtrace: Add compat_auxtrace_mmap__{read_head|write_tail} · bbc49f12
      Leo Yan authored
      
      
      When perf runs in compat mode (kernel in 64-bit mode and the perf is in
      32-bit mode), the 64-bit value atomicity in the user space cannot be
      assured, E.g. on some architectures, the 64-bit value accessing is split
      into two instructions, one is for the low 32-bit word accessing and
      another is for the high 32-bit word.
      
      This patch introduces weak functions compat_auxtrace_mmap__read_head()
      and compat_auxtrace_mmap__write_tail(), as their naming indicates, when
      perf tool works in compat mode, it uses these two functions to access
      the AUX head and tail.  These two functions can allow the perf tool to
      work properly in certain conditions, e.g. when perf tool works in
      snapshot mode with only using AUX head pointer, or perf tool uses the
      AUX buffer and the incremented tail is not bigger than 4GB.
      
      When perf tool cannot handle the case when the AUX tail is bigger than
      4GB, the function compat_auxtrace_mmap__write_tail() returns -1 and
      tells the caller to bail out for the error.
      
      These two functions are declared as weak attribute, this allows to
      implement arch specific functions if any arch can support the 64-bit
      value atomicity in compat mode.
      
      Suggested-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.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: "Russell King (oracle)" <linux@armlinux.org.uk>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20210829102238.19693-2-leo.yan@linaro.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bbc49f12
    • Ian Rogers's avatar
      perf bpf: Fix memory leaks relating to BTF. · 298105b7
      Ian Rogers authored
      
      
      BTF needs to be freed with btf__free().
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210826184833.408563-1-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      298105b7
    • Joshua Martinez's avatar
      perf data: Correct -h output · 760f5e77
      Joshua Martinez authored
      
      
      There is currently only 1 'perf data' command, but supporting extra
      commands was breaking the help output. Simplify for now so that the help
      output is correct.
      
      Before:
      $ perf data -h
      
       Usage: perf data [<common options>] <command> [<options>]
      
      $ perf data
      Usage:
              perf data [<common options>] <command> [<options>]
      
              Available commands:
               convert        - converts data file between formats
      
      After:
      $ perf data
      
       Usage: perf data convert [<options>]
      
          -f, --force           don't complain, do it
          -i, --input <file>    input file name
          -v, --verbose         be more verbose
              --all             Convert all events
              --to-ctf ...      Convert to CTF format
              --to-json ...     Convert to JSON format
              --tod             Convert time to wall clock time
      
      $ perf data -h
      
       Usage: perf data convert [<options>]
      
          -f, --force           don't complain, do it
          -i, --input <file>    input file name
          -v, --verbose         be more verbose
              --all             Convert all events
              --to-ctf ...      Convert to CTF format
              --to-json ...     Convert to JSON format
              --tod             Convert time to wall clock time
      
      Signed-off-by: default avatarJoshua Martinez <joshuamart@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210824205829.52822-1-irogers@google.com
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      760f5e77
    • Colin Ian King's avatar
      perf header: Fix spelling mistake "cant'" -> "can't" · cb5a2ebb
      Colin Ian King authored
      
      
      There is a spelling mistake in a warning message. Fix it.
      
      Signed-off-by: default avatarColin King <colin.king@canonical.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-janitors@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20210826121801.13281-1-colin.king@canonical.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cb5a2ebb
    • Arnaldo Carvalho de Melo's avatar
      perf dlfilters: Fix build on environments with a --sysroot gcc arg · e807ffe6
      Arnaldo Carvalho de Melo authored
      
      
      Such as cross building on Android, so just add EXTRA_CFLAGS to the
      dlfilters rules as it is where --sysroot= has been specified.
      
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.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/YS1JwIMTNNWcbGdT@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e807ffe6
  3. Aug 31, 2021
    • Andreas Gerstmayr's avatar
      perf flamegraph: flamegraph.py script improvements · c611e4f2
      Andreas Gerstmayr authored
      
      
      * display perf.data header
      * display PIDs of user stacks
      * added option to change color scheme
      * default to blue/green color scheme to improve accessibility
      * correctly identify kernel stacks when kernel-debuginfo is installed
      
      Signed-off-by: default avatarAndreas Gerstmayr <agerstmayr@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      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/20210830164729.116049-1-agerstmayr@redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c611e4f2