Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5215077rwb; Tue, 6 Sep 2022 22:00:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LxciIfJjIHpdaVEUU8FLQ0iS4gl7ncjWisIwi9ku0rbD0uIx64zaSuf0bZ4vBBeIZTyr3 X-Received: by 2002:a05:6402:28cb:b0:43b:c6d7:ef92 with SMTP id ef11-20020a05640228cb00b0043bc6d7ef92mr1534765edb.333.1662526851033; Tue, 06 Sep 2022 22:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662526851; cv=none; d=google.com; s=arc-20160816; b=TV9LAZMlrPYOcXM/+mQVlkrP9JystJrQbeTRzZ/0IufDN+i/XIXUPnqID6THw7kxEc 1iH2Wst22waqeTke1PRZtMy9ShjC44NmET/f/MFyFJXxu2hM137iAyBDN0Z61R8RIgZS n5CtAdAe41sRyiegIGg0CVPwNinQWDSX40ZmhNr/3m4H0ct6w7dyPxOA5nb7Jwy3zeWP TyMnNSEQBSNiYc9QMMiG1XCMrlaKQ/02iNI9dppehjL8SpCcHXQAsApwLmKZ+537ZM62 cPoY5Zhgr9s32Ha6/eeqFRLVLz64pACV0G81HkKngkpJqWTumwcNMwuz4AVpA+wl575u 2OLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=+hb4KiQ5kfoaXxVbkb/vKbUjz/tUAwb2RSgxrzzGgOI=; b=0OsIAMWL9Lepwh9ZOx7lMYt9kAQk872ofpMwQMriKMEpT07gQ0qjNfrfp572bNWy0K O5zVnixupt65s2vlOYJfWdFaZyK7tXt5NMoZW8kgEEVcK/FR3marHdWnVZJx42HZlh50 OEBHzuC/57lL2EvJBt9/VOhEOjJymrf3UGjDgDPoFFzzFaGtv32NqxNb7Noyz3mZ/C96 N0OeI/1qfEFrCtyJeGexPa4J6r9eGd3/dgjdX4MZDyVBCZcuafpdJcYNhxCLmY4il30I SqW18MmleztKd7Y/X2prRNoUQnBKyWuGHVKfJTG9rGEctaSb3n77qwI7zeFFlnmEMUIy Llvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc20-20020a1709071c1400b007313314bb73si3382315ejc.806.2022.09.06.22.00.24; Tue, 06 Sep 2022 22:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbiIGEu7 (ORCPT + 99 others); Wed, 7 Sep 2022 00:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiIGEu6 (ORCPT ); Wed, 7 Sep 2022 00:50:58 -0400 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36E98035E; Tue, 6 Sep 2022 21:50:57 -0700 (PDT) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-127f5411b9cso1967622fac.4; Tue, 06 Sep 2022 21:50:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=+hb4KiQ5kfoaXxVbkb/vKbUjz/tUAwb2RSgxrzzGgOI=; b=R0g1TvTqxIiWJ1L9zqRlL2CbuOiWD/3jhmcuaB75dPPtqFyPWAt3aNnUqQWbCs/kls Tfo2Es4ibUxKq+jSyHRLXJcz8gWhfCINts/QoQ8KlRRNtLEtFVj9JV5V2Y8e5nFslR5I gs4oSyEsCmQcqo1eYMQ4LsgOM5Kfvk+Tkuj4I408eg2pMI7HPW6BpQE+VBt39P6+dNyM QOrYcN1vSkX3zqjglWyJGF1Mr6rtDpUkSHtIyuU4R6ia/n05VKQqGdhC2YwIRISs309p H/xcB+7Fglz9lHo5p7M+CyI3CdKeFBEmPt1YB8KQRoNpNbfgWRrH+54b46JU97vh4i9K NoFA== X-Gm-Message-State: ACgBeo2GAK9F0bTJ60uiRm0H5S/Atzq/NVtHJFjmZnDOqLNK6xfgV1R2 S29PssvZZLMqKMGq8ijEBZchLHsqajg0wApaKyc= X-Received: by 2002:a05:6870:5b84:b0:10c:d1fa:2f52 with SMTP id em4-20020a0568705b8400b0010cd1fa2f52mr890078oab.92.1662526256949; Tue, 06 Sep 2022 21:50:56 -0700 (PDT) MIME-Version: 1.0 References: <20220831124041.219925-1-jolsa@kernel.org> <3aa4c863-24cc-9fdf-9960-2b1983b3322b@linux.intel.com> In-Reply-To: <3aa4c863-24cc-9fdf-9960-2b1983b3322b@linux.intel.com> From: Namhyung Kim Date: Tue, 6 Sep 2022 21:50:47 -0700 Message-ID: Subject: Re: [PATCH] perf script: Skip dummy event attr check To: Xing Zhengjun Cc: Arnaldo Carvalho de Melo , Ian Rogers , Jiri Olsa , Hongtao Yu , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users , "Liang, Kan" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, Sep 6, 2022 at 7:49 PM Xing Zhengjun wrote: > > 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 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 > >>> Suggested-by: Namhyung Kim > >>> Signed-off-by: Jiri Olsa > >> > >> Acked-by: Ian Rogers > > > > 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 > --- > 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; Maybe we can move this into evsel__check_attr(). Thanks, Namhyung > err = evsel__check_attr(evsel, scr->session); > if (err) > return err; > -- > 2.25.1 > > -- > Zhengjun Xing