1. 23 5月, 2023 5 次提交
  2. 18 5月, 2023 2 次提交
    • R
      perf: Skip and warn on unknown format 'configN' attrs · c64f5abf
      Rob Herring 提交于
      stable inclusion
      from stable-v5.10.152
      commit ca4c49838278344854792bec2645b01e50471ccf
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I73HJ0
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ca4c49838278344854792bec2645b01e50471ccf
      
      --------------------------------
      
      [ Upstream commit e552b7be ]
      
      If the kernel exposes a new perf_event_attr field in a format attr, perf
      will return an error stating the specified PMU can't be found. For
      example, a format attr with 'config3:0-63' causes an error as config3 is
      unknown to perf. This causes a compatibility issue between a newer
      kernel with older perf tool.
      
      Before this change with a kernel adding 'config3' I get:
      
        $ perf record -e arm_spe// -- true
        event syntax error: 'arm_spe//'
                             \___ Cannot find PMU `arm_spe'. Missing kernel support?
        Run 'perf list' for a list of valid events
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event selector. use 'perf list' to list
        available events
      
      After this change, I get:
      
        $ perf record -e arm_spe// -- true
        WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf!
        [ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.091 MB perf.data ]
      
      To support unknown configN formats, rework the YACC implementation to
      pass any config[0-9]+ format to perf_pmu__new_format() to handle with a
      warning.
      Reviewed-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      Tested-by: NLeo Yan <leo.yan@linaro.org>
      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: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v4-1-83c098e6212e@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
      c64f5abf
    • J
      perf pmu: Validate raw event with sysfs exported format bits · 1b849a1b
      Jin Yao 提交于
      stable inclusion
      from stable-v5.10.152
      commit dea47fefa6aa87256c8a46137c742060940a4197
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I73HJ0
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=dea47fefa6aa87256c8a46137c742060940a4197
      
      --------------------------------
      
      [ Upstream commit e4064776 ]
      
      A raw PMU event (eventsel+umask) in the form of rNNN is supported
      by perf but lacks of checking for the validity of raw encoding.
      
      For example, bit 16 and bit 17 are not valid on KBL but perf doesn't
      report warning when encoding with these bits.
      
      Before:
      
        # ./perf stat -e cpu/r031234/ -a -- sleep 1
      
         Performance counter stats for 'system wide':
      
                         0      cpu/r031234/
      
               1.003798924 seconds time elapsed
      
      It may silently measure the wrong event!
      
      The kernel supported bits have been exported through
      /sys/devices/<pmu>/format/. Perf collects the information to
      'struct perf_pmu_format' and links it to 'pmu->format' list.
      
      The 'struct perf_pmu_format' has a bitmap which records the
      valid bits for this format. For example,
      
        root@kbl-ppc:/sys/devices/cpu/format# cat umask
        config:8-15
      
      The valid bits (bit8-bit15) are recorded in bitmap of format 'umask'.
      
      We collect total valid bits of all formats, save to a local variable
      'masks' and reverse it. Now '~masks' represents total invalid bits.
      
      bits = config & ~masks;
      
      The set bits in 'bits' indicate the invalid bits used in config.
      Finally we use bitmap_scnprintf to report the invalid bits.
      
      Some architectures may not export supported bits through sysfs,
      so if masks is 0, perf_pmu__warn_invalid_config directly returns.
      
      After:
      
      Single event without name:
      
        # ./perf stat -e cpu/r031234/ -a -- sleep 1
        WARNING: event 'N/A' not valid (bits 16-17 of config '31234' not supported by kernel)!
      
         Performance counter stats for 'system wide':
      
                         0      cpu/r031234/
      
               1.001597373 seconds time elapsed
      
      Multiple events with names:
      
        # ./perf stat -e cpu/rf01234,name=aaa/,cpu/r031234,name=bbb/ -a -- sleep 1
        WARNING: event 'aaa' not valid (bits 20,22 of config 'f01234' not supported by kernel)!
        WARNING: event 'bbb' not valid (bits 16-17 of config '31234' not supported by kernel)!
      
         Performance counter stats for 'system wide':
      
                         0      aaa
                         0      bbb
      
               1.001573787 seconds time elapsed
      
      Warnings are reported for invalid bits.
      Co-developed-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Reviewed-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210310051138.12154-1-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Stable-dep-of: e552b7be ("perf: Skip and warn on unknown format 'configN' attrs")
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
      
      Conflicts:
      	tools/perf/util/pmu.c
      	tools/perf/util/pmu.h
      1b849a1b
  3. 17 5月, 2023 2 次提交
  4. 20 4月, 2023 2 次提交
  5. 19 4月, 2023 7 次提交
  6. 15 4月, 2023 1 次提交
  7. 04 4月, 2023 1 次提交
  8. 28 3月, 2023 5 次提交
  9. 17 3月, 2023 1 次提交
  10. 08 3月, 2023 2 次提交
  11. 06 3月, 2023 2 次提交
  12. 01 3月, 2023 2 次提交
  13. 28 2月, 2023 2 次提交
  14. 17 2月, 2023 6 次提交
新手
引导
客服 返回
顶部