From patchwork Fri Sep 1 03:50:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijie Shao X-Patchwork-Id: 13372006 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 61CF1CA0FE6 for ; Fri, 1 Sep 2023 03:54:42 +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=rw9eKBBPXs0KZC6xHAjQbxf+rArc15BTwP+TwXQ0au0=; b=b6Ruo9RKclcNv5 MBmea5hcC73b/eSR4EFBk3O01hzVxkp//NjGvxP+F4P/CSgUTtUwJywhZOsSQPiwEd+pD4bdtxws9 rzfQEP3nfHd30/vN0slsGdJAxFrwkBsoJwUeI4QQr2jmIsiIkR+Of0JLvuh4SSBNAHW5YUY6hYgTN gnJhW27uuxEOEh3CpYtO9le+RBOZLjChNjq/KuFExaS7pBVeSMVmdDzWaS2BBV4spWRfC8mX4juUB mX4FdBR9n5YYB50E+QyW7ARNY9q0GAj+WVCmFQCp/Zy7oUnYr3iEVhh667Kpl/APjef+Kor6xu/C6 WDprnWZrAXwETcl8bjSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qbvEg-00GPv6-1g; Fri, 01 Sep 2023 03:54:18 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qbvEd-00GPrV-0E for linux-arm-kernel@lists.infradead.org; Fri, 01 Sep 2023 03:54:17 +0000 Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RcPFC5mgTzNn04; Fri, 1 Sep 2023 11:50:23 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 11:54:01 +0800 From: Jijie Shao To: , , , , CC: , , , , , Subject: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue Date: Fri, 1 Sep 2023 11:50:27 +0800 Message-ID: <20230901035027.3881389-1-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230831_205415_307623_FC1D46C4 X-CRM114-Status: GOOD ( 10.86 ) 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 From: Hao Chen hns3_pmu_select_filter_mode() includes A series of mode judgments such as global mode ,function mode, function-queue mode, port mode, port-tc mode. For a special scenario: command use parameter perf stat -a -e hns3_pmu_sicl_0/bdf=0x3700,config=0x3,queue=0x0, and hns3_pmu_is_enabled_func_mode() has a judgement as below: if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_FUNC)) filter_support of event 0x3 hasn't set bit for func mode, so it can't enter func-mode branch, and continue to func-queue mode judgement, port judgement, port-tc mode, then enter port-tc mode. It's not up to expectations, it shouldn't enter any modes but return -ENOENT. port-tc mode parameter show as below: perf stat -a -e hns3_pmu_sicl_0/config=0x00001,port=0x0,tc=0x1 port-tc mode should use bdf parameter as 0, so, add judgement of bdf parameter to fix it. Signed-off-by: Hao Chen Signed-off-by: Jijie Shao --- changeLog: v2: add more details in log message suggested by Will v1 link: https://lore.kernel.org/all/20230816094619.3563784-1-shaojijie@huawei.com/ --- drivers/perf/hisilicon/hns3_pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index e0457d84af6b..2aa9cb045705 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -998,12 +998,13 @@ static bool hns3_pmu_is_enabled_port_tc_mode(struct perf_event *event, struct hns3_pmu_event_attr *pmu_event) { + u16 bdf = hns3_pmu_get_bdf(event); u8 tc_id = hns3_pmu_get_tc(event); if (!(pmu_event->filter_support & HNS3_PMU_FILTER_SUPPORT_PORT_TC)) return false; - return tc_id != HNS3_PMU_FILTER_ALL_TC; + return (tc_id != HNS3_PMU_FILTER_ALL_TC) && (!bdf); } static bool