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: hejunhao X-Patchwork-Id: 70793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp488430wrt; Thu, 16 Mar 2023 06:41:00 -0700 (PDT) X-Google-Smtp-Source: AK7set+BMysqzXpzKCY61WrQw9v8v/jM30hYUTaekNC5HuIHAvZr548WyKN3kTkj5k4Jn5siljUk X-Received: by 2002:a05:6a20:72a0:b0:c7:6f26:ca0 with SMTP id o32-20020a056a2072a000b000c76f260ca0mr4164685pzk.54.1678974059795; Thu, 16 Mar 2023 06:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678974059; cv=none; d=google.com; s=arc-20160816; b=oPIvH9VnudXVtZnbMsTFhrEqTyDtR+vyOEnOIWj/QTLpyZt6nbP+8dYvJwsTHMagxU IUFcqv0aou6RyN7KhmF7F4SBhfX7yGhWEcjSaKlDv8YZqmULmmzg5TxKE9Y66hZUCySR 8OpLPiDmy41/JVPBZMaJWTSEz9KaRp8BoCdqo10zJeEjQQl4Ufddd02jjDDkqBibj3Hn 3X2bCMN7LGNG69fe/VE5fU7/+lycLJDgmJ8sjQgPaXV8f1nBhqVr43HeABNGWznfyZQL 6QeAWfpA2ttb7RwRoypJ+t4QMUIjgqIn3JDwJI/wAKJZPMhsHkg6RnoHKHRoucDfWMii mZ8w== 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=IM0mUknqflDbgbW247Fo5iuVKvZhmJqSlKEtELMjwG3hyq1CsAD46GrgUxWwGirhM7 7ZOwtrGpB34CMOTgrbLGj4FHsxvOk1Mo5HG+ZH5/2hujFq2tndfOkgqBykzHCmYBNK4t EZw3wxn9g3tMp28iJY7ulBW5ZPo94yilplPDtV0m1rBLziK5pPyPKU5Pa8Y/OlflSpo6 Sbr2XUSd/6z9FK+wCcixqDCqoZKYIg0lKFQ6MdWUIBzn0WwxySZ+iNXHjOJtQUV3JOp9 Ht4mgyAShcuscToqOYXx4/6tXjJ5SK+1OOfBkmv0E8wW6XkCqqHiaj+TyxUmQsQhHW+5 FYcQ== 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 n15-20020a634d4f000000b004ff6f80f6c4si7812548pgl.285.2023.03.16.06.40.44; Thu, 16 Mar 2023 06:40:59 -0700 (PDT) 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 S230295AbjCPNdm (ORCPT + 99 others); Thu, 16 Mar 2023 09:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjCPNdk (ORCPT ); Thu, 16 Mar 2023 09:33:40 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC26764850; Thu, 16 Mar 2023 06:33:36 -0700 (PDT) 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-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?1760531903592978132?= X-GMAIL-MSGID: =?utf-8?q?1760531903592978132?= 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)