Commit f612eb2f authored by Hao Chen's avatar Hao Chen Committed by Jiantao Xiao
Browse files

perf: pmu: fix set wrong filter mode for running events issue

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7B8SA


CVE: NA

----------------------------------------------------------------------

For a special scenario, command use function-queue level event parameter,
but 'config' parameter use events which doesn't support func-queue mode.

When set filter mode in hns3 pmu driver code, it will not hit func-queue
branch and hit port-tc branch, it's not up to expectations.

It shouldn't match any branches but return -ENOENT.

So, add judgement of bdf parameter to fix it.

Fixes: 66637ab1 ("drivers/perf: hisi: add driver for HNS3 PMU")
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
parent 77566d2b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1001,12 +1001,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