From patchwork Wed Mar 8 09:48:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13165533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F5AEC678D5 for ; Wed, 8 Mar 2023 09:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=86OvDsCHhLPCFxLDrHaFPWqmJQi1Q4NKFaTuI3DGwfg=; b=Q/+mliM0bV0YmE 8aB2Blend/qhLrgWknkiRmcN9l92Kbz+EqDmTqA/llqeNJfQm9d5xhPOZt9CfukDHae4Pxd5hCtC7 zqWpljcwIesfPqt8yb9vOgE9DTu68kHibVb2lcf+1JHfMLnqZW1TP3g8JPNpT8MhZ2E9oe3PNJ/uz 1kd4EctO51MMLAgoRFpYQgedGExTZ0kdoF98E39guc1o4lKjz2Cev89EcOgbnja6Tta2Xqiak1407 GvSqNRFfgA2j8xkLgyKhA+9WaDGr4j0kvMjBiQX2WsVNcMHOpkP3z8hVFqMAbIvJh+AY5TcXRZ8Rf 2sYFHzrxTYXUFf8gIUhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZqR8-004FmC-2E; Wed, 08 Mar 2023 09:50:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZqQy-004FkC-02 for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 09:50:09 +0000 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 5AF8E11FB; Wed, 8 Mar 2023 01:50:48 -0800 (PST) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7604E3F71A; Wed, 8 Mar 2023 01:50:01 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, acme@kernel.org Cc: linux-kernel@vger.kernel.org, al.grant@arm.com, James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] perf cs-etm: Avoid printing warning in cs_etm_is_ete() check Date: Wed, 8 Mar 2023 09:48:43 +0000 Message-Id: <20230308094843.287093-2-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308094843.287093-1-james.clark@arm.com> References: <20230308094843.287093-1-james.clark@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230308_015008_103785_98436317 X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When checking for the presence of ETE, a register is read that may not be present on older kernels or if ETE isn't available. cs_etm_get_ro() will print a warning if it doesn't exist, so check for the existence first before accessing it. Signed-off-by: James Clark Reviewed-by: Leo Yan --- tools/perf/arch/arm/util/cs-etm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 59b50dd70330..86b61ad74f90 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -659,8 +659,12 @@ static bool cs_etm_is_ete(struct auxtrace_record *itr, int cpu) { struct cs_etm_recording *ptr = container_of(itr, struct cs_etm_recording, itr); struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; - int trcdevarch = cs_etm_get_ro(cs_etm_pmu, cpu, metadata_ete_ro[CS_ETE_TRCDEVARCH]); + int trcdevarch; + if (!cs_etm_pmu_path_exists(cs_etm_pmu, cpu, metadata_ete_ro[CS_ETE_TRCDEVARCH])) + return false; + + trcdevarch = cs_etm_get_ro(cs_etm_pmu, cpu, metadata_ete_ro[CS_ETE_TRCDEVARCH]); /* * ETE if ARCHVER is 5 (ARCHVER is 4 for ETM) and ARCHPART is 0xA13. * See ETM_DEVARCH_ETE_ARCH in coresight-etm4x.h