1. 23 May, 2023 7 commits
  2. 22 May, 2023 2 commits
    • Anup Sharma's avatar
      perf test: Add test validating JSON generated by 'perf data convert --to-json' · 68d12418
      Anup Sharma authored
      This commit adds support for testing the JSON output generated by the
      'perf data' command's conversion to JSON functionality.
      
      The test script now includes a step to ensure that the resulting JSON
      file contains valid data.
      
      Changes:
      V1 -> V2:
      
      Added a check for the existence of the result output file.
      Replaced the usage of jq with json.load for validating the JSON format.
      Checks using ShellCheck and checkpatch, addressing and resolving warnings.
      Removed the unnecessary root permission check.
      Modified the 'perf record' command to avoid requiring root permissions.
      
      Committer testing:
      
        $ perf test to-json
        115: 'perf data convert --to-json' command test                      : Ok
        $ perf test -v to-json
        Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
        115: 'perf data convert --to-json' command test                      :
        --- start ---
        test child forked, pid 1746867
        Testing Perf Data Convertion Command to JSON
        Perf Data Converter Command to JSON [SUCCESS]
        Validating Perf Data Converted JSON file
        The file contains valid JSON format [SUCCESS]
        test child finished with 0
        ---- end ----
        'perf data convert --to-json' command test: Ok
        $
      Signed-off-by: default avatarAnup Sharma <anupnewsmail@gmail.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Link: https://lore.kernel.org/r/ZGcoJBAGlknjsA/n@yogaTested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Anup Sharma <anupnewsmail@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-perf-users@vger.kernel.org
      [ Fixup indentation to use consistently tabs, not a mixture of spaces and tabs, have 'if ... ; then'  on the same line ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68d12418
    • Arnaldo Carvalho de Melo's avatar
      Merge remote-tracking branch 'acme/perf-tools' into perf-tools-next · 7cdda699
      Arnaldo Carvalho de Melo authored
      To pick up fixes that were already merged upstream.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7cdda699
  3. 19 May, 2023 3 commits
  4. 17 May, 2023 4 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers disabled-features: Sync with the kernel sources · 1b5f159c
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        e0bddc19 ("x86/mm: Reduce untagged_addr() overhead for systems without LAM")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZGTpdlzrlRjjnY6K@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1b5f159c
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync arch prctl headers with the kernel sources · 29719e31
      Arnaldo Carvalho de Melo authored
      To pick the changes in this cset:
      
        a03c376e ("x86/arch_prctl: Add AMX feature numbers as ABI constants")
        23e5d9ec ("x86/mm/iommu/sva: Make LAM and SVA mutually exclusive")
        2f8794bd ("x86/mm: Provide arch_prctl() interface for LAM")
      
      This picks these new prctls in a third range, that was also added to the
      tools/perf/trace/beauty/arch_prctl.c beautifier.
      
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/before
        $ cp arch/x86/include/uapi/asm/prctl.h tools/arch/x86/include/uapi/asm/prctl.h
        $ tools/perf/trace/beauty/x86_arch_prctl.sh > /tmp/after
        $ diff -u /tmp/before /tmp/after
        @@ -20,3 +20,11 @@
         	[0x2003 - 0x2001]= "MAP_VDSO_64",
         };
      
        +#define x86_arch_prctl_codes_3_offset 0x4001
        +static const char *x86_arch_prctl_codes_3[] = {
        +	[0x4001 - 0x4001]= "GET_UNTAG_MASK",
        +	[0x4002 - 0x4001]= "ENABLE_TAGGED_ADDR",
        +	[0x4003 - 0x4001]= "GET_MAX_TAG_BITS",
        +	[0x4004 - 0x4001]= "FORCE_TAGGED_SVA",
        +};
        +
        $
      
      With this 'perf trace' can translate those numbers into strings and use
      the strings in filter expressions:
      
        # perf trace -e prctl
             0.000 ( 0.011 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9c014b7df5)     = 0
             0.032 ( 0.002 ms): DOM Worker/3722622 prctl(option: SET_NAME, arg2: 0x7f9bb6b51580)     = 0
             5.452 ( 0.003 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfeb70) = 0
             5.468 ( 0.002 ms): StreamT~ns #30/3722623 prctl(option: SET_NAME, arg2: 0x7f9bdbdfea70) = 0
            24.494 ( 0.009 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f562a32ae28) = 0
            24.540 ( 0.002 ms): IndexedDB #556/3722624 prctl(option: SET_NAME, arg2: 0x7f563c6d4b30) = 0
           670.281 ( 0.008 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30805c8) = 0
           670.293 ( 0.002 ms): systemd-userwo/3722339 prctl(option: SET_NAME, arg2: 0x564be30800f0) = 0
        ^C#
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/prctl.h' differs from latest version at 'arch/x86/include/uapi/asm/prctl.h'
        diff -u tools/arch/x86/include/uapi/asm/prctl.h arch/x86/include/uapi/asm/prctl.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/ZGTjNPpD3FOWfetM@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      29719e31
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench' · 7f02ce62
      Arnaldo Carvalho de Melo authored
      This is to get the changes from:
      
        68674f94 ("x86: don't use REP_GOOD or ERMS for small memory copies")
        20f3337d ("x86: don't use REP_GOOD or ERMS for small memory clearing")
      
      This also make the 'perf bench mem' files stop referring to the erms
      versions that gone away with the above patches.
      
      That addresses these perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
        diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f02ce62
    • Arnaldo Carvalho de Melo's avatar
      tools headers x86 cpufeatures: Sync with the kernel sources · 9bc83d6e
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        3d8f61bf ("x86: KVM: Add common feature flag for AMD's PSFD")
        3763bf58 ("x86/cpufeatures: Redefine synthetic virtual NMI bit as AMD's "real" vNMI")
        6449dcb0 ("x86: CPUID and CR3/CR4 flags for Linear Address Masking")
        be8de49b ("x86/speculation: Identify processors vulnerable to SMT RSB predictions")
        e7862eda ("x86/cpu: Support AMD Automatic IBRS")
        faabfcb1 ("x86/cpu, kvm: Add the SMM_CTL MSR not present feature")
        5b909d4a ("x86/cpu, kvm: Add the Null Selector Clears Base feature")
        84168ae7 ("x86/cpu, kvm: Move X86_FEATURE_LFENCE_RDTSC to its native leaf")
        a9dc9ec5 ("x86/cpu, kvm: Add the NO_NESTED_DATA_BP feature")
        f8df91e7 ("x86/cpufeatures: Add macros for Intel's new fast rep string features")
        78335aac ("x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag")
        f334f723 ("x86/cpufeatures: Add Slow Memory Bandwidth Allocation feature flag")
        a018d2e3 ("x86/cpufeatures: Add Architectural PerfMon Extension bit")
      
      This causes these perf files to be rebuilt and brings some X86_FEATURE
      that will be used when updating the copies of
      tools/arch/x86/lib/mem{cpy,set}_64.S with the kernel sources:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Babu Moger <babu.moger@amd.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Link: https://lore.kernel.org/lkml/ZGTTw642q8mWgv2Y@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9bc83d6e
  5. 16 May, 2023 3 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync s390 syscall table file that wires up the memfd_secret syscall · b6338963
      Arnaldo Carvalho de Melo authored
      To pick the changes in these csets:
      
        7608f70a ("s390: wire up memfd_secret system call")
      
      That add support for this new syscall in tools such as 'perf trace'.
      
      For instance, this is now possible (adapted from the x86_64 test output):
      
        # perf trace -v -e memfd_secret
        event qualifier tracepoint filter: (common_pid != 13375 && common_pid != 3713) && (id == 447)
        ^C#
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep memfd_secret tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        447    common  memfd_secret            sys_memfd_secret
        $
      
      This addresses this perf build warnings:
      
        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
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/lkml/ZGPMW0p++D1Jdvf6@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b6338963
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/prctl.h with the kernel sources · 71852cd8
      Arnaldo Carvalho de Melo authored
        ddc65971 ("prctl: add PR_GET_AUXV to copy auxv to userspace")
      
      To pick the changes in:
      
      That don't result in any changes in tooling:
      
        $ tools/perf/trace/beauty/prctl_option.sh > before
        $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
        $ tools/perf/trace/beauty/prctl_option.sh > after
        $ diff -u before after
        $
      
      This actually adds a new prctl arg, but it has to be dealt with
      differently, as it is not in sequence with the other arguments.
      
      Just silences this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/prctl.h' differs from latest version at 'include/uapi/linux/prctl.h'
        diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71852cd8
    • Ian Rogers's avatar
      perf metrics: Avoid segv with --topdown for metrics without a group · 9dde1276
      Ian Rogers authored
      Some metrics may not have a metric_group which can result in segvs
      with "perf stat --topdown". Add a condition for the no metric_group
      case.
      
      Fixes: 1647cd5b ("perf stat: Implement --topdown using json metrics")
      Reported-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230515224530.671331-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9dde1276
  6. 15 May, 2023 21 commits
    • Ilkka Koskinen's avatar
      perf vendor events arm64: Add AmpereOne core PMU events · a9650b7f
      Ilkka Koskinen authored
      Add JSON files for AmpereOne core PMU events.
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Signed-off-by: default avatarDoug Rady <dcrady@os.amperecomputing.com>
      Signed-off-by: default avatarIlkka Koskinen <ilkka@os.amperecomputing.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230427223220.1068356-1-ilkka@os.amperecomputing.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a9650b7f
    • Changbin Du's avatar
      perf ftrace: Flush output after each writing · 40bf1cb0
      Changbin Du authored
      The pager will result stdout in full buffering mode instead of line
      buffering. We need to make the trace visible timely.
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230513074000.733550-1-changbin.du@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      40bf1cb0
    • Namhyung Kim's avatar
      perf annotate browser: Add '<' and '>' keys for navigation · 6d491b37
      Namhyung Kim authored
      hists__find_annotations() allows to move to next or previous symbols for
      annotation using the arrow keys.  But TUI annotate_browser__run() uses
      the RIGHT key as ENTER to handle jump/call instructions.  That makes the
      navigation to the next function impossible.
      
      I'd like to change it back to move the next symbol but I'm afraid if
      some users get confused.  So I added a new pair of keys to handle that.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230511062725.514752-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d491b37
    • Namhyung Kim's avatar
      perf annotate: Parse x86 SIB addressing properly · 94f0705e
      Namhyung Kim authored
      When the source argument of the "mov" instruction looks like below, it
      didn't parse the whole operand and just stopped at the first comma.
      
        mov    (%rbx,%rax,1),%rcx
      
      Fix it by checking the parentheses and move it to the closing one.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230511062725.514752-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      94f0705e
    • Namhyung Kim's avatar
      perf annotate: Handle "decq", "incq", "testq", "tzcnt" instructions on x86 · 983034cd
      Namhyung Kim authored
      I found that the "decq", "incq", "testq", "tzcnt" instructions didn't
      parse the operands properly.  Add them to the "x86__instructions" table
      to fix the issue.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230511062725.514752-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      983034cd
    • Ben Hutchings's avatar
      perf doc: Add support for KBUILD_BUILD_TIMESTAMP · 61b3d210
      Ben Hutchings authored
      When building man pages from a Git checkout, we consistently set the
      man page date based on when the input was last changed.  Otherwise, it
      defaults to the build time, which is not reproducible.
      
      Allow the date to be set through the KBUILD_BUILD_TIMESTAMP variable,
      as for timestamps in the kernel itself.
      Signed-off-by: default avatarBen Hutchings <benh@debian.org>
      Acked-by: Ian Rogers<irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Salvatore Bonaccorso <carnil@debian.org>
      Link: https://lore.kernel.org/r/ZF/1F1P+b9qZ/vVH@decadent.org.ukSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      61b3d210
    • Ben Hutchings's avatar
      perf doc: Define man page date when using asciidoctor · 21a16513
      Ben Hutchings authored
      When building perf documentation with asciidoc, we use "git log" to
      find the last commit date of each doc source and pass that to asciidoc
      to use as the man page date.
      
      When using asciidoctor, however, the current date is always used
      instead.  Defining perf_date like we do for asciidoc also doesn't
      work because we're not using DocBook as an intermediate format.
      The asciidoctor man page backend looks for the variable "docdate",
      so set that instead.
      Signed-off-by: default avatarBen Hutchings <benh@debian.org>
      Acked-by: Ian Rogers<irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Salvatore Bonaccorso <carnil@debian.org>
      Link: https://lore.kernel.org/r/ZF/1BOahN/i6xbBx@decadent.org.ukSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      21a16513
    • Ian Rogers's avatar
      perf test: Add cputype testing to perf stat · c0d68601
      Ian Rogers authored
      Check a bogus PMU fails and that a known PMU succeeds. Limit to PMUs
      known cpu, cpu_atom and armv8_pmuv3_0 ones.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230513063447.464691-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c0d68601
    • Arnaldo Carvalho de Melo's avatar
      perf build: Don't use -ftree-loop-distribute-patterns and... · 190c6854
      Arnaldo Carvalho de Melo authored
      perf build: Don't use -ftree-loop-distribute-patterns and -gno-variable-location-views in the python feature test when building with clang-13
      
      Using -ftree-loop-distribute-patterns and -gno-variable-location-views
      in the python feature test when building with clang-16 results in:
      
        16    80.04 clearlinux:latest             : FAIL clang version 16.0.1
          clang-16: error: unknown argument: '-gno-variable-location-views'
          clang-16: error: unknown argument: '-gno-variable-location-views'
          clang-16: error: optimization flag '-ftree-loop-distribute-patterns' is not supported [-Werror,-Wignored-optimization-argument]
          clang-16: error: optimization flag '-ftree-loop-distribute-patterns' is not supported [-Werror,-Wignored-optimization-argument]
          error: command '/usr/sbin/clang' failed with exit code 1
      
      Noticed when building on a docker.io/library/clearlinux:latest container.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      190c6854
    • Ian Rogers's avatar
      perf parse-events: Reduce scope of is_event_supported · 9a1bc9ea
      Ian Rogers authored
      Move to print-events.c and make static.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-45-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a1bc9ea
    • Ian Rogers's avatar
      perf stat: Don't disable TopdownL1 metric on hybrid · 718eabe1
      Ian Rogers authored
      Now that hybrid bugs are fixed sufficient to run TopdownL1 metrics,
      don't implicitly disable them for hybrid.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-44-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      718eabe1
    • Ian Rogers's avatar
      perf metrics: Be PMU specific in event match · 8a4859c5
      Ian Rogers authored
      Ids/events from a metric are turned into an event string and parsed;
      setup_metric_events matches the id back to the parsed evsel. With
      hybrid the same event may exist on both PMUs with the same name and be
      being used by metrics at the same time. A metric on cpu_core therefore
      shouldn't match against evsels on cpu_atom, or the metric will compute
      the wrong value. Make the matching sensitive to the PMU being parsed.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-43-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a4859c5
    • Ian Rogers's avatar
      perf jevents: Don't rewrite metrics across PMUs · d6b7dd11
      Ian Rogers authored
      Don't rewrite metrics across PMUs as the result events likely won't be
      found. Identify metrics with a pair of PMU name and metric name.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-42-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d6b7dd11
    • Ian Rogers's avatar
      perf vendor events intel: Correct alderlake metrics · 1b8012b2
      Ian Rogers authored
      Fix the metrics tma_memory_bound on alderlake cpu_core and
      tma_microcode_sequencer on alderlake cpu_atom, where metrics had be
      rewritten across PMUs. Fix MEM_BOUND_STALLS_AT_RET_CORRECTION which is
      an aux metric but lacks a hash prefix. Add PMU prefixes for
      cpu_core/cpu_atom events to avoid wildcard opening the events.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-41-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1b8012b2
    • Ian Rogers's avatar
      perf stat: Command line PMU metric filtering · dae47d39
      Ian Rogers authored
      Wire up the --cputype value to limit which metrics are parsed.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-40-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dae47d39
    • Ian Rogers's avatar
      perf metrics: Be PMU specific for referenced metrics. · bd3846d0
      Ian Rogers authored
      Hybrid systems may define the same metric for different PMUs, this can
      cause confusion of events. To avoid this make the referenced metric
      searches PMU specific, matching that in the table.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-39-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd3846d0
    • Ian Rogers's avatar
      perf parse-events: Don't reorder atom cpu events · 5136e43c
      Ian Rogers authored
      On hybrid systems the topdown events don't share a fixed counter on
      the atom core, so they don't require the sorting the perf metric
      supporting PMUs do.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-38-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5136e43c
    • Ian Rogers's avatar
      perf parse-events: Don't auto merge hybrid wildcard events · 52c7b4d3
      Ian Rogers authored
      Bring back the behavior of not auto-merging hybrid events by
      delegating to a test in pmu.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-37-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      52c7b4d3
    • Ian Rogers's avatar
      perf parse-events: Avoid error when assigning a legacy cache term · 2aadca4b
      Ian Rogers authored
      Avoid the parser error:
      '''
      $ perf stat -e 'cycles/name=l1d/' true
      event syntax error: 'cycles/name=l1d/'
                                      \___ parser error
      '''
      by combining the name and legacy cache cases in the parser.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-36-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2aadca4b
    • Ian Rogers's avatar
      perf parse-events: Avoid error when assigning a term · e831f3cc
      Ian Rogers authored
      Avoid the parser error:
      '''
      $ perf stat -e 'cycles/name=name/' true
      event syntax error: 'cycles/name=name/'
                                      \___ parser error
      '''
      by turning the term back to a string if it is on the right. Add PMU
      and generic parsing tests.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-35-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e831f3cc
    • Ian Rogers's avatar
      perf parse-events: Support hardware events as terms · 5ea8f2cc
      Ian Rogers authored
      An event like "cpu/instructions/" typically parses due to there being
      a sysfs event called instructions. On hybrid recursive parsing means
      that the hardware event is encoded in the attribute, with the PMU
      being placed in the high bits of the config:
      
      '''
      $ perf stat -vv -e 'cpu_core/cycles/' true
      ...
      ------------------------------------------------------------
      perf_event_attr:
        size                             136
        config                           0x400000000
        sample_type                      IDENTIFIER
        read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
        disabled                         1
        inherit                          1
        enable_on_exec                   1
        exclude_guest                    1
      ------------------------------------------------------------
      '''
      
      Make this behavior the default by adding a new term type and token for
      hardware events. The token gathers both the numeric config and the
      parsed name, so that if the token appears like "cycles/name=cycles/"
      then the token can be handled like a name. The numeric value isn't
      sufficient to distinguish say "cpu-cycles" from "cycles".
      
      Extend the parse-events test so that all current non-PMU hardware
      parsing tests, also test with the PMU cpu - more than half the change.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Samantha Alt <samantha.alt@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20230502223851.2234828-34-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ea8f2cc