Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp239840rwn; Thu, 8 Sep 2022 00:21:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DgPGIq3TgW/2G0mCoMMwT6quHN7a+QL53vW78rdlCWDNGoiUHcUGiM9zIYat6ru0gkDly X-Received: by 2002:a17:907:3f15:b0:741:7ab9:1c5a with SMTP id hq21-20020a1709073f1500b007417ab91c5amr4835973ejc.369.1662621663805; Thu, 08 Sep 2022 00:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662621663; cv=none; d=google.com; s=arc-20160816; b=r6DZ75UMwDtWVPEyM1tR9VzjJD/FndxYzfKL7lt7oQQ0hLNBwmRbmEMVNdnMP97zVQ n+YU65CJFG0JM5EC1YMcFguJE8VKmcyAnjanSsknhb12OddQ+ksX9ObLUg6jCvZbVFzB gITD402Wm4v6HzQf8eo5GSidOTDxkfcBE1GMDTMTHtwP6fko0oah0J/4UVZLICbJiXdY fSLv/Uw5yzpmodY+AD2U3S9l9aizHL8Zki3WyyYevxCsIzKKvGJAifKil1k9Lhpn9BiQ c92Z7PafU/oHH0Yen76lkrkvp5s15t/PA+INDGVS/0TfGq68vrWwpUDYa/uxIuL5pyR7 07mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iaqZ9rLzYzI/HQrbLeMS8WMxM5H5jsnGIqj76j8lSlo=; b=VuuVT0vstB7ZMTa10Af+wVab7GE28qRvs6eccdUimeUdpr1ICZZ0IVAkjORbg3ZySQ 0hBf9c0RzonNlq0t1yr8tM/aqoMT81B396LAmPHWozgFmxZzPUqJzYx4t+F2Zf3/Whlp PGUSY3XIhib4Kg4KkFwFtdbrI9bgkwrJP9FjmS5buASko+WlaOtkUh3GFaAiASPHk8xx i4HDegCbwE22UKTirgmKRA870A+v6EHACNMSqHjdLLx+c9N748GuxA/fTqYeqJRAPAVw E+wC5pcDSWG9fbY98moipr+d7yZyX4QaHW5jn/ZYrzhJUfls9pUu+lVImcqY9vddlHu3 /UxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="JWA/ssv+"; 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 a17-20020aa7d751000000b0044eb862958esi6257870eds.401.2022.09.08.00.20.38; Thu, 08 Sep 2022 00:21:03 -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="JWA/ssv+"; 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 S230401AbiIHG7a (ORCPT + 99 others); Thu, 8 Sep 2022 02:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiIHG72 (ORCPT ); Thu, 8 Sep 2022 02:59:28 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 219E02E7; Wed, 7 Sep 2022 23:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662620362; x=1694156362; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jpVU4iOl8VZsAtBVAq669SyX2EvKQ/EEeFGahcq39aA=; b=JWA/ssv+e+tp3YprsRxl21JzU4dAcuv4Ieb7uuxStdhmj3rGg9+2Vpvv kN6aoOHRwozY78wsPosAuJa3UvJm9fy+glS/0D1qThkg+xmjt6iA9cyyg F0kxCJTC0SB/zXRby4+MqiBBMW8Qn6IbCS842VhWA8bbcZocPJA+KS9xT kmoNOycaQwDJ65FnfdZTxmzoJNtS6A2l4Zmrna65s1YU+lceeTCibWRbX o2Of02mfXy9CuqbysZVTFn3YsPsQGGuVZlSjg1If2vB8VfnlRpwuIZsTC 5EZ4ygTDLgWIsMEBrjdWE3qMpZCBJkh+ewMeS6yyEA1XRoNbRkpoCsDZ6 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="383381602" X-IronPort-AV: E=Sophos;i="5.93,299,1654585200"; d="scan'208";a="383381602" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 23:59:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,299,1654585200"; d="scan'208";a="610586177" Received: from zxingrtx.sh.intel.com ([10.239.159.110]) by orsmga007.jf.intel.com with ESMTP; 07 Sep 2022 23:59:18 -0700 From: zhengjun.xing@linux.intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@intel.com, jolsa@kernel.org, namhyung@kernel.org Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, irogers@google.com, ak@linux.intel.com, kan.liang@linux.intel.com, zhengjun.xing@linux.intel.com Subject: [PATCH] perf script: Fix Cannot print 'iregs' field for hybrid systems Date: Thu, 8 Sep 2022 15:00:30 +0800 Message-Id: <20220908070030.3455164-1-zhengjun.xing@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 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 --- 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