Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp299505rwn; Thu, 8 Sep 2022 01:36:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR6avbBWHV8Ax6vUhiR+sKoXwhDWKefgKtgRzc00fyG4lLiXXwotNjg6SNgbwf+O8Dh+FZOA X-Received: by 2002:a17:906:eecb:b0:73c:5bcb:8eb3 with SMTP id wu11-20020a170906eecb00b0073c5bcb8eb3mr5193753ejb.284.1662626186982; Thu, 08 Sep 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662626186; cv=none; d=google.com; s=arc-20160816; b=eC65Tl5pxLGAPVx1pwrjukbkit6tJStn6SmN9scrkFAapWEgJLyacvl+nyCav+NdWv KomqUG1bpEtew6Q2WsvEdEsqOAgfkFAeokvXTHrjmlKcWO2izb3pDmFnhDnohe8G4V8Q 56qm5WndNClAbNdaVZg9hY+pxfzY9CDYAZJm0Hq5ahItbb67XE8/uBit0i5+7zQRTGYL OlTYyKqxVBMTVDPwRpQ1QArurznzhJmJUhnoceQC/zitC8vKt4CE9dw42vAbpdZo/M3A Z4XgZskqDQHy8I8jiEckKbASTOaS4cCvWnt5O6g9EpEEIo2Yy8XP+tZg3zFSaybK7GE0 pcvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=/ohG8DwSItaCcxoY9t3BLCfb93uhCkZwCq+xnGDP9xw=; b=v2kb/Af40/BQcrcMduoHem6Hgvio/Rdtx1xwIFKxuJwPjXSv98KfL8pKBVUbvFFpun 2eXVTIRjWOBkAq3ZRl8zXmIzr6PiEP6ylH81SGNayBvel9PZmM/I++gt+muyIeYX6hWY X4418OOW1ppIr70AIp0J/ZWdRT/5NPD7yFc6GPvcsGt04zSGU/EhlQUouDpPbqYGnI4p eLdIugWHepiTDkll8sSlVFybl5FwCWl0oBWmsOJ9Rr3SsBIq2As6NiTLpXvbeTGjqtmT +8GLg36YP6GxpBM1VqO3GOBbE41/wXvVTwxVIiZdznIYKxH0xlOD5wGc7gXc+zxwnBz5 ODhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bqMso4RQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a1709062a5600b0077084928a21si1292095eje.143.2022.09.08.01.36.02; Thu, 08 Sep 2022 01:36:26 -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=@gmail.com header.s=20210112 header.b=bqMso4RQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbiIHIYf (ORCPT + 99 others); Thu, 8 Sep 2022 04:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbiIHIYc (ORCPT ); Thu, 8 Sep 2022 04:24:32 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 633E6DEC0; Thu, 8 Sep 2022 01:24:31 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id n17-20020a05600c3b9100b003b3235574dbso749256wms.2; Thu, 08 Sep 2022 01:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date; bh=/ohG8DwSItaCcxoY9t3BLCfb93uhCkZwCq+xnGDP9xw=; b=bqMso4RQbyQNgYUzQ+4Fk4CQujHDZMJZEIazWNBBqm6nqaRQTwEKcVjipeg6l3pIhu KUw2ysMcisuVn97nTzRcaSgNllcVT9V4hTpIRmFC0j3Q4sqVY8oWyCJqhSw/5jySrQmb 2dKnjeAIVdtbmEcJD3+GT3dqhiI6sWGZEJWgFj00T74Wj9jKrc1Vm9zDb+zf/utFUd0W zpKxx2omRme6eRaZc3Q3X0VmyyFwf+IJGvkoKxEAfhoO6Y6iqVBFYe9nqeQUmP6R+lDQ w7IDZzD+tjGXzkV3Y86F12C6gnLuOy5+/tNE5RgB3ue9qID/ur9+g8UuB7PQ1ZM84yXo XARg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date; bh=/ohG8DwSItaCcxoY9t3BLCfb93uhCkZwCq+xnGDP9xw=; b=CKGfuy/W3En2U4jdPsinmTNXzJRqIpDq4XYhuLRXlUWpOckcvZAUaxY4/EnGII4JdM 9o3qbXE3w/X31FoA4u6AcbXF6OShnYxwkjphk/2qP+2uMDrGOmEO9weH+jogBDZCYsEr 6SFRaTBisFLBHFT+74rFo7xGr9wZozhCFJzwUBi4W1h0Seur9693RoPDNVFJDXDJDnzE iWxTr6VxdQFKY3lFmpMGO+0McvBNZsqEljIr3iSVCjlPXse5/7Q8lz5rAg/nlkgLY75P SQ+R2WjCb7KS5XHN6TIzkc6PffWZuPWovkbVagNO+DbRPalRZAvVK1IIGZdi0584kQpX w1XA== X-Gm-Message-State: ACgBeo3n0qvJrFQqdH6Eg17VC92nhy2vc9bAs9zCFjDUKbuZeVmtqzgT 1GKVasg5fAR89PFXmg8wdTQ= X-Received: by 2002:a7b:ce10:0:b0:3a5:3f91:e2fb with SMTP id m16-20020a7bce10000000b003a53f91e2fbmr1472519wmc.138.1662625469786; Thu, 08 Sep 2022 01:24:29 -0700 (PDT) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id n6-20020a05600c3b8600b003a846a014c1sm1926257wms.23.2022.09.08.01.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 01:24:29 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 8 Sep 2022 10:24:27 +0200 To: zhengjun.xing@linux.intel.com Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, irogers@google.com, ak@linux.intel.com, kan.liang@linux.intel.com Subject: Re: [PATCH] perf script: Fix Cannot print 'iregs' field for hybrid systems Message-ID: References: <20220908070030.3455164-1-zhengjun.xing@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220908070030.3455164-1-zhengjun.xing@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Thu, Sep 08, 2022 at 03:00:30PM +0800, zhengjun.xing@linux.intel.com wrote: > From: Zhengjun Xing > > Commit b91e5492f9d7 ("perf record: Add a dummy event on hybrid systems to > collect metadata records") adds a dummy event on hybrid systems to fix the > symbol "unknown" issue when the workload is created in a P-core but runs > on an E-core. The added dummy event will cause "perf script -F iregs" to > fail. Dummy events do not have "iregs" attribute set, so when we do > evsel__check_attr, the "iregs" attribute check will fail, so the issue > happened. > > The following commit [1] has fixed a similar issue by skipping the attr > check for the dummy event because it does not have any samples anyway. It > works okay for the normal mode, 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. This commit fixed the issue by > skipping the attr check for the dummy event in the API evsel__check_attr, > Otherwise, we have to patch everywhere when evsel__check_attr() is called. > > Before: > > #./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 > > After: > > # ./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:0x55b8efa87000 DX:0x55b8efa7e000 DI:0xffffba5e625efbb0 R8:0xffff90e51f8ae100 > ABI:2 CX:0x7f1dae1e4000 DX:0xd0 DI:0xffff90e18c675ac0 R8:0x71 > ABI:2 CX:0xcc0 DX:0x1 DI:0xffff90e199880240 R8:0x0 > ABI:2 CX:0xffff90e180dd7500 DX:0xffff90e180dd7500 DI:0xffff90e180043500 R8:0x1 > ABI:2 CX:0x50 DX:0xffff90e18c583bd0 DI:0xffff90e1998803c0 R8:0x58 > > [1]https://lore.kernel.org/lkml/20220831124041.219925-1-jolsa@kernel.org/ > > Fixes: b91e5492f9d7 ("perf record: Add a dummy event on hybrid systems to collect metadata records") > > Signed-off-by: Zhengjun Xing > Suggested-by: Namhyung Kim Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/builtin-script.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c > index 585171479876..1a8790385eba 100644 > --- a/tools/perf/builtin-script.c > +++ b/tools/perf/builtin-script.c > @@ -445,6 +445,9 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) > struct perf_event_attr *attr = &evsel->core.attr; > bool allow_user_set; > > + if (evsel__is_dummy_event(evsel)) > + return 0; > + > if (perf_header__has_feat(&session->header, HEADER_STAT)) > return 0; > > -- > 2.25.1 >