From patchwork Mon Dec 12 15:55:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 32429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2325404wrr; Mon, 12 Dec 2022 08:05:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+bRkDHmjX1xzda0Wa5zl7e29ovX3TcVKBDCffsc71Bbw7NrlSu4IZN1DJYfDtXwgSW6Kk X-Received: by 2002:a17:906:abcd:b0:7ad:2da5:36ec with SMTP id kq13-20020a170906abcd00b007ad2da536ecmr15151193ejb.41.1670861156063; Mon, 12 Dec 2022 08:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670861156; cv=none; d=google.com; s=arc-20160816; b=vFKqHP53Uzx6YnaCBFIW621BdfF5RssvF8ylRQekoh+QTJ5TXATEH04gTtU3t2YPjH SqGo4Uvj4TaBEnNmgZJ2YHfxHReR10T7+9dP5f0HnIWX23Q4uGK7HMMDBkRFbh83dUDY TF57pk2ByfqvRP8i9AgsysI0+mmiT4su2eiCXeXwjqStTw+2KUUmqHy+oMOpUoms92UG dj8fgELp9ELgOxIpUkggPVNOYdfXqY+T9Tkx5pQUsQ9e5MeipLjoEeo4Go0IxWWAGNZd gZHY4ovvv+LhXShPpXa8tw4YYVrVZa/VqZ5+4ETTgl9huR2YzctkzKrudunivBaCmsb5 hcTg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=e9zzCYLtBXw13x2mcYukb9TWHJyvI1Bb5Iv+FhBP1yA=; b=mdUF4NOscohvCGMFV/PWusMY1R2kWD/ZIDlpoV95x65Khxu7bLxlLEg/vOnCGrqjAa YuUh3P7fFWD1E9Sb1hW/CqDNwkmgTqvJC6HAAJlyzpwvz0LTLt1e17clCEHHAV0tcWab +mVwoIRVEic835FIA8zSsPsuJHGdSJX6JTyUQF9wvbzSJMZa1pnjeRkmCk+ulZ3NM+dh KwGXTDnlxPvQvFbmNRSRTMo7QDlOSc/okMZjhVOR4jmXAqnJnLiccppwc2BT1KmfVqie Y1iRkijI63S0GMEuybJaBkRx7HR54yKq3hsadiKRaZe/tB0BxFn7p7JVPLyV2Ia3sUIj nQtg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qc6-20020a170906d8a600b007ae5b41855fsi5174185ejb.895.2022.12.12.08.05.31; Mon, 12 Dec 2022 08:05:56 -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 S232624AbiLLPzp (ORCPT + 99 others); Mon, 12 Dec 2022 10:55:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232618AbiLLPzn (ORCPT ); Mon, 12 Dec 2022 10:55:43 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CC5064FA; Mon, 12 Dec 2022 07:55:43 -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 4D77B2F4; Mon, 12 Dec 2022 07:56:23 -0800 (PST) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4BBAA3F71E; Mon, 12 Dec 2022 07:55:40 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org Cc: Al.Grant@arm.com, James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , Mike Leach , Leo Yan , Mathieu Poirier , Suzuki K Poulose , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org Subject: [PATCH 1/5] perf: cs-etm: Print unknown header version as an error Date: Mon, 12 Dec 2022 15:55:09 +0000 Message-Id: <20221212155513.2259623-2-james.clark@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221212155513.2259623-1-james.clark@arm.com> References: <20221212155513.2259623-1-james.clark@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752024907674024472?= X-GMAIL-MSGID: =?utf-8?q?1752024907674024472?= This is an error rather than just for the raw trace dump so always print it as an error. Also remove the duplicate header version check. Signed-off-by: James Clark --- tools/perf/util/cs-etm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 16db965ac995..aeb1e30888db 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -2623,14 +2623,7 @@ static void cs_etm__print_auxtrace_info(__u64 *val, int num) { int i, cpu = 0, version, err; - /* bail out early on bad header version */ version = val[0]; - if (version > CS_HEADER_CURRENT_VERSION) { - /* failure.. return */ - fprintf(stdout, " Unknown Header Version = %x, ", version); - fprintf(stdout, "Version supported <= %x\n", CS_HEADER_CURRENT_VERSION); - return; - } for (i = 0; i < CS_HEADER_VERSION_MAX; i++) fprintf(stdout, cs_etm_global_header_fmts[i], val[i]); @@ -2916,9 +2909,8 @@ int cs_etm__process_auxtrace_info(union perf_event *event, /* Look for version of the header */ hdr_version = ptr[0]; if (hdr_version > CS_HEADER_CURRENT_VERSION) { - /* print routine will print an error on bad version */ - if (dump_trace) - cs_etm__print_auxtrace_info(auxtrace_info->priv, 0); + pr_err("\nCS ETM Trace: Unknown Header Version = %#" PRIx64, hdr_version); + pr_err(", version supported <= %x\n", CS_HEADER_CURRENT_VERSION); return -EINVAL; }