lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230901035027.3881389-1-shaojijie@huawei.com>
Date:   Fri, 1 Sep 2023 11:50:27 +0800
From:   Jijie Shao <shaojijie@...wei.com>
To:     <will@...nel.org>, <jonathan.cameron@...wei.com>,
        <mark.rutland@....com>, <yangyicong@...ilicon.com>,
        <shaojijie@...wei.com>
CC:     <chenhao418@...wei.com>, <shenjian15@...wei.com>,
        <wangjie125@...wei.com>, <liuyonglong@...wei.com>,
        <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>
Subject: [PATCH V2 drivers/perf: hisi:] drivers/perf: hisi: fix set wrong filter mode for running events issue

From: Hao Chen <chenhao418@...wei.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
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 <chenhao418@...wei.com>
Signed-off-by: Jijie Shao <shaojijie@...wei.com>
---
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
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ