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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230816094619.3563784-2-shaojijie@huawei.com>
Date:   Wed, 16 Aug 2023 17:46:18 +0800
From:   Jijie Shao <shaojijie@...wei.com>
To:     <will@...nel.org>, <jonathan.cameron@...wei.com>,
        <mark.rutland@....com>
CC:     <chenhao418@...wei.com>, <shaojijie@...wei.com>,
        <shenjian15@...wei.com>, <wangjie125@...wei.com>,
        <liuyonglong@...wei.com>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>
Subject: [PATCH drivers/perf: hisi: 1/2] drivers/perf: hisi: hns3: default use hardware event 0 as group leader event.

From: Hao Chen <chenhao418@...wei.com>

For hns3 pmu events, we use command as below before:
perf stat -g -e hns3_pmu_sicl_0/config=0x00105,global=1/
-e hns3_pmu_sicl_0/config=0x10105,global=1/ -I 1000

We want to use -g parameter to make 0x00105 event and 0x10105 event
share a hardware event, but for kernel 6.2, 'commit 5f8f95673f68
("perf evlist: Remove group option.")' remove -g parameter.

So add this patch to set default related event idx as 0 to share
the first hardware event.

The new command shows as below:
perf stat -e hns3_pmu_sicl_0/config=0x00105,global=1/
-e hns3_pmu_sicl_0/config=0x10105,global=1/ -I 1000

Fixes: 5f8f95673f68 ("perf evlist: Remove group option.")
Signed-off-by: Hao Chen <chenhao418@...wei.com>
Signed-off-by: Jijie Shao <shaojijie@...wei.com>
---
 drivers/perf/hisilicon/hns3_pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
index e0457d84af6b..6a4d04cbae91 100644
--- a/drivers/perf/hisilicon/hns3_pmu.c
+++ b/drivers/perf/hisilicon/hns3_pmu.c
@@ -796,9 +796,11 @@ static int hns3_pmu_find_related_event_idx(struct hns3_pmu *hns3_pmu,
 		if (!hns3_pmu_cmp_event(sibling, event))
 			continue;
 
-		/* Related events is used in group */
+		/* Related events is used in group, else we use index 0 event as related event */
 		if (sibling->group_leader == event->group_leader)
 			return idx;
+		else
+			return 0;
 	}
 
 	/* No related event and all hardware events are used up */
-- 
2.30.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ