From patchwork Wed Aug 16 09:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijie Shao X-Patchwork-Id: 13354812 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 05228C001E0 for ; Wed, 16 Aug 2023 09:50:26 +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:References:In-Reply-To: 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: List-Owner; bh=URi7YxTuJIR7Q5RkFpUlbkdyDP2BMrp/PSnynzzWano=; b=jEFUwV68poTdkB OkfDT8fzQvDK7LnYkDVcOFpP496EwLVVs47JuO88uz17FW1h4ZgnTRbYUwyj7yrOqLB6GdZC41CFN o5yCxlEg3ICs59zY2f+rVrCvWOzF0LjvCQqqMDRT0CcxaeJmdCMoEV8Y4uxAzMWVKB8DfSCJiC4Gc mMoM/W8y+Qt6ePY2UtV0XkL5uU7CHI9+pxA7hE6BGwIKArDhhJQAnOSwBGDwkyisqfCnql1kfUUUj iJ8IcTSYxEKUQUM+xkxAMCJdXg/lXs+l7ploWQQ2NUJn1E6GYNzV11Wr7wW6YE/C9WlJJuLQZZW3q MNGDU3h1aJD4Yk8uJRzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWDAA-003euw-2G; Wed, 16 Aug 2023 09:50:02 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWDA1-003esc-2T for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 09:49:55 +0000 Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RQjxn2QmCz1GDWZ; Wed, 16 Aug 2023 17:48:29 +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; Wed, 16 Aug 2023 17:49:49 +0800 From: Jijie Shao To: , , CC: , , , , , , Subject: [PATCH drivers/perf: hisi: 2/2] drivers/perf: hisi: fix set wrong filter mode for running events issue Date: Wed, 16 Aug 2023 17:46:19 +0800 Message-ID: <20230816094619.3563784-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230816094619.3563784-1-shaojijie@huawei.com> References: <20230816094619.3563784-1-shaojijie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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-20230816_024954_069101_85428A03 X-CRM114-Status: GOOD ( 10.89 ) 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 "bdf=0x3700,config=0x3, queue=0x0", it is expected to enter function-queue mode, but event of config 0x3 doesn't support func-queue mode, then it enter port-tc mode. it's not up to expectations. It shouldn't enter any modes but return -ENOENT. So, add judgement of bdf parameter to fix it. Fixes: 66637ab137b4 ("drivers/perf: hisi: add driver for HNS3 PMU") Signed-off-by: Hao Chen Signed-off-by: Jijie Shao --- 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 6a4d04cbae91..7f38a9e489d4 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -1000,12 +1000,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