From patchwork Thu Mar 16 13:32:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junhao He X-Patchwork-Id: 13177636 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 3EFCDC6FD19 for ; Thu, 16 Mar 2023 13:35:05 +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=FHjnjXD9BMUaPk 1PJgArx6qLUlhwbbKPDM8+uRz3SkgiDp7ljwH083/Pw8eBG0pAR0JZOkjsC1cYh+x43KtkTqALFZ+ K2CBuRsbpoQeXc8BKeOUhV//s8zUbM1lZCy86VE0hljXa2NWpg9Z0m8Fv6pwPRdLfI9vPgIF3++1H U3aPsjdUkIBTT7oji1Tpe4kc4aSuLel+BnJFxyhH5g09UIGObsLaRWxkyTnJ4CcwF+8ooq4zLteWo V/wzFji8mwXuHU0DlYwbgdkNYF8Fl5bUJko3zDFF6DTsL+TidslwnRzTLCeDbATK9Zf8ido/Vxyg1 sEZv7AKMJo3QmdRD3hfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcnk7-00GXbA-3B; Thu, 16 Mar 2023 13:34:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcnk6-00GXaB-1I for linux-arm-kernel@bombadil.infradead.org; Thu, 16 Mar 2023 13:34:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=qnr6qalKkQ489bOAZzdzw3FrNV+XnKxTOjeroGCP22o=; b=YtEKT3tts6rvzu9M+ayRkqA5Ow i9y8dBXINQh6262zT3Ve3cN9KFsmA5BklV0naHxBBL3VA5YWX3XCCoSBbCqGv5EUJXK1d0BY4MLAT Q2ANVsFCkU/isc8iJb3BS1MTGmv316sg6LVhJPIHFRK/2iD5xE/qDDz0dSP1UEib+ZTaRoMklFwmp oDm/tDGqtoLwvYgWEUxOHMYtVbbIgVcAd1AumoVmWblCovxZPMoFT2uLVmVlU0/Ap8rIFXsJpozrb lg03rrGbbKhup5DTYpduL5i7C4qS/qsAMtTlTRle2+isnKTPkU9LXU7PZfCMZ5Y2sXj0QMEnCSvTp XoAl9V1w==; Received: from szxga03-in.huawei.com ([45.249.212.189]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcnjx-002S9w-1i for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 13:34:02 +0000 Received: from dggpeml500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Pcp9p41TCzKnKJ; Thu, 16 Mar 2023 21:33:18 +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, 16 Mar 2023 21:33:34 +0800 From: Junhao He To: , CC: , , , , , , , , , , , , , , , , Subject: [RESEND PATCH] perf cs-etm: add error logging to cs_etm_is_etmv4() Date: Thu, 16 Mar 2023 21:32:32 +0800 Message-ID: <20230316133232.42209-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: dggems704-chm.china.huawei.com (10.3.19.181) 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-20230316_133400_108519_02DB04DC X-CRM114-Status: GOOD ( 10.82 ) 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)