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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3aa4c863-24cc-9fdf-9960-2b1983b3322b@linux.intel.com>
Date:   Wed, 7 Sep 2022 10:49:01 +0800
From:   Xing Zhengjun <zhengjun.xing@...ux.intel.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>
Cc:     Hongtao Yu <hoy@...com>, Namhyung Kim <namhyung@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        linux-perf-users@...r.kernel.org,
        "Liang, Kan" <kan.liang@...ux.intel.com>
Subject: Re: [PATCH] perf script: Skip dummy event attr check

Hi,

On 9/1/2022 12:23 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 31, 2022 at 09:02:46AM -0700, Ian Rogers escreveu:
>> On Wed, Aug 31, 2022 at 5:40 AM Jiri Olsa <jolsa@...nel.org> wrote:
>>>
>>> Hongtao Yu reported problem when displaying uregs in perf script
>>> for system wide perf.data:
>>>
>>>    # perf script -F uregs | head -10
>>>    Samples for 'dummy:HG' event do not have UREGS attribute set. Cannot print 'uregs' field.
>>>
>>> The problem is the extra dummy event added for system wide,
>>> which does not have proper sample_type setup.
>>>
>>> Skipping attr check completely for dummy event as suggested
>>> by Namhyung, because it does not have any samples anyway.
>>>
>>> Reported-by: Hongtao Yu <hoy@...com>
>>> Suggested-by: Namhyung Kim <namhyung@...nel.org>
>>> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
>>
>> Acked-by: Ian Rogers <irogers@...gle.com>
> 
> Thanks, applied to perf/urgent.
> 
> - Arnaldo

I have met a similar issue on hybrid systems such as ADL, I apply the 
patch, and it works OK for the normal mode.
  # ./perf record  --intr-regs=di,r8,dx,cx -e 
br_inst_retired.near_call:p -c 1000 --per-thread true
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.024 MB perf.data (25 samples) ]

# ./perf script -F iregs |head -5
  ABI:2    CX:0xffff90e19d024ed8    DX:0x1    DI:0xffff90e19d024ed8 
R8:0xffffba5e437e7b30
  ABI:2    CX:0x7f5239783000    DX:0x80000000    DI:0xffff90e1801eea00 
  R8:0x71
  ABI:2    CX:0x40    DX:0x60    DI:0xffffffff9fde5ab8    R8:0x40
  ABI:2    CX:0x0    DX:0xffffffffffffffff    DI:0xffff90e1877408e8 
R8:0x1
  ABI:2    CX:0xcc0    DX:0x1    DI:0xffff90e187d17c60    R8:0x40

But the issue still happened when running the test in the pipe mode. In 
the pipe mode, it calls process_attr() which still checks the attr for 
the dummy event, so the issue happened.

  # ./perf record -o - --intr-regs=di,r8,dx,cx -e 
br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf 
script -F iregs |head -5
Samples for 'dummy:HG' event do not have IREGS attribute set. Cannot 
print 'iregs' field.
0x120 [0x90]: failed to process type: 64

I have one test patch which can fix the pipe mode issue.

  ./perf record -o - --intr-regs=di,r8,dx,cx -e 
br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf 
script -F iregs |head -5
  ABI:2    CX:0xffff90e18119e278    DX:0x0    DI:0xffff90e18119f858 
R8:0xffff90e18119e278
  ABI:2    CX:0x0    DX:0x1    DI:0xfffffa2844a91580    R8:0x402
  ABI:2    CX:0x0    DX:0x0    DI:0x100cca    R8:0x0
  ABI:2    CX:0x0    DX:0x0    DI:0xffffffff9e997ca5    R8:0x0
  ABI:2    CX:0x113ce8000    DX:0xffff90e198f46600 
DI:0xffff90e189de8000    R8:0x290


Fixes: b91e5492f9d7 ("perf record: Add a dummy event on hybrid systems 
to collect metadata records")
Signed-off-by: Zhengjun Xing <zhengjun.xing@...ux.intel.com>
---
  tools/perf/builtin-script.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 9152e3e45b69..2d863cdb19fe 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2429,6 +2429,8 @@ static int process_attr(struct perf_tool *tool, 
union perf_event *event,
         }

         if (evsel->core.attr.sample_type) {
+               if (evsel__is_dummy_event(evsel))
+                       return 0;
                 err = evsel__check_attr(evsel, scr->session);
                 if (err)
                         return err;
--
2.25.1

-- 
Zhengjun Xing

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ