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: hejunhao X-Patchwork-Id: 63289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4138432wrd; Thu, 2 Mar 2023 01:36:35 -0800 (PST) X-Google-Smtp-Source: AK7set/239D5SjuwwOEedZFs0S85q8JifiPV50Kz1UoS10dqI+cyiTqlHZJI75ZBFcqrFx8C5iNw X-Received: by 2002:a17:906:4942:b0:8aa:c0a4:2aa5 with SMTP id f2-20020a170906494200b008aac0a42aa5mr8957616ejt.16.1677749795266; Thu, 02 Mar 2023 01:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677749795; cv=none; d=google.com; s=arc-20160816; b=mlwbgEEzI4hrWz3/UPbEX9h36F+FnpjbxrNrrXVsRTIMQVTKcK8PHZkvgQ1Mq5gexk EuJiwdLN853RM3Ex2x2qp7UxQtlP+XO2ruxHFEltDQZqkBYG1H2Ql8opbFH6J/bhPYR7 yPugwStt/kdaT45LMKfpxjIXIXvICSWzM+NDA/JUXOsn5NgqdC69uB4cclJwU0HJ8pNE N2bZX3HtGdzdxAOLbMkGkHQit+dwbVHZviCtu0yq0BN5hvLmI5XpTIC1mYFp7gIDCUkn hEf5XFJWIU1iJxO1Wi3xaD3TKwGdgrHLHVPhitx0Sk+gN6j9zgEMBal3XhyODY3lA8WH LJ8g== 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=qnr6qalKkQ489bOAZzdzw3FrNV+XnKxTOjeroGCP22o=; b=rl927JHcqw9Yl42gLJiBGNF5Buv3yRX1bEC/2sqaZb3Cns5BJCnkEzZ7JvSITn8ZeC Tro00wr9Fnl2yWo1rfYeYOHECyS/1/hmnKXmMCNyh7hY+VqSu7cvm0iWeG2f6iSzPR4C tKtzVYXN32JabsESY84laIbR3i525+dmt/uJ9tRPrBpPrQv00FaOcrebLEZtFefh5CJY 8+7LVtw9RnlSBpTAhKshTO8ubzjt0XU8li9ar15ogv0/KW4geczOHCDqGFVSCAkRb+r8 LRJ5I55pFYi85kkQCU03YXi79Xwk+9LI4dWEwhidGGPh+hiYOGZ9uHlfQVMXJlVN1LsE Pnhw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r5-20020aa7d145000000b004acc84ce543si1102429edo.432.2023.03.02.01.36.13; Thu, 02 Mar 2023 01:36:35 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229607AbjCBJa1 (ORCPT + 99 others); Thu, 2 Mar 2023 04:30:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjCBJaZ (ORCPT ); Thu, 2 Mar 2023 04:30:25 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB1A2332B for ; Thu, 2 Mar 2023 01:30:23 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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?1759248168864671829?= X-GMAIL-MSGID: =?utf-8?q?1759248168864671829?= 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)