1. 03 9月, 2021 11 次提交
    • S
      perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event · 538d9c18
      Stephen Brennan 提交于
      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: NStephen 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      538d9c18
    • L
      perf build: Report failure for testing feature libopencsd · 71f7f897
      Leo Yan 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Tested-by: NArnaldo 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      71f7f897
    • J
      perf cs-etm: Show a warning for an unknown magic number · a80aea64
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      a80aea64
    • J
      perf cs-etm: Print the decoder name · 56c62f52
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NSuzuki Poulouse <suzuki.poulose@arm.com>
      Signed-off-by: NJames 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      56c62f52
    • J
      perf cs-etm: Create ETE decoder · 779f414a
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      779f414a
    • J
      perf cs-etm: Update OpenCSD decoder for ETE · 212095f7
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      212095f7
    • J
      perf cs-etm: Fix typo · 050a0fc4
      James Clark 提交于
      TRCIRD2 should be TRCIDR2
      Reviewed-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      050a0fc4
    • J
      perf cs-etm: Save TRCDEVARCH register · 51ba8811
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      51ba8811
    • J
      perf cs-etm: Refactor out ETMv4 header saving · c9ccc96b
      James Clark 提交于
      Extract a function for saving the ETMv4 header because this will be used
      for ETE in a later commit.
      Reviewed-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      c9ccc96b
    • J
      perf cs-etm: Initialise architecture based on TRCIDR1 · f4aef1ea
      James Clark 提交于
      Currently the architecture is hard coded as ARCH_V8, but from ETMv4.4
      onwards this should be ARCH_AA64.
      Reviewed-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      f4aef1ea
    • J
      perf cs-etm: Refactor initialisation of decoder params. · 991f69e9
      James Clark 提交于
      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: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Acked-by: NSuzuki 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      991f69e9
  2. 01 9月, 2021 25 次提交
  3. 31 8月, 2021 4 次提交