Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5251343rwb; Tue, 6 Sep 2022 22:53:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UQk2pnMbq9qzZ1IJIK2CL4lE7LblWEoYC5Vf7nFy9hYv+6ghMHWnsecrSDx2Dr6Jy3M7Y X-Received: by 2002:a05:6402:4301:b0:448:d506:e2e5 with SMTP id m1-20020a056402430100b00448d506e2e5mr1625864edc.153.1662529999530; Tue, 06 Sep 2022 22:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662529999; cv=none; d=google.com; s=arc-20160816; b=QOO22LVOOPGvOdk1UIMPZRqeq+sXzVaurgdGcYlqkgNZhxOHWhV2TmeNSfKa1zgDs3 bwhd5lFtSPfFVu0ATeCiBdlnxbw2OS6ZSCj7Oh7X1ckQBf3KJ4rWquhcObmp/7hEcb5X 3u22xBcuSE3fInzwK+soIXbDNJj06BNaWYoqJahOa6VgWXo5TYvrdqcDK5wDiti1Xj67 8OYpm5FJtND/lHQKKI8onDrzn3FV5F+k8F2ubgO391GkIfEFl94ucRp/g8Yp4s6EGgvn 6ZvwH3JAbZzRKcT5tyfGz3L5ao8JJSigTco5T6jX6oT7dJ7bVIvWVC53M82vkxch2SHx cDGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=w/k8uArP0mMLaNaEmw6ANs480lgUcvxbJ6aCCJVMjwc=; b=RVTxZFk2Dm7ZjCGa6QoS0RKxrkXgKcVmlB3dB7o00OdmuQn+wBtqTM8BgTjyu3OkJH 7xyS+2Rrhk9TF2HwLO9lTYJOz7cvG2kXpw7O2IhAQLPC/9QyBq4HBI8dHB4e0r8S3m9R x05ObOA023inBd6ZkiyGAEqXwFkK1NiC5kwlGck+mDIZNYJOqInZkCb3kwqFnmw/QoQp 6hHenlnTR2HrX4AFekjTxMO5gMxEK0xtlveet5fde6f0C3R8gBrhKcpdJOEfc2btsisn g+Obioqxvu8jaaLI57QPHjWNzIjmQhK4kXp6Ojbg/62+DB7hFBTJg36zEZqYhiA/+/sJ LaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PZJmbRRF; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090699c300b0076febee8f6csi1958687ejn.886.2022.09.06.22.52.54; Tue, 06 Sep 2022 22:53:19 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=PZJmbRRF; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiIGFTm (ORCPT + 99 others); Wed, 7 Sep 2022 01:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiIGFTk (ORCPT ); Wed, 7 Sep 2022 01:19:40 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525406578; Tue, 6 Sep 2022 22:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662527978; x=1694063978; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=rN2sCIy/q49w+B3VQ4o0ZIAby9RVgbPnBx7iKkBemUI=; b=PZJmbRRFtC50mD3L60+7TyPwdDB6b8YFMfRq186DaLSnfe2tU0/VQ5W+ BxQSRDNz5krZlJ+1BXhcrvhRWyJRygFxKu+i0ssbY+dqNWdvWuj1iQMT8 aaCGbMbfJ1+Dvy8v5oVjAynBhTOR3BPhnB7lo6BNAriTyhXBxUg9ZBTLT z9fG+1n+7AiDgL2zSMEY13UpUKimKuL9CjCfvsCPXkqnXeXRRlHGtEeiX 2VUZdQGgqptHdYOwqtpBWYlThV25goUc6Ic4UrUL1TWTWtWAZ0ykDlPzW HgrL1mueRpvOtDj6ZyeZLWmUKAG19WuiAG4cxYXbbjQhFbUG4qo/fsYf+ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="296782261" X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="296782261" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 22:19:38 -0700 X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="942744229" Received: from xingzhen-mobl.ccr.corp.intel.com (HELO [10.238.4.113]) ([10.238.4.113]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 22:19:34 -0700 Message-ID: <78bedcf4-3ef8-2ccf-d846-74d0de0c67ad@linux.intel.com> Date: Wed, 7 Sep 2022 13:19:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] perf script: Skip dummy event attr check Content-Language: en-US To: Namhyung Kim 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" References: <20220831124041.219925-1-jolsa@kernel.org> <3aa4c863-24cc-9fdf-9960-2b1983b3322b@linux.intel.com> From: Xing Zhengjun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 9/7/2022 12:50 PM, Namhyung Kim wrote: > 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 Yes, the following changes in evsel__check_attr() can fix both normal and pipe mode issues, Otherwise, we have to patch everywhere when evsel__check_attr() is called. diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 13580a9c50b8..fb76e3191858 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -451,6 +451,9 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) allow_user_set = perf_header__has_feat(&session->header, HEADER_AUXTRACE); + if (evsel__is_dummy_event(evsel)) + allow_user_set = true; + if (PRINT_FIELD(TRACE) && !perf_session__has_traces(session, "record -R")) return -EINVAL; -- 2.25.1 > > >> err = evsel__check_attr(evsel, scr->session); >> if (err) >> return err; >> -- >> 2.25.1 >> >> -- >> Zhengjun Xing -- Zhengjun Xing