From patchwork Thu Mar 2 09:29:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junhao He X-Patchwork-Id: 13156880 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 EC1E7C678D4 for ; Thu, 2 Mar 2023 09:31:59 +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: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:In-Reply-To:References: List-Owner; bh=hWHCAzhVE8hOnXjn/hJq2vCt7AElKjbj1Ji6n5ktboc=; b=f0KGJX06nXy79u wgNu+wGp7sTKosOiW7hk37ghaLgVxQIBJPcuuoSaL0/8Mlo4+V/rnhp8TJfQCwV2hMwC8fturmQuk e1W4KfKBFiVjXHsVP5pIT+OC1YdIBzR+lOLG/02vImpwNZQvMZWFYZkFD5Mvxb4LzV7nwrM+bMbcK wFyvPUHC3P5YX1zPZSOA/OSPSKhUdE4VUhb4VaSZ2mRn4szIbwMUGfATX8HyYcRvHc29FtOKHKCA7 X0nccBNnR4yAL/3jAi9PN3TfXlfOFycmBPGY5jSrbW6/G1/N0du3aTh7NPA8IL1X4phBrAXd5HIxF /qeUfBXuoIH2zPVGQeFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXfH1-001PjW-60; Thu, 02 Mar 2023 09:30:51 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXfGw-001Pgh-NB for linux-arm-kernel@lists.infradead.org; Thu, 02 Mar 2023 09:30:49 +0000 Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PS5Pb6mtRz9tJs; Thu, 2 Mar 2023 17:28:19 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpeml500002.china.huawei.com (7.185.36.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 17:30:19 +0800 From: Junhao He To: , , , CC: , , , , , , , , , Subject: [PATCH] perf cs-etm: add error logging to cs_etm_is_etmv4() Date: Thu, 2 Mar 2023 17:29:28 +0800 Message-ID: <20230302092928.60943-1-hejunhao3@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500002.china.huawei.com (7.185.36.158) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_013046_963811_7E320BEE X-CRM114-Status: GOOD ( 11.37 ) 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 On the HiSilicon platform, there is one ETM per logic core. When setting up SMT, not every process has an ETM. So the path ".../cs_etm/cpux/trcidr/trcidr0" does not exist, the function perf_pmu__scan_file() return an error. However, the command 'perf record' will returns silently and don't print. After this patch, log a error when read fails that makes it easy for users to debug. root@localhost:/# perf record -e /cs_etm/@ultra_smb0/ -C 3 uname -a cs_etm: can't read file cpu3/trcidr/trcidr0 root@localhost:/# Signed-off-by: Junhao He --- tools/perf/arch/arm/util/cs-etm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 7f71c8a237ff..19ea17430399 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -585,7 +585,6 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu) { - bool ret = false; char path[PATH_MAX]; int scan; unsigned int val; @@ -600,9 +599,10 @@ static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu) /* The file was read successfully, we have a winner */ if (scan == 1) - ret = true; + return true; - return ret; + pr_err("%s: can't read file %s\n", CORESIGHT_ETM_PMU_NAME, path); + return false; } static int cs_etm_get_ro(struct perf_pmu *pmu, int cpu, const char *path)