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: <20221003070723.796603884@linuxfoundation.org>
Date:   Mon,  3 Oct 2022 09:11:37 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Ian Rogers <irogers@...gle.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Alexander Antonov <alexander.antonov@...ux.intel.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Andrew Kilroy <andrew.kilroy@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Changbin Du <changbin.du@...el.com>,
        Denys Zagorui <dzagorui@...co.com>,
        Fabian Hemmer <copy@...y.sh>, Felix Fietkau <nbd@....name>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Ingo Molnar <mingo@...hat.com>,
        Jacob Keller <jacob.e.keller@...el.com>,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        Jin Yao <yao.jin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Joakim Zhang <qiangqing.zhang@....com>,
        John Garry <john.garry@...wei.com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Kees Kook <keescook@...omium.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Nicholas Fraser <nfraser@...eweavers.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Paul Clarke <pc@...ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Riccardo Mancini <rickyman7@...il.com>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        ShihCheng Tu <mrtoastcheng@...il.com>,
        Song Liu <songliubraving@...com>,
        Stephane Eranian <eranian@...gle.com>,
        Sumanth Korikkar <sumanthk@...ux.ibm.com>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Wan Jiabing <wanjiabing@...o.com>,
        Zhen Lei <thunder.leizhen@...wei.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.15 72/83] perf metric: Only add a referenced metric once

From: Ian Rogers <irogers@...gle.com>

[ Upstream commit a3de76903dd0786a8661e9e6eb9054a7519e10e7 ]

If a metric references other metrics then the same other metrics may be
referenced more than once, but the events and metric ref are only needed
once.

An example of this is in tests/parse-metric.c where DCache_L2_Hits
references the metric DCache_L2_All_Hits twice, once directly and once
through DCache_L2_All.

Signed-off-by: Ian Rogers <irogers@...gle.com>
Acked-by: Andi Kleen <ak@...ux.intel.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexander Antonov <alexander.antonov@...ux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andrew Kilroy <andrew.kilroy@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Changbin Du <changbin.du@...el.com>
Cc: Denys Zagorui <dzagorui@...co.com>
Cc: Fabian Hemmer <copy@...y.sh>
Cc: Felix Fietkau <nbd@....name>
Cc: Heiko Carstens <hca@...ux.ibm.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Jacob Keller <jacob.e.keller@...el.com>
Cc: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Joakim Zhang <qiangqing.zhang@....com>
Cc: John Garry <john.garry@...wei.com>
Cc: Kajol Jain <kjain@...ux.ibm.com>
Cc: Kan Liang <kan.liang@...ux.intel.com>
Cc: Kees Kook <keescook@...omium.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Nicholas Fraser <nfraser@...eweavers.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Paul Clarke <pc@...ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Riccardo Mancini <rickyman7@...il.com>
Cc: Sami Tolvanen <samitolvanen@...gle.com>
Cc: ShihCheng Tu <mrtoastcheng@...il.com>
Cc: Song Liu <songliubraving@...com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Sumanth Korikkar <sumanthk@...ux.ibm.com>
Cc: Thomas Richter <tmricht@...ux.ibm.com>
Cc: Wan Jiabing <wanjiabing@...o.com>
Cc: Zhen Lei <thunder.leizhen@...wei.com>
Link: https://lore.kernel.org/r/20211015172132.1162559-9-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events")
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
 tools/perf/util/metricgroup.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 2dc2a0dcf846..ec8195f1ab50 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -836,12 +836,18 @@ static int __add_metric(struct list_head *metric_list,
 		*mp = m;
 	} else {
 		/*
-		 * We got here for the referenced metric, via the
-		 * recursive metricgroup__add_metric call, add
-		 * it to the parent group.
+		 * This metric was referenced in a metric higher in the
+		 * tree. Check if the same metric is already resolved in the
+		 * metric_refs list.
 		 */
 		m = *mp;
 
+		list_for_each_entry(ref, &m->metric_refs, list) {
+			if (!strcmp(pe->metric_name, ref->metric_name))
+				return 0;
+		}
+
+		/*Add the new referenced metric to the pare the parent group. */
 		ref = malloc(sizeof(*ref));
 		if (!ref)
 			return -ENOMEM;
-- 
2.35.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ