1. 11 9月, 2021 2 次提交
    • K
      perf report: Add support to print a textual representation of IBS raw sample data · 291dcb98
      Kim Phillips 提交于
      Perf records IBS (Instruction Based Sampling) extra sample data when
      'perf record --raw-samples' is used with an IBS-compatible event, on a
      machine that supports IBS.  IBS support is indicated in
      CPUID_Fn80000001_ECX bit #10.
      
      Up until now, users have been able to see the extra sample data solely
      in raw hex format using 'perf report --dump-raw-trace'.  From there,
      users could decode the data either manually, or by using an external
      script.
      
      Enable the built-in 'perf report --dump-raw-trace' to do the decoding of
      the extra sample data bits, so manual or external script decoding isn't
      necessary.
      
      Example usage:
      
        $ sudo perf record -c 10000001 -a --raw-samples -e ibs_fetch/rand_en=1/,ibs_op/cnt_ctl=1/ -C 0,1 taskset -c 0,1 7za b -mmt2 | perf report --dump-raw-trace
      
      Stdout contains IBS Fetch samples, e.g.:
      
        ibs_fetch_ctl:	02170007ffffffff MaxCnt 1048560 Cnt 1048560 Lat     7 En 1 Val 1 Comp 1 IcMiss 0 PhyAddrValid 1 L1TlbPgSz 4KB L1TlbMiss 0 L2TlbMiss 0 RandEn 1 L2Miss 0
        IbsFetchLinAd:	000056016b2ead40
        IbsFetchPhysAd:	000000115cedfd40
        c_ibs_ext_ctl:	0000000000000000 IbsItlbRefillLat   0
      
      ..and IBS Op samples, e.g.:
      
        ibs_op_ctl:	0000009e009e8968 MaxCnt  10000000 En 1 Val 1 CntCtl 1=uOps CurCnt       158
        IbsOpRip:	000056016b2ea73d
        ibs_op_data:	00000000000b0002 CompToRetCtr     2 TagToRetCtr    11 BrnRet 0  RipInvalid 0 BrnFuse 0 Microcode 0
        ibs_op_data2:	0000000000000002 CacheHitSt 0=M-state RmtNode 0 DataSrc 2=Local node cache
        ibs_op_data3:	0000000000c60002 LdOp 0 StOp 1 DcL1TlbMiss 0 DcL2TlbMiss 0 DcL1TlbHit2M 0 DcL1TlbHit1G 0 DcL2TlbHit2M 0 DcMiss 0 DcMisAcc 0 DcWcMemAcc 0 DcUcMemAcc 0 DcLockedOp 0 DcMissNoMabAlloc 0 DcLinAddrValid 1 DcPhyAddrValid 1 DcL2TlbHit1G 0 L2Miss 0 SwPf 0 OpMemWidth  4 bytes OpDcMissOpenMemReqs  0 DcMissLat     0 TlbRefillLat     0
        IbsDCLinAd:	00007f133c319ce0
        IbsDCPhysAd:	0000000270485ce0
      
      Committer notes:
      
      Fixed up this:
      
        util/amd-sample-raw.c: In function ‘evlist__amd_sample_raw’:
        util/amd-sample-raw.c:125:42: error: ‘ bytes’ directive output may be truncated writing 6 bytes into a region of size between 4 and 7 [-Werror=format-truncation=]
          125 |                          " OpMemWidth %2d bytes", 1 << (reg.op_mem_width - 1));
              |                                          ^~~~~~
        In file included from /usr/include/stdio.h:866,
                         from util/amd-sample-raw.c:7:
        /usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 21 and 24 bytes into a destination of size 21
           71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
              |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           72 |                                    __glibc_objsize (__s), __fmt,
              |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           73 |                                    __va_arg_pack ());
              |                                    ~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      As that %2d won't limit the number of chars to 2, just state that 2 is
      the minimal width:
      
        $ cat printf.c
        #include <stdio.h>
        #include <stdlib.h>
      
        int main(int argc, char *argv[])
        {
        	char bf[64];
        	int len = snprintf(bf, sizeof(bf), "%2d", atoi(argv[1]));
      
        	printf("strlen(%s): %u\n", bf, len);
      
        	return 0;
        }
        $ ./printf 1
        strlen( 1): 2
        $ ./printf 12
        strlen(12): 2
        $ ./printf 123
        strlen(123): 3
        $ ./printf 1234
        strlen(1234): 4
        $ ./printf 12345
        strlen(12345): 5
        $ ./printf 123456
        strlen(123456): 6
        $
      
      And since we probably don't want that output to be truncated, just
      assume the worst case, as the compiler did, and add a few more chars to
      that buffer.
      
      Also use sizeof(var) instead of sizeof(dup-of-wanted-format-string) to
      avoid bugs when changing one but not the other.
      
      I also had to change this:
      
        -#include <asm/amd-ibs.h>
        +#include "../../arch/x86/include/asm/amd-ibs.h"
      
      To make it build on other architectures, just like intel-pt does.
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joao 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: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https //lore.kernel.org/r/20210817221509.88391-4-kim.phillips@amd.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      291dcb98
    • K
      perf report: Add tools/arch/x86/include/asm/amd-ibs.h · dde994dd
      Kim Phillips 提交于
      This is a tools/-side patch for the patch that adds the original copy
      of the IBS header file, in arch/x86/include/asm/.
      
      We also add an entry to check-headers.sh, so future changes continue
      to be copied.
      
      Committer notes:
      
      Had to add this
      
        -#include <asm/msr-index.h>
        +#include "msr-index.h"
      
      And change the check-headers.sh entry to ignore this line when diffing
      with the original kernel header.
      
      This is needed so that we can use 'perf report' on a perf.data with IBS
      data on a !x86 system, i.e. building on ARM fails without this as there
      is no asm/msr-index.h there.
      
      This was done on the next patch in this series and is done for things
      like Intel PT and ARM CoreSight.
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joao 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: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https //lore.kernel.org/r/20210817221509.88391-3-kim.phillips@amd.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dde994dd
  2. 10 9月, 2021 6 次提交
    • K
      perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings · 9fe8895a
      Kim Phillips 提交于
      To be used by IBS raw data display: It needs the recorder's cpuid in
      order to determine which errata workarounds to apply to the data, and
      the pmu_mappings are needed in order to figure out which PMU sample
      type is IBS Fetch vs. IBS Op.
      
      When not available from perf.data, we assume local operation, and
      retrieve cpuid and pmu mappings directly from the running system.
      Signed-off-by: NKim Phillips <kim.phillips@amd.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joao 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: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https //lore.kernel.org/r/20210817221509.88391-2-kim.phillips@amd.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9fe8895a
    • R
      perf symbol: Look for ImageBase in PE file to compute .text offset · d2930ede
      Remi Bernon 提交于
      Instead of using the file offset in the debug file.
      
      This fixes a regression from 00a34234 ("perf symbols: Make
      dso__load_bfd_symbols() load PE files from debug cache only"), causing
      incorrect symbol resolution when debug file have been stripped from
      non-debug sections (in which case its .text section is empty and doesn't
      have any file position).
      
      The debug files could also be created with a different file alignment,
      and have different file positions from the mmap-ed binary, or have the
      section reordered.
      
      This instead looks for the file image base, using the corresponding bfd
      *ABS* symbols. As PE symbols only have 4 bytes, it also needs to keep
      .text section vma high bits.
      Signed-off-by: NRemi Bernon <rbernon@codeweavers.com>
      Fixes: 00a34234 ("perf symbols: Make dso__load_bfd_symbols() load PE files from debug cache only")
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Nicholas Fraser <nfraser@codeweavers.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/20210909192637.4139125-1-rbernon@codeweavers.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2930ede
    • M
      perf scripts python: Fix passing arguments to stackcollapse report · 51ae7fa6
      Michael Petlan 提交于
      The '--' prevented arguments from being passed to the script, such as:
      
        $ perf script report stackcollapse -i my_perf.data
      Signed-off-by: NMichael Petlan <mpetlan@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      LPU-Reference: 20200427142327.21172-1-mpetlan@redhat.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      51ae7fa6
    • M
      perf test: Fix bpf test sample mismatch reporting · 3e11300c
      Michael Petlan 提交于
      When the expected sample count in the condition changed, the message
      needs to be changed too, otherwise we'll get:
      
        0x1001f2091d8: mmap mask[0]:
        BPF filter result incorrect, expected 56, got 56 samples
      
      Fixes: 4b04e0de ("perf test: Fix basic bpf filtering test")
      Signed-off-by: NMichael Petlan <mpetlan@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Link: https //lore.kernel.org/r/20210805160611.5542-1-mpetlan@redhat.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3e11300c
    • A
      tools headers UAPI: Sync files changed by new process_mrelease syscall and the... · 64f45351
      Arnaldo Carvalho de Melo 提交于
      tools headers UAPI: Sync files changed by new process_mrelease syscall and the removal of some compat entry points
      
      To pick the changes in these csets:
      
        59ab844e ("compat: remove some compat entry points")
        dce49103 ("mm: wire up syscall process_mrelease")
        b48c7236 ("exit/bdflush: Remove the deprecated bdflush system call")
      
      That add support for this new syscall in tools such as 'perf trace'.
      
      For instance, this is now possible:
      
        # perf trace -v -e process_mrelease
        event qualifier tracepoint filter: (common_pid != 19351 && common_pid != 9112) && (id == 448)
        ^C#
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep process_mrelease tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        448    common  process_mrelease            sys_process_mrelease
        $
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/powerpc/entry/syscalls/syscall.tbl' differs from latest version at 'arch/powerpc/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/s390/entry/syscalls/syscall.tbl' differs from latest version at 'arch/s390/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl' differs from latest version at 'arch/mips/kernel/syscalls/syscall_n64.tbl'
        diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      64f45351
    • A
      perf beauty: Update copy of linux/socket.h with the kernel sources · bb91de44
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
      Fixes: d32f89da ("net: add accept helper not installing fd")
      Fixes: bc49d816 ("mctp: Add MCTP base")
      
      This automagically adds support for the AF_MCTP protocol domain:
      
        $ 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	2021-09-06 11:57:14.972747200 -0300
        +++ after	2021-09-06 11:57:30.541920222 -0300
        @@ -44,4 +44,5 @@
         	[42] = "QIPCRTR",
         	[43] = "SMC",
         	[44] = "XDP",
        +	[45] = "MCTP",
         };
        $
      
      This will allow 'perf trace' to translate 45 into "MCTP" as is done with
      the other domains:
      
        # perf trace -e socket*
           0.000 chronyd/1029 socket(family: INET, type: DGRAM|CLOEXEC|NONBLOCK, protocol: IP) = 4
        ^C#
      
      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: David S. Miller <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Jeremy Kerr <jk@codeconstruct.com.au>
      Cc: Pavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bb91de44
  3. 09 9月, 2021 1 次提交
  4. 03 9月, 2021 14 次提交
    • J
      perf tests: Add test for PMU aliases · c7a3828d
      Jin Yao 提交于
      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: NJin Yao <yao.jin@linux.intel.com>
      Reviewed-by: NAndi 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.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c7a3828d
    • K
      perf pmu: Add PMU alias support · 13d60ba0
      Kan Liang 提交于
      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: NJin Yao <yao.jin@linux.intel.com>
      Co-developed-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Reviewed-by: NAndi 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.comSigned-off-by: NJin Yao <yao.jin@linux.intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      13d60ba0
    • S
      perf session: Report collisions in AUX records · c68b421d
      Suzuki K Poulose 提交于
      Just like the other flags in the AUX records, report a summary of the
      Collisions if there were any.
      Signed-off-by: NSuzuki Poulouse <suzuki.poulose@arm.com>
      Reviewed-by: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NMathieu 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      c68b421d
    • 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
  5. 01 9月, 2021 17 次提交