Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3985409pxb; Mon, 21 Feb 2022 09:34:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzFkiVcww2hPWeFyU0pUTTIx3HMpWpkOiBAgNzmirlKtDY1+Y7+nJmStmrY7h/4tBKY/e8 X-Received: by 2002:a17:902:9886:b0:14d:a230:d41 with SMTP id s6-20020a170902988600b0014da2300d41mr19323874plp.159.1645464882087; Mon, 21 Feb 2022 09:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645464882; cv=none; d=google.com; s=arc-20160816; b=N2JczYPB20WhMgdvZqRTxyGY/YVOTVs2k/4TVdpWXpsZ6vDeHDasoVBkvy/bvPtpI0 FMSgK3rUtbn2JbRCsXpt/V9N6w3LM5KEARHYxc3RCyHA2D55zVCmnwJgkjJDB9SdMykU weCk080QBQLVYID+06AosLflVAQWrKDuzoLw/owfnmdq4S1790Q42qQ6GvVLiAqZceOk NRymE8L6LpgULJzhS82na480k5dNkMQEPlXWYXnlzza3vZRk2kHPN1LDUyIvz/wWetMs OISYTeCS2EimiEwcBCiGvJ4nzkCu67Tb77JklKwQgL7UaofiZnjPgy4AFgT3mj3Sv7wz jjbw== 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; bh=YsUCuPrA7rw3+oo/AI3jhHC/IrHFznVhpu2oVYSlaCY=; b=iJmfLKe0da6Gj61N3y9tBNp4y8AXkPUTbKn96isrhPRx9P4Xy/AUdR3SOKXuNmR0zw QpDPT0naC6ah1q6pByCiVRW+0SLAwUx0hDBxu7Ahx5w91iF4OkBheU2jtMwWsaWTq2kV K32/1H8MMSPuQxH/cHEux6HOLR/clIa/w/NFFMVbUTdkpRM4Z9CEd4r6mCfzwvpIBktv ihy9+pdoWaoJeemE+/zQjwSGmiiUEge13FoCxNFWlp0Kt3FN9mySJySiCD11G4WUCoVw QYHX2BME1hLRsr+Uv+R8rWEEgGPTMmr53cCQZQEFfqIKOIFGtqrvlvEQUK+Xdnby1uQI yKRg== 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7si2477287pll.318.2022.02.21.09.34.24; Mon, 21 Feb 2022 09:34:42 -0800 (PST) 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353174AbiBURS2 (ORCPT + 99 others); Mon, 21 Feb 2022 12:18:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381611AbiBURSB (ORCPT ); Mon, 21 Feb 2022 12:18:01 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9C53275EB; Mon, 21 Feb 2022 09:17:20 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A586F1042; Mon, 21 Feb 2022 09:17:20 -0800 (PST) Received: from ip-10-252-15-108.eu-west-1.compute.internal (unknown [10.252.15.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3CA1E3F70D; Mon, 21 Feb 2022 09:17:19 -0800 (PST) From: German Gomez To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Cc: German Gomez , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim Subject: [PATCH] perf script: Fix error when printing 'weight' field Date: Mon, 21 Feb 2022 17:17:06 +0000 Message-Id: <20220221171707.62960-1-german.gomez@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, 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 In SPE traces the 'weight' field can't be printed in perf-script because the 'dummy:u' event doesn't have the WEIGHT attribute set. Use evsel__do_check_stype(..) to check this field, as it's done with other fields such as "phys_addr". Before: $ perf record -e arm_spe_0// -- sleep 1 $ perf script -F event,ip,weight Samples for 'dummy:u' event do not have WEIGHT attribute set. Cannot print 'weight' field. After: $ perf script -F event,ip,weight l1d-access: 12 ffffaf629d4cb320 tlb-access: 12 ffffaf629d4cb320 memory: 12 ffffaf629d4cb320 Fixes: b0fde9c6e291 ("perf arm-spe: Add SPE total latency as PERF_SAMPLE_WEIGHT") Signed-off-by: German Gomez --- tools/perf/builtin-script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 9e032343f..6ce581067 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -463,7 +463,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) return -EINVAL; if (PRINT_FIELD(WEIGHT) && - evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT)) + evsel__do_check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT, allow_user_set)) return -EINVAL; if (PRINT_FIELD(SYM) && -- 2.25.1