1. 15 Mar, 2023 18 commits
    • Leo Yan's avatar
      perf kvm: Introduce histograms data structures · 2d08124b
      Leo Yan authored
      This is a preparation to support histograms in perf kvm tool.  As first
      step, this patch defines histograms data structures and initialize them.
      
      Committer notes:
      
      Those are only used by functions enclosed in:
      
        #if efined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
      
      So do this for these new functions and struct as well.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2d08124b
    • Leo Yan's avatar
      perf kvm: Use macro to replace variable 'decode_str_len' · 2d31e0bf
      Leo Yan authored
      The variable 'decode_str_len' defines the string length for KVM event
      name and every arch defines its own values.
      
      This introduces complexity that the variable definition are spreading in
      multiple source files under arch folder.  This patch refactors code to
      use a macro KVM_EVENT_NAME_LEN to define event name length and thus
      remove the definitions in arch files.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2d31e0bf
    • Leo Yan's avatar
      perf kvm: Use subtraction for comparison metrics · dd787ae4
      Leo Yan authored
      Currently the metrics comparison uses greater operator (>), it returns
      the boolean value (0 or 1).
      
      This patch changes to use subtraction as comparison result, which can
      be used by histograms sorting.  Since the subtraction result is u64
      type, we change key_cmp_fun's return type to int64_t to avoid overflow.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd787ae4
    • Leo Yan's avatar
      perf kvm: Move up metrics helpers · f098376d
      Leo Yan authored
      This patch moves up the helper functions of event's metrics for later
      adding code to call them.
      
      No any functionality changes, but has a function renaming from
      compare_kvm_event_{metric}() to cmp_event_{metric}().
      
      Committer notes:
      
      Those helper functions are only used if this is true:
      
        if defined(HAVE_KVM_STAT_SUPPORT) && defined(HAVE_LIBTRACEEVENT)
      
      So keep them enclosed with that.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f098376d
    • Leo Yan's avatar
      perf kvm: Add pointer to 'perf_kvm_stat' in kvm event · a7d451a8
      Leo Yan authored
      Sometimes, handling kvm events needs to base on global variables, e.g.
      when read event counts we need to know the target vcpu ID; the global
      variables are stored in structure perf_kvm_stat.
      
      This patch adds add a 'perf_kvm_stat' pointer in kvm event structure,
      it is to be used by later refactoring.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a7d451a8
    • Leo Yan's avatar
      perf kvm: Refactor overall statistics · 9c3aa1f4
      Leo Yan authored
      Currently the tool computes overall statistics when sort the results.
      This patch refactors overall statistics during events processing,
      therefore, the function update_total_coun() is not needed anymore, an
      extra benefit is we can de-couple code between the statistics and the
      sorting.
      
      This patch is not expected any functionality changes.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      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: John Garry <john.g.garry@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9c3aa1f4
    • Namhyung Kim's avatar
      perf record: Update documentation for BPF filters · c46bf3bd
      Namhyung Kim authored
      Add more description and examples.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c46bf3bd
    • Namhyung Kim's avatar
      perf bpf filter: Show warning for missing sample flags · 4310551b
      Namhyung Kim authored
      For a BPF filter to work properly, users need to provide appropriate
      options to enable the sample types.  Otherwise the BPF program would
      see an invalid value (i.e. always 0) and filter won't work well.
      
      Show a warning message if sample types are missing like below.
      
        $ sudo ./perf record -e cycles --filter 'addr < 100' true
        Error: cycles event does not have PERF_SAMPLE_ADDR
         Hint: please add -d option to perf record.
        failed to set filter "BPF" on event cycles with 22 (Invalid argument)
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4310551b
    • Namhyung Kim's avatar
      perf bpf filter: Add logical OR operator · 46996dd7
      Namhyung Kim authored
      It supports two or more expressions connected as a group and the group
      result is considered true when one of them returns true.  The new group
      operators (GROUP_BEGIN and GROUP_END) are added to setup and check the
      condition.  As it doesn't allow nested groups, the condition is saved
      in local variables.
      
      For example, the following is to get samples only if the data source
      memory level is L2 cache or the weight value is greater than 30.
      
        $ sudo ./perf record -adW -e cpu/mem-loads/pp \
        > --filter 'mem_lvl == l2 || weight > 30' -- sleep 1
      
        $ sudo ./perf script -F data_src,weight
           10668100842 |OP LOAD|LVL L3 or L3 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A		    47
           11868100242 |OP LOAD|LVL LFB/MAB or LFB/MAB hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A      57
           10668100842 |OP LOAD|LVL L3 or L3 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A                56
           10650100842 |OP LOAD|LVL L3 or L3 hit|SNP None|TLB L2 miss|LCK No|BLK  N/A                    144
           10468100442 |OP LOAD|LVL L2 or L2 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A                16
           10468100442 |OP LOAD|LVL L2 or L2 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A                20
           11868100242 |OP LOAD|LVL LFB/MAB or LFB/MAB hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A     189
           1026a100142 |OP LOAD|LVL L1 or L1 hit|SNP None|TLB L1 or L2 hit|LCK Yes|BLK  N/A              193
           10468100442 |OP LOAD|LVL L2 or L2 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK  N/A                18
           ...
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      46996dd7
    • Namhyung Kim's avatar
      perf bpf filter: Add data_src sample data support · ff612055
      Namhyung Kim authored
      The data_src has many entries to express memory behaviors.  Add each
      term separately so that users can combine them for their purpose.
      
      I didn't add prefix for the constants for simplicity as they are mostly
      distinguishable but I had to use l1_miss and l2_hit for mem_dtlb since
      mem_lvl has different values for the same names.  Note that I decided
      mem_lvl to be used as an alias of mem_lvlnum as it's deprecated now.
      According to the comment in the UAPI header, users should use the mix of
      mem_lvlnum, mem_remote and mem_snoop.  Also the SNOOPX bits are
      concatenated to mem_snoop for simplicity.
      
      The following terms are used for data_src and the corresponding perf
      sample data fields:
      
       * mem_op : { load, store, pfetch, exec }
       * mem_lvl: { l1, l2, l3, l4, cxl, io, any_cache, lfb, ram, pmem }
       * mem_snoop: { none, hit, miss, hitm, fwd, peer }
       * mem_remote: { remote }
       * mem_lock: { locked }
       * mem_dtlb { l1_hit, l1_miss, l2_hit, l2_miss, any_hit, any_miss, walk, fault }
       * mem_blk { by_data, by_addr }
       * mem_hops { hops0, hops1, hops2, hops3 }
      
      We can now use a filter expression like below:
      
        'mem_op == load, mem_lvl <= l2, mem_dtlb == l1_hit'
        'mem_dtlb == l2_miss, mem_hops > hops1'
        'mem_lvl == ram, mem_remote == 1'
      
      Note that 'na' is shared among the terms as it has the same value except
      for mem_lvl.  I don't have a good idea to handle that for now.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ff612055
    • Namhyung Kim's avatar
      perf bpf filter: Add more weight sample data support · 409bcd80
      Namhyung Kim authored
      The weight data consists of a couple of fields with the
      PERF_SAMPLE_WEIGHT_STRUCT.  Add weight{1,2,3} term to select them
      separately.  Also add their aliases like 'ins_lat', 'p_stage_cyc' and
      'retire_lat'.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      409bcd80
    • Namhyung Kim's avatar
      perf bpf filter: Add 'pid' sample data support · 33581847
      Namhyung Kim authored
      The pid is special because it's saved in the PERF_SAMPLE_TID together.
      So it needs to differenciate tid and pid using the 'part' field in the
      perf bpf filter entry struct.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      33581847
    • Namhyung Kim's avatar
      perf record: Record dropped sample count · 27c6f245
      Namhyung Kim authored
      When it uses bpf filters, event might drop some samples.  It'd be nice
      if it can report how many samples it lost.  As LOST_SAMPLES event can
      carry the similar information, let's use it for bpf filters.
      
      To indicate it's from BPF filters, add a new misc flag for that and
      do not display cpu load warnings.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      27c6f245
    • Namhyung Kim's avatar
      perf record: Add BPF event filter support · d180aa56
      Namhyung Kim authored
      Use --filter option to set BPF filter for generic events other than the
      tracepoints or Intel PT.  The BPF program will check the sample data and
      filter according to the expression.
      
      For example, the below is the typical perf record for frequency mode.
      The sample period started from 1 and increased gradually.
      
        $ sudo ./perf record -e cycles true
        $ sudo ./perf script
             perf-exec 2272336 546683.916875:          1 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916892:          1 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916899:          3 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916905:         17 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916911:        100 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916917:        589 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916924:       3470 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
             perf-exec 2272336 546683.916930:      20465 cycles:  ffffffff828499b8 perf_event_exec+0x298 ([kernel.kallsyms])
                  true 2272336 546683.916940:     119873 cycles:  ffffffff8283afdd perf_iterate_ctx+0x2d ([kernel.kallsyms])
                  true 2272336 546683.917003:     461349 cycles:  ffffffff82892517 vma_interval_tree_insert+0x37 ([kernel.kallsyms])
                  true 2272336 546683.917237:     635778 cycles:  ffffffff82a11400 security_mmap_file+0x20 ([kernel.kallsyms])
      
      When you add a BPF filter to get samples having periods greater than 1000,
      the output would look like below:
      
        $ sudo ./perf record -e cycles --filter 'period > 1000' true
        $ sudo ./perf script
             perf-exec 2273949 546850.708501:       5029 cycles:  ffffffff826f9e25 finish_wait+0x5 ([kernel.kallsyms])
             perf-exec 2273949 546850.708508:      32409 cycles:  ffffffff826f9e25 finish_wait+0x5 ([kernel.kallsyms])
             perf-exec 2273949 546850.708526:     143369 cycles:  ffffffff82b4cdbf xas_start+0x5f ([kernel.kallsyms])
             perf-exec 2273949 546850.708600:     372650 cycles:  ffffffff8286b8f7 __pagevec_lru_add+0x117 ([kernel.kallsyms])
             perf-exec 2273949 546850.708791:     482953 cycles:  ffffffff829190de __mod_memcg_lruvec_state+0x4e ([kernel.kallsyms])
                  true 2273949 546850.709036:     501985 cycles:  ffffffff828add7c tlb_gather_mmu+0x4c ([kernel.kallsyms])
                  true 2273949 546850.709292:     503065 cycles:      7f2446d97c03 _dl_map_object_deps+0x973 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
      
      Committer notes:
      
      Add stubs for perf_bpf_filter__prepare() and perf_bpf_filter__destroy()
      to tools/perf/util/python.c to keep it building.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d180aa56
    • Namhyung Kim's avatar
      perf bpf filter: Implement event sample filtering · 56ec9457
      Namhyung Kim authored
      The BPF program will be attached to a perf_event and be triggered when
      it overflows.  It'd iterate the filters map and compare the sample
      value according to the expression.  If any of them fails, the sample
      would be dropped.
      
      Also it needs to have the corresponding sample data for the expression
      so it compares data->sample_flags with the given value.  To access the
      sample data, it uses the bpf_cast_to_kern_ctx() kfunc which was added
      in v6.2 kernel.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56ec9457
    • Namhyung Kim's avatar
      perf bpf filter: Introduce basic BPF filter expression · 990a71e9
      Namhyung Kim authored
      This implements a tiny parser for the filter expressions used for BPF.
      Each expression will be converted to struct perf_bpf_filter_expr and
      be passed to a BPF map.
      
      For now, I'd like to start with the very basic comparisons like EQ or
      GT.  The LHS should be a term for sample data and the RHS is a number.
      The expressions are connected by a comma.  For example,
      
          period > 10000
          ip < 0x1000000000000, cpu == 3
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230314234237.3008956-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      990a71e9
    • liuwenyu's avatar
      perf top: Fix rare segfault in thread__comm_len() · 6e57f69f
      liuwenyu authored
      In thread__comm_len(),strlen() is called outside of the
      thread->comm_lock critical section,which may cause a UAF
      problems if comm__free() is called by the process_thread
      concurrently.
      
      backtrace of the core file is as follows:
      
          (gdb) bt
          #0  __strlen_evex () at ../sysdeps/x86_64/multiarch/strlen-evex.S:77
          #1  0x000055ad15d31de5 in thread__comm_len (thread=0x7f627d20e300) at util/thread.c:320
          #2  0x000055ad15d4fade in hists__calc_col_len (h=0x7f627d295940, hists=0x55ad1772bfe0)
              at util/hist.c:103
          #3  hists__calc_col_len (hists=0x55ad1772bfe0, h=0x7f627d295940) at util/hist.c:79
          #4  0x000055ad15d52c8c in output_resort (hists=hists@entry=0x55ad1772bfe0, prog=0x0,
              use_callchain=false, cb=cb@entry=0x0, cb_arg=0x0) at util/hist.c:1926
          #5  0x000055ad15d530a4 in evsel__output_resort_cb (evsel=evsel@entry=0x55ad1772bde0,
              prog=prog@entry=0x0, cb=cb@entry=0x0, cb_arg=cb_arg@entry=0x0) at util/hist.c:1945
          #6  0x000055ad15d53110 in evsel__output_resort (evsel=evsel@entry=0x55ad1772bde0,
              prog=prog@entry=0x0) at util/hist.c:1950
          #7  0x000055ad15c6ae9a in perf_top__resort_hists (t=t@entry=0x7ffcd9cbf4f0) at builtin-top.c:311
          #8  0x000055ad15c6cc6d in perf_top__print_sym_table (top=0x7ffcd9cbf4f0) at builtin-top.c:346
          #9  display_thread (arg=0x7ffcd9cbf4f0) at builtin-top.c:700
          #10 0x00007f6282fab4fa in start_thread (arg=<optimized out>) at pthread_create.c:443
          #11 0x00007f628302e200 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      
      The reason is that strlen() get a pointer to a memory that has been freed.
      
      The string pointer is stored in the structure comm_str, which corresponds
      to a rb_tree node,when the node is erased, the memory of the string is also freed.
      
      In thread__comm_len(),it gets the pointer within the thread->comm_lock critical section,
      but passed to strlen() outside of the thread->comm_lock critical section, and the perf
      process_thread may called comm__free() concurrently, cause this segfault problem.
      
      The process is as follows:
      
      display_thread                                  process_thread
      --------------                                  --------------
      
      thread__comm_len
        -> thread__comm_str
             # held the comm read lock
          -> __thread__comm_str(thread)
             # release the comm read lock
                                                      thread__delete
                                                           # held the comm write lock
                                                        -> comm__free
                                                          -> comm_str__put(comm->comm_str)
                                                            -> zfree(&cs->str)
                                                           # release the comm write lock
            # The memory of the string pointed
              to by comm has been free.
          -> thread->comm_len = strlen(comm);
      
      This patch expand the critical section range of thread->comm_lock in thread__comm_len(),
      to make strlen() called safe.
      Signed-off-by: default avatarWenyu Liu <liuwenyu7@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Feilong Lin <linfeilong@huawei.com>
      Cc: Hewenliang <hewenliang4@huawei.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: Yunfeng Ye <yeyunfeng@huawei.com>
      Link: https://lore.kernel.org/r/322bfb49-840b-f3b6-9ef1-f9ec3435b07e@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6e57f69f
    • Adrian Hunter's avatar
      perf script: Fix Python support when no libtraceevent · 80c3a7d9
      Adrian Hunter authored
      Python scripting can be used without libtraceevent. In particular,
      scripting for Intel PT does not use tracepoints, and so does not need
      libtraceevent support.
      
      Alter the build and employ conditional compilation to allow Python
      scripting without libtraceevent.
      
      Example:
      
       Before:
      
          $ ldd `which perf` | grep -i python
          $ ldd `which perf` | grep -i libtraceevent
          $ perf record -e intel_pt//u uname
          Linux
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.031 MB perf.data ]
          $ perf script intel-pt-events.py |& head -3
            Error: Couldn't find script `intel-pt-events.py'
      
           See perf script -l for available scripts.
      
       After:
      
          $ ldd `which perf` | grep -i python
                  libpython3.10.so.1.0 => /lib/x86_64-linux-gnu/libpython3.10.so.1.0 (0x00007f4bac400000)
          $ ldd `which perf` | grep -i libtraceevent
          $ perf script intel-pt-events.py | head
          Intel PT Branch Trace, Power Events, Event Trace and PTWRITE
               Switch In    8021/8021  [000]     11234.097713404     0/0
                 perf-exec  8021/8021  [000]     11234.098041726       psb                        offset: 0x0                0 [unknown] ([unknown])
                 perf-exec  8021/8021  [000]     11234.098041726       cbr                         45  freq: 4505 MHz  (161%)                0 [unknown] ([unknown])
                     uname  8021/8021  [000]     11234.098082170  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098082379  branches:uH  tr end                    7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown])
                     uname  8021/8021  [000]     11234.098083629  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098083629  branches:uH  call                      7f3a8b9422b3 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 7f3a8b943050 _dl_start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098083837  branches:uH  tr end                    7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown])  IPC: 0.01 (9/938)
                     uname  8021/8021  [000]     11234.098084670  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20230315084321.14563-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      80c3a7d9
  2. 14 Mar, 2023 22 commits
    • Thomas Richter's avatar
      perf vendor events s390: Add metric for TLB and cache · 4c290d4f
      Thomas Richter authored
      Add metrics for tlb and cache statistics:
      
      - finite_cpi: Cycles per Instructions from Finite cache/memory
      - est_cpi: Estimated Instruction Complexity CPI infinite Level 1
      - scpl1m: Estimated Sourcing Cycles per Level 1 Miss
      - tlb_percent: Estimated TLB CPU percentage of Total CPU
      - tlb_miss: Estimated Cycles per TLB Miss
      
      For details about the formulas see this documentation:
      
        https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Output after:
      
        # ./perf stat -M tlb_miss -- dd if=/dev/zero of=/dev/null bs=1M count=10K
        ... dd output removed
      
        Performance counter stats for 'dd if=/dev/zero of=/dev/null bs=1M count=10K':
      
                 667,726      DTLB2_MISSES             #   440.96 tlb_miss
                     198      ITLB2_WRITES
             795,170,260      L1C_TLB2_MISSES
                   9,478      ITLB2_MISSES
                     820      DTLB2_WRITES
           1,197,126,869      L1D_PENALTY_CYCLES
               2,457,447      L1I_PENALTY_CYCLES
      
             1.249342187 seconds time elapsed
      
             0.001030000 seconds user
             1.248105000 seconds sys
      
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-3-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c290d4f
    • Thomas Richter's avatar
      perf vendor events s390: Add cache metrics for z13 · 850eea23
      Thomas Richter authored
      Add metrics for s390 z13
      
      - Percentage sourced from Level 2 cache
      - Percentage sourced from Level 3 on same chip cache
      - Percentage sourced from Level 4 Local cache on same book
      - Percentage sourced from Level 4 Remote cache on different book
      - Percentage sourced from memory
      
      For details about the formulas see this documentation:
      
        https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Output after:
      
        # ./perf stat -M l4rp -- find /
         ...find output deleted
      
        Performance counter stats for 'find /':
      
                  2      L1I_OFFDRAWER_SCOL_L4_SOURCED_WRITES #     0.02 l4rp
                252      L1D_ONDRAWER_L4_SOURCED_WRITES
              3,465      L1D_ONDRAWER_L3_SOURCED_WRITES_IV
                 80      L1D_OFFDRAWER_SCOL_L4_SOURCED_WRITES
                761      L1D_ONDRAWER_L3_SOURCED_WRITES
                  0      L1I_OFFDRAWER_SCOL_L3_SOURCED_WRITES
        131,817,067      L1I_DIR_WRITES
                  1      L1I_OFFDRAWER_FCOL_L4_SOURCED_WRITES
                447      L1D_OFFDRAWER_SCOL_L3_SOURCED_WRITES
                 22      L1D_OFFDRAWER_FCOL_L4_SOURCED_WRITES
                  7      L1I_ONDRAWER_L4_SOURCED_WRITES
                  0      L1I_OFFDRAWER_FCOL_L3_SOURCED_WRITES
              1,071      L1D_OFFDRAWER_FCOL_L3_SOURCED_WRITES
                  3      L1I_ONDRAWER_L3_SOURCED_WRITES
             13,352      L1D_OFFDRAWER_FCOL_L3_SOURCED_WRITES_IV
             15,252      L1D_OFFDRAWER_SCOL_L3_SOURCED_WRITES_IV
                  0      L1I_ONDRAWER_L3_SOURCED_WRITES_IV
                  0      L1I_OFFDRAWER_FCOL_L3_SOURCED_WRITES_IV
         57,431,083      L1D_DIR_WRITES
                  0      L1I_OFFDRAWER_SCOL_L3_SOURCED_WRITES_IV
      
            15.386502874 seconds time elapsed
      
             0.647348000 seconds user
             3.537041000 seconds sys
      
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-3-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      850eea23
    • Thomas Richter's avatar
      perf vendor events s390: Add cache metrics for z14 · add7894a
      Thomas Richter authored
      Add metrics for s390 z14
      
      - Percentage sourced from Level 2 cache
      - Percentage sourced from Level 3 on same chip cache
      - Percentage sourced from Level 4 Local cache on same book
      - Percentage sourced from Level 4 Remote cache on different book
      - Percentage sourced from memory
      
      For details about the formulas see this documentation:
      
        https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Output after:
      
        # ./perf stat -M l4rp -- find /
        .... find output deleted
      
        Performance counter stats for 'find /':
      
                   0      L1I_OFFDRAWER_L4_SOURCED_WRITES  #     0.01 l4rp
                  84      L1D_OFFDRAWER_L4_SOURCED_WRITES
                   0      L1I_OFFDRAWER_L3_SOURCED_WRITES
          71,535,353      L1I_DIR_WRITES
                 219      L1D_OFFDRAWER_L3_SOURCED_WRITES
              16,436      L1D_OFFDRAWER_L3_SOURCED_WRITES_IV
                   0      L1I_OFFDRAWER_L3_SOURCED_WRITES_IV
          46,343,940      L1D_DIR_WRITES
      
        10.530805537 seconds time elapsed
      
         0.774396000 seconds user
         1.602714000 seconds sys
      
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-3-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      add7894a
    • Thomas Richter's avatar
      perf vendor events s390: Add cache metrics for z15 · bdecfeca
      Thomas Richter authored
      Add metrics for s390 z15
      
      - Percentage sourced from Level 2 cache
      - Percentage sourced from Level 3 on same chip cache
      - Percentage sourced from Level 4 Local cache on same book
      - Percentage sourced from Level 4 Remote cache on different book
      - Percentage sourced from memory
      
      For details about the formulas see this documentation:
      
        https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Outpuf after:
        # ./perf stat -M l4rp -- find /
        .... find output deleted
      
        Performance counter stats for 'find /':
      
                    5      L1I_OFFDRAWER_L4_SOURCED_WRITES  #     0.01 l4rp
                  187      L1D_OFFDRAWER_L4_SOURCED_WRITES
                    0      L1I_OFFDRAWER_L3_SOURCED_WRITES
          231,333,165      L1I_DIR_WRITES
                3,303      L1D_OFFDRAWER_L3_SOURCED_WRITES
               47,461      L1D_OFFDRAWER_L3_SOURCED_WRITES_IV
                    0      L1I_OFFDRAWER_L3_SOURCED_WRITES_IV
          126,706,244      L1D_DIR_WRITES
      
         27.870355461 seconds time elapsed
      
          0.521562000 seconds user
         12.494503000 seconds sys
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-3-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bdecfeca
    • Ian Rogers's avatar
      perf vendor events intel: Update skylake events · 3da9559e
      Ian Rogers authored
      Update from v54 to v55. Addition of OFFCORE_RESPONSE,
      FP_ARITH_INST_RETIRED.SCALAR, FP_ARITH_INST_RETIRED.VECTOR and
      INT_MISC.CLEARS_COUNT.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Edward Baker <edward.baker@intel.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>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230314053312.3237390-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3da9559e
    • Ian Rogers's avatar
      perf vendor events intel: Update meteorlake events · 591530c0
      Ian Rogers authored
      Update from 1.00 to 1.01. Event description updates. Addition of
      IDQ_BUBBLES.CORE, TOPDOWN.BACKEND_BOUND_SLOTS, UOPS_RETIRED.SLOTS.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Edward Baker <edward.baker@intel.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>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230314053312.3237390-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      591530c0
    • Ian Rogers's avatar
      perf vendor events intel: Update graniterapids events · b720bf90
      Ian Rogers authored
      Update from 1.00 to 1.01, some event description updates.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Edward Baker <edward.baker@intel.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>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230314053312.3237390-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b720bf90
    • Roman Lozko's avatar
      perf scripts intel-pt-events.py: Fix IPC output for Python 2 · 1f64cfde
      Roman Lozko authored
      Integers are not converted to floats during division in Python 2 which
      results in incorrect IPC values. Fix by switching to new division
      behavior.
      
      Fixes: a483e64c ("perf scripting python: intel-pt-events.py: Add --insn-trace and --src-trace")
      Signed-off-by: default avatarRoman Lozko <lozko.roma@gmail.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Link: https://lore.kernel.org/r/20230310150445.2925841-1-lozko.roma@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f64cfde
    • Arnaldo Carvalho de Melo's avatar
      perf tools bpf: Add vmlinux.h to .gitignore · 0e70f50e
      Arnaldo Carvalho de Melo authored
      Now that BPF skel based tools will be built by default if the toolchain
      pieces that are needed are available, building directly on the source
      tree will produce a vmlinux.h from the BTF info that needs to get
      ignored.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0e70f50e
    • Ian Rogers's avatar
      perf test: Fix "PMU event table sanity" for NO_JEVENTS=1 · 07fc5921
      Ian Rogers authored
      A table was renamed and needed to be renamed in the empty case.
      
      Fixes: 62774db2 ("perf jevents: Generate metrics and events as separate tables")
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.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/20230308002714.1755698-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07fc5921
    • Namhyung Kim's avatar
      perf lock contention: Show lock type with address · 4f701063
      Namhyung Kim authored
      Show lock type names after the symbol of locks if any.  This can be
      useful especially when it doesn't show the lock symbols.
      
      The indentation before the lock type parenthesis is to recognize lock
      symbols more easily.
      
        $ sudo ./perf lock con -abl -- sleep 1
         contended   total wait     max wait     avg wait            address   symbol
      
                44      6.13 ms    284.49 us    139.28 us   ffffffff92e06080   tasklist_lock (rwlock)
               159    983.38 us     12.38 us      6.18 us   ffff8cc717c90000   siglock (spinlock)
                10    679.90 us    153.35 us     67.99 us   ffff8cdc2872aaf8   mmap_lock (rwsem)
                 9    558.11 us    180.67 us     62.01 us   ffff8cd647914038   mmap_lock (rwsem)
                78    228.56 us      7.82 us      2.93 us   ffff8cc700061c00    (spinlock)
                 5     41.60 us     16.93 us      8.32 us   ffffd853acb41468    (spinlock)
                10     37.24 us      5.87 us      3.72 us   ffff8cd560b5c200   siglock (spinlock)
                 4     11.17 us      3.97 us      2.79 us   ffff8d053ddf0c80   rq_lock (spinlock)
                 1      7.86 us      7.86 us      7.86 us   ffff8cd64791404c    (spinlock)
                 1      4.13 us      4.13 us      4.13 us   ffff8d053d930c80   rq_lock (spinlock)
                 7      3.98 us      1.67 us       568 ns   ffff8ccb92479440    (mutex)
                 2      2.62 us      2.33 us      1.31 us   ffff8cc702e6ede0    (rwlock)
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230313204825.2665483-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4f701063
    • Namhyung Kim's avatar
      perf lock contention: Show per-cpu rq_lock with address · d24c0144
      Namhyung Kim authored
      Using the BPF_PROG_RUN mechanism, we can run a raw_tp BPF program to
      collect some semi-global locks like per-cpu locks.  Let's add runqueue
      locks using bpf_per_cpu_ptr() helper.
      
        $ sudo ./perf lock con -abl -- sleep 1
         contended   total wait     max wait     avg wait            address   symbol
      
               248      3.25 ms     32.23 us     13.10 us   ffff8cc75cfd2940   siglock
                60    217.91 us      9.69 us      3.63 us   ffff8cc700061c00
                 8     70.23 us     13.86 us      8.78 us   ffff8cc703629484
                 4     56.32 us     35.81 us     14.08 us   ffff8cc78b66f778   mmap_lock
                 4     16.70 us      5.18 us      4.18 us   ffff8cc7036a0684
                 3      4.99 us      2.65 us      1.66 us   ffff8d053da30c80   rq_lock
                 2      3.44 us      2.28 us      1.72 us   ffff8d053dcf0c80   rq_lock
                 9      2.51 us       371 ns       278 ns   ffff8ccb92479440
                 2      2.11 us      1.24 us      1.06 us   ffff8d053db30c80   rq_lock
                 2      2.06 us      1.69 us      1.03 us   ffff8d053d970c80   rq_lock
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230313204825.2665483-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d24c0144
    • Namhyung Kim's avatar
      perf lock contention: Track and show siglock with address · 1811e827
      Namhyung Kim authored
      Likewise, we can display siglock by following the pointer like
      current->sighand->siglock.
      
        $ sudo ./perf lock con -abl -- sleep 1
         contended   total wait     max wait     avg wait            address   symbol
      
                16      2.18 ms    305.35 us    136.34 us   ffffffff92e06080   tasklist_lock
                28    521.78 us     31.16 us     18.63 us   ffff8cc703783ec4
                 7    119.03 us     23.55 us     17.00 us   ffff8ccb92479440
                15     88.29 us     10.06 us      5.89 us   ffff8cd560b5f380   siglock
                 7     37.67 us      9.16 us      5.38 us   ffff8d053daf0c80
                 5      8.81 us      4.92 us      1.76 us   ffff8d053d6b0c80
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230313204825.2665483-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1811e827
    • Namhyung Kim's avatar
      perf lock contention: Track and show mmap_lock with address · 3ace2435
      Namhyung Kim authored
      Sometimes there are severe contentions on the mmap_lock and we want
      see it in the -l/--lock-addr output.  However it cannot symbolize
      the mmap_lock because it's allocated dynamically without symbols.
      
      Stephane and Hao gave me an idea separately to display mmap_lock by
      following the current->mm pointer.  I added a flag to mark mmap_lock
      after comparing the lock address so that it can show them differently.
      With this change it can show mmap_lock like below:
      
        $ sudo ./perf lock con -abl -- sleep 10
         contended   total wait     max wait     avg wait            address   symbol
         ...
             16344    312.30 ms      2.22 ms     19.11 us   ffff8cc702595640
             17686    310.08 ms      1.49 ms     17.53 us   ffff8cc7025952c0
                 3     84.14 ms     45.79 ms     28.05 ms   ffff8cc78114c478   mmap_lock
              3557     76.80 ms     68.75 us     21.59 us   ffff8cc77ca3af58
                 1     68.27 ms     68.27 ms     68.27 ms   ffff8cda745dfd70
                 9     54.53 ms      7.96 ms      6.06 ms   ffff8cc7642a48b8   mmap_lock
             14629     44.01 ms     60.00 us      3.01 us   ffff8cc7625f9ca0
              3481     42.63 ms    140.71 us     12.24 us   ffffffff937906ac   vmap_area_lock
             16194     38.73 ms     42.15 us      2.39 us   ffff8cd397cbc560
                11     38.44 ms     10.39 ms      3.49 ms   ffff8ccd6d12fbb8   mmap_lock
                 1      5.43 ms      5.43 ms      5.43 ms   ffff8cd70018f0d8
              1674      5.38 ms    422.93 us      3.21 us   ffffffff92e06080   tasklist_lock
               581      4.51 ms    130.68 us      7.75 us   ffff8cc9b1259058
                 5      3.52 ms      1.27 ms    703.23 us   ffff8cc754510070
               112      3.47 ms     56.47 us     31.02 us   ffff8ccee38b3120
               381      3.31 ms     73.44 us      8.69 us   ffffffff93790690   purge_vmap_area_lock
               255      3.19 ms     36.35 us     12.49 us   ffff8d053ce30c80
      
      Note that mmap_lock was renamed some time ago and it needs to support
      old kernels with a different name 'mmap_sem'.
      Suggested-by: default avatarHao Luo <haoluo@google.com>
      Suggested-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230313204825.2665483-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ace2435
    • Ian Rogers's avatar
      perf build: Error if no libelf and NO_LIBELF isn't set · 8d98ca5c
      Ian Rogers authored
      Building without libelf support is going disable a lot of
      functionality. Require that the NO_LIBELF=1 build option is passed if
      this is intentional.
      
      Committer notes:
      
      Add NO_LIBELF=1 to the 'make_static' target in tools/perf/tests/make so
      that 'make -C tools/perf build-test' works.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d98ca5c
    • Ian Rogers's avatar
      perf build: Remove redundant NO_NEWT build option · f1925bd5
      Ian Rogers authored
      The option controlled nothing and no code depends, conditional or
      otherwise, on libnewt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1925bd5
    • Ian Rogers's avatar
      perf build: If libtraceevent isn't present error the build · 6898e60f
      Ian Rogers authored
      If libtraceevent isn't present, the build will warn and continue. This
      disables a number of features and so isn't desirable. This change
      makes the build error for this case. The build can still be made to
      happen by adding NO_LIBTRACEEVENT=1.
      
      Committer notes:
      
      Add NO_LIBTRACEEVENT=1 to the 'make_static' target in
      tools/perf/tests/make so that 'make -C tools/perf build-test' works.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6898e60f
    • Ian Rogers's avatar
      perf build: Switch libpfm4 to opt-out rather than opt-in · d7c4f89a
      Ian Rogers authored
      If libpfm4 passes the feature test, it would be nice to have it
      enabled rather than also requiring the LIBPFM4=1 build flag.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7c4f89a
    • Ian Rogers's avatar
      perf symbol: Add abi::__cxa_demangle C++ demangling support · 3b4e4efe
      Ian Rogers authored
      Refactor C++ demangling out of symbol-elf into its own files similar
      to other languages. Add abi::__cxa_demangle support. As the other
      demanglers are not shippable with distributions, this brings back C++
      demangling in a common case. It isn't perfect as the support for
      optionally demangling arguments and modifiers isn't present.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3b4e4efe
    • Ian Rogers's avatar
      tools build: Add feature test for abi::__cxa_demangle · 4c72e2b3
      Ian Rogers authored
      cxxabi.h is part of libsdtc++ and LLVM's libcxx, providing
      abi::__cxa_demangle a portable C++ demangler. Add a feature test to
      detect that the function is available.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c72e2b3
    • Ian Rogers's avatar
      perf build: Make binutil libraries opt in · dd317df0
      Ian Rogers authored
      binutils is GPLv3 so distributions cannot ship perf linked against
      libbfd and libiberty as the licenses are incompatible. Rather than
      defaulting the build to opting in to libbfd and libiberty support and
      opting out via NO_LIBBFD=1 and NO_DEMANGLE=1, make building against
      the libraries optional and enabled with BUILD_NONDISTRO=1.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd317df0
    • Ian Rogers's avatar
      perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set · 175f9315
      Ian Rogers authored
      Rather than disabling jevents if a sufficient python isn't present
      error in the build. This avoids the build progressing but the binary
      being degraded. The build can still succeed by specifying NO_JEVENTS=1
      to the build and this is conveyed in the error message.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      175f9315