Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jijie Shao <shaojijie@huawei.com>
To: <will@kernel.org>, <jonathan.cameron@huawei.com>, <mark.rutland@arm.com>
Cc: <chenhao418@huawei.com>, <shaojijie@huawei.com>,
	<shenjian15@huawei.com>, <wangjie125@huawei.com>,
	<liuyonglong@huawei.com>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
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	[thread overview]
Message-ID: <20230816094619.3563784-3-shaojijie@huawei.com> (raw)
In-Reply-To: <20230816094619.3563784-1-shaojijie@huawei.com>

From: Hao Chen <chenhao418@huawei.com>

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 <chenhao418@huawei.com>
Signed-off-by: Jijie Shao <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 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
-- 
2.30.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-08-16  9:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  9:46 [PATCH drivers/perf: hisi: 0/2] There are some bugfix for the hisi perf driver Jijie Shao
2023-08-16  9:46 ` [PATCH drivers/perf: hisi: 1/2] drivers/perf: hisi: hns3: default use hardware event 0 as group leader event Jijie Shao
2023-08-21 11:58   ` Will Deacon
2023-08-23  2:38     ` Jijie Shao
2023-08-16  9:46 ` Jijie Shao [this message]
2023-08-21 12:04   ` [PATCH drivers/perf: hisi: 2/2] drivers/perf: hisi: fix set wrong filter mode for running events issue Will Deacon
2023-08-21 12:08     ` Will Deacon
2023-08-21 12:32       ` Jijie Shao
2023-08-23  2:33     ` Jijie Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230816094619.3563784-3-shaojijie@huawei.com \
    --to=shaojijie@huawei.com \
    --cc=chenhao418@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=shenjian15@huawei.com \
    --cc=wangjie125@huawei.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox