lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXNnDrGKXbEELMXV@kernel.org>
Date:   Fri, 8 Dec 2023 15:57:18 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Kan Liang <kan.liang@...ux.intel.com>,
        Ian Rogers <irogers@...gle.com>
Cc:     Mark Rutland <mark.rutland@....com>, Marc Zyngier <maz@...nel.org>,
        Hector Martin <marcan@...can.st>,
        Namhyung Kim <namhyung@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-perf-users@...r.kernel.org
Subject: 'perf top' broken on intel hybrid systems

Hi,

	So I finally got a recent Intel hybrid system:

root@...ora:~# grep -m1 "model name" /proc/cpuinfo
model name	: Intel(R) Core(TM) i7-14700K
root@...ora:~#

	Most things work, but:

root@...ora:~# perf top

Error:
The cycles:P event is not supported.
root@...ora:~#

root@...ora:~# perf top -e cycles:p
Error:
The cycles:p event is not supported.
root@...ora:~# perf top -e cycles:pp
Error:
The cycles:pp event is not supported.
^[[Aroot@...ora:~# perf top -e cycles:ppp
Error:
The cycles:ppp event is not supported.
root@...ora:~#
root@...ora:~# perf top -e cycles
Error:
The cycles event is not supported.
root@...ora:~#

root@...ora:~# perf top -e instructions
Error:
The instructions event is not supported.
root@...ora:~#root@...ora:~# perf top -e cache-misses
Error:
The cache-misses event is not supported.
root@...ora:~#

------------------------------------------------------------
perf_event_attr:
  type                             0 (PERF_TYPE_HARDWARE)
  size                             136
  config                           0xa00000000
  { sample_period, sample_freq }   4000
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD
  read_format                      ID|LOST
  disabled                         1
  inherit                          1
  mmap                             1
  comm                             1
  freq                             1
  task                             1
  sample_id_all                    1
  exclude_guest                    1
  mmap2                            1
  comm_exec                        1
  ksymbol                          1
  bpf_event                        1
------------------------------------------------------------
sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
sys_perf_event_open failed, error -2
Error:
The cycles event is not supported.
root@...ora:~#

But...

root@...ora:~# perf record
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 2.631 MB perf.data (24079 samples) ]

root@...ora:~# perf evlist -v
cpu_atom/cycles:P/: type: 0 (PERF_TYPE_HARDWARE), size: 136, config: 0xa00000000, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID|LOST, disabled: 1, inherit: 1, freq: 1, precise_ip: 3, sample_id_all: 1
cpu_core/cycles:P/: type: 0 (PERF_TYPE_HARDWARE), size: 136, config: 0x400000000, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID|LOST, disabled: 1, inherit: 1, freq: 1, precise_ip: 3, sample_id_all: 1
dummy:u: type: 1 (PERF_TYPE_SOFTWARE), size: 136, config: 0x9 (PERF_COUNT_SW_DUMMY), { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID|LOST, inherit: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
root@...ora:~#


root@...ora:~# perf top -e cpu_core/cpu-cycles:P/
event syntax error: 'cpu_core/cpu-cycles:P/'
                              \___ Bad event or PMU

Unable to find PMU or event on a PMU of 'cpu_core'

Initial error:
event syntax error: 'cpu_core/cpu-cycles:P/'
                              \___ unknown term 'cpu-cycles:P' for pmu 'cpu_core'

valid terms: event,pc,edge,offcore_rsp,ldlat,inv,umask,frontend,cmask,config,config1,config2,config3,name,period,freq,branch_type,time,call-graph,stack-size,no-inherit,inherit,max-stack,nr,no-overwrite,overwrite,driver-config,percore,aux-output,aux-sample-size,metric-id,raw,legacy-cache,hardware
Run 'perf list' for a list of valid events

 Usage: perf top [<options>]

    -e, --event <event>   event selector. use 'perf list' to list available events
root@...ora:~#

So it seems its just 'perf top' breakage:

root@...ora:~# perf top -e cpu_core/cpu-cycles/
Error:
The cpu_core/cpu-cycles/ event is not supported.
root@...ora:~# perf top -e cpu_atom/cpu-cycles/
Error:
The cpu_atom/cpu-cycles/ event is not supported.
root@...ora:~#

I bisected this to:

⬢[acme@...lbox perf-tools-next]$ git bisect good
251aa040244a3b17068e4e6ec61f138d7e50681a is the first bad commit
commit 251aa040244a3b17068e4e6ec61f138d7e50681a
Author: Ian Rogers <irogers@...gle.com>
Date:   Thu Jun 1 01:29:53 2023 -0700

    perf parse-events: Wildcard most "numeric" events

    Numeric events are either raw events or those with ABI defined numbers
    matched by the lexer. PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events
    should wildcard match on hybrid systems. So "cycles" should match each
    PMU type with an extended type, not just PERF_TYPE_HARDWARE.

    Change wildcard matching to add the event even if wildcard PMU
    scanning fails, there will be no extended type but this best matches
    previous behavior.

    Only set the extended type when the event type supports it and when
    perf_pmus__supports_extended_type is true. This new function returns
    true if >1 core PMU and avoids potential errors on older kernels.

    Modify evsel__compute_group_pmu_name using a helper
    perf_pmu__is_software to determine when grouping should occur. Try to
    use PMUs, and evsel__find_pmu, as being more dependable than
    evsel->pmu_name.

    Set a parse events error if a hardware term's PMU lookup fails, to
    provide extra diagnostics.

    Fixes: 8bc75f699c141420 ("perf parse-events: Support wildcards on raw events")
    Reported-by: Kan Liang <kan.liang@...ux.intel.com>
    Signed-off-by: Ian Rogers <irogers@...gle.com>
    Tested-by: Kan Liang <kan.liang@...ux.intel.com>
    Cc: Adrian Hunter <adrian.hunter@...el.com>
    Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
    Cc: Ingo Molnar <mingo@...hat.com>
    Cc: Jiri Olsa <jolsa@...nel.org>
    Cc: Mark Rutland <mark.rutland@....com>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Cc: Peter Zijlstra <peterz@...radead.org>
    Cc: Ravi Bangoria <ravi.bangoria@....com>
    Cc: Rob Herring <robh@...nel.org>
    Cc: Thomas Richter <tmricht@...ux.ibm.com>
    Cc: Xing Zhengjun <zhengjun.xing@...ux.intel.com>
    Link: https://lore.kernel.org/r/20230601082954.754318-4-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

 tools/perf/util/parse-events.c | 104 +++++++++++++++++++++++++++++------------
 tools/perf/util/parse-events.y |  10 ++--
 tools/perf/util/pmu.c          |  16 +++++++
 tools/perf/util/pmu.h          |   5 ++
 tools/perf/util/pmus.c         |   5 ++
 tools/perf/util/pmus.h         |   1 +
 6 files changed, 106 insertions(+), 35 deletions(-)
⬢[acme@...lbox perf-tools-next]$

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ