From c11f82edbc5e4422a64239ac0738e67ee271e332 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 4 Oct 2022 19:44:53 +0200 Subject: [PATCH] drop all perf patches from 5.15 queue. Not needed here, something went wrong with a dependancy checker... --- ...play-hybrid-pmu-events-with-cpu-type.patch | 355 ----------- ...-documentation-and-rename-a-variable.patch | 174 ----- ...ic-only-add-a-referenced-metric-once.patch | 91 --- ...parse-events-add-const-to-evsel-name.patch | 274 -------- ...-parse-events-add-new-metric-id-term.patch | 597 ------------------ ...rse-events-identify-broken-modifiers.patch | 108 ---- .../perf-pmu-fix-alias-events-list.patch | 96 --- ...-vmlinux-kallsyms-arguments-in-all-t.patch | 154 ----- ...ce-the-matching-of-sub-commands-abbr.patch | 276 -------- queue-5.15/series | 9 - 10 files changed, 2134 deletions(-) delete mode 100644 queue-5.15/perf-list-display-hybrid-pmu-events-with-cpu-type.patch delete mode 100644 queue-5.15/perf-metric-add-documentation-and-rename-a-variable.patch delete mode 100644 queue-5.15/perf-metric-only-add-a-referenced-metric-once.patch delete mode 100644 queue-5.15/perf-parse-events-add-const-to-evsel-name.patch delete mode 100644 queue-5.15/perf-parse-events-add-new-metric-id-term.patch delete mode 100644 queue-5.15/perf-parse-events-identify-broken-modifiers.patch delete mode 100644 queue-5.15/perf-pmu-fix-alias-events-list.patch delete mode 100644 queue-5.15/perf-tools-check-vmlinux-kallsyms-arguments-in-all-t.patch delete mode 100644 queue-5.15/perf-tools-enhance-the-matching-of-sub-commands-abbr.patch diff --git a/queue-5.15/perf-list-display-hybrid-pmu-events-with-cpu-type.patch b/queue-5.15/perf-list-display-hybrid-pmu-events-with-cpu-type.patch deleted file mode 100644 index 1a87fea5bc0..00000000000 --- a/queue-5.15/perf-list-display-hybrid-pmu-events-with-cpu-type.patch +++ /dev/null @@ -1,355 +0,0 @@ -From e927c72e5390396a7ce5aa5ed744d5ccbdef09c3 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 3 Sep 2021 10:52:39 +0800 -Subject: perf list: Display hybrid PMU events with cpu type - -From: Jin Yao - -[ Upstream commit 0e0ae8742207c3b477cf0357b8115cec7b19612c ] - -Add a new option '--cputype' to 'perf list' to display core-only PMU -events or atom-only PMU events. - -Each hybrid PMU event has been assigned with a PMU name, this patch -compares the PMU name before listing the result. - -For example: - - perf list --cputype atom - ... - cache: - core_reject_l2q.any - [Counts the number of request that were not accepted into the L2Q because the L2Q is FULL. Unit: cpu_atom] - ... - -The "Unit: cpu_atom" is displayed in the brief description section -to indicate this is an atom event. - -Signed-off-by: Jin Yao -Cc: Alexander Shishkin -Cc: Andi Kleen -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Kan Liang -Cc: Peter Zijlstra -Link: http://lore.kernel.org/lkml/20210903025239.22754-1-yao.jin@linux.intel.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/Documentation/perf-list.txt | 4 +++ - tools/perf/builtin-list.c | 42 ++++++++++++++++++-------- - tools/perf/util/metricgroup.c | 7 ++++- - tools/perf/util/metricgroup.h | 2 +- - tools/perf/util/parse-events.c | 8 +++-- - tools/perf/util/parse-events.h | 3 +- - tools/perf/util/pmu.c | 29 +++++++++++++++--- - tools/perf/util/pmu.h | 2 +- - 8 files changed, 73 insertions(+), 24 deletions(-) - -diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt -index 4c7db1da8fcc..4dc8d0af19df 100644 ---- a/tools/perf/Documentation/perf-list.txt -+++ b/tools/perf/Documentation/perf-list.txt -@@ -39,6 +39,10 @@ any extra expressions computed by perf stat. - --deprecated:: - Print deprecated events. By default the deprecated events are hidden. - -+--cputype:: -+Print events applying cpu with this type for hybrid platform -+(e.g. --cputype core or --cputype atom) -+ - [[EVENT_MODIFIERS]] - EVENT MODIFIERS - --------------- -diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c -index 10ab5e40a34f..468958154ed9 100644 ---- a/tools/perf/builtin-list.c -+++ b/tools/perf/builtin-list.c -@@ -12,6 +12,7 @@ - - #include "util/parse-events.h" - #include "util/pmu.h" -+#include "util/pmu-hybrid.h" - #include "util/debug.h" - #include "util/metricgroup.h" - #include -@@ -20,13 +21,15 @@ - - static bool desc_flag = true; - static bool details_flag; -+static const char *hybrid_type; - - int cmd_list(int argc, const char **argv) - { -- int i; -+ int i, ret = 0; - bool raw_dump = false; - bool long_desc_flag = false; - bool deprecated = false; -+ char *pmu_name = NULL; - struct option list_options[] = { - OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), - OPT_BOOLEAN('d', "desc", &desc_flag, -@@ -37,6 +40,9 @@ int cmd_list(int argc, const char **argv) - "Print information on the perf event names and expressions used internally by events."), - OPT_BOOLEAN(0, "deprecated", &deprecated, - "Print deprecated events."), -+ OPT_STRING(0, "cputype", &hybrid_type, "hybrid cpu type", -+ "Print events applying cpu with this type for hybrid platform " -+ "(e.g. core or atom)"), - OPT_INCR(0, "debug", &verbose, - "Enable debugging output"), - OPT_END() -@@ -56,10 +62,16 @@ int cmd_list(int argc, const char **argv) - if (!raw_dump && pager_in_use()) - printf("\nList of pre-defined events (to be used in -e):\n\n"); - -+ if (hybrid_type) { -+ pmu_name = perf_pmu__hybrid_type_to_pmu(hybrid_type); -+ if (!pmu_name) -+ pr_warning("WARNING: hybrid cputype is not supported!\n"); -+ } -+ - if (argc == 0) { - print_events(NULL, raw_dump, !desc_flag, long_desc_flag, -- details_flag, deprecated); -- return 0; -+ details_flag, deprecated, pmu_name); -+ goto out; - } - - for (i = 0; i < argc; ++i) { -@@ -82,25 +94,27 @@ int cmd_list(int argc, const char **argv) - else if (strcmp(argv[i], "pmu") == 0) - print_pmu_events(NULL, raw_dump, !desc_flag, - long_desc_flag, details_flag, -- deprecated); -+ deprecated, pmu_name); - else if (strcmp(argv[i], "sdt") == 0) - print_sdt_events(NULL, NULL, raw_dump); - else if (strcmp(argv[i], "metric") == 0 || strcmp(argv[i], "metrics") == 0) -- metricgroup__print(true, false, NULL, raw_dump, details_flag); -+ metricgroup__print(true, false, NULL, raw_dump, details_flag, pmu_name); - else if (strcmp(argv[i], "metricgroup") == 0 || strcmp(argv[i], "metricgroups") == 0) -- metricgroup__print(false, true, NULL, raw_dump, details_flag); -+ metricgroup__print(false, true, NULL, raw_dump, details_flag, pmu_name); - else if ((sep = strchr(argv[i], ':')) != NULL) { - int sep_idx; - - sep_idx = sep - argv[i]; - s = strdup(argv[i]); -- if (s == NULL) -- return -1; -+ if (s == NULL) { -+ ret = -1; -+ goto out; -+ } - - s[sep_idx] = '\0'; - print_tracepoint_events(s, s + sep_idx + 1, raw_dump); - print_sdt_events(s, s + sep_idx + 1, raw_dump); -- metricgroup__print(true, true, s, raw_dump, details_flag); -+ metricgroup__print(true, true, s, raw_dump, details_flag, pmu_name); - free(s); - } else { - if (asprintf(&s, "*%s*", argv[i]) < 0) { -@@ -116,12 +130,16 @@ int cmd_list(int argc, const char **argv) - print_pmu_events(s, raw_dump, !desc_flag, - long_desc_flag, - details_flag, -- deprecated); -+ deprecated, -+ pmu_name); - print_tracepoint_events(NULL, s, raw_dump); - print_sdt_events(NULL, s, raw_dump); -- metricgroup__print(true, true, s, raw_dump, details_flag); -+ metricgroup__print(true, true, s, raw_dump, details_flag, pmu_name); - free(s); - } - } -- return 0; -+ -+out: -+ free(pmu_name); -+ return ret; - } -diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c -index ec8195f1ab50..9d172ac66062 100644 ---- a/tools/perf/util/metricgroup.c -+++ b/tools/perf/util/metricgroup.c -@@ -11,6 +11,7 @@ - #include "evsel.h" - #include "strbuf.h" - #include "pmu.h" -+#include "pmu-hybrid.h" - #include "expr.h" - #include "rblist.h" - #include -@@ -616,7 +617,7 @@ static int metricgroup__print_sys_event_iter(struct pmu_event *pe, void *data) - } - - void metricgroup__print(bool metrics, bool metricgroups, char *filter, -- bool raw, bool details) -+ bool raw, bool details, const char *pmu_name) - { - struct pmu_events_map *map = pmu_events_map__find(); - struct pmu_event *pe; -@@ -642,6 +643,10 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter, - break; - if (!pe->metric_expr) - continue; -+ if (pmu_name && perf_pmu__is_hybrid(pe->pmu) && -+ strcmp(pmu_name, pe->pmu)) { -+ continue; -+ } - if (metricgroup__print_pmu_event(pe, metricgroups, filter, - raw, details, &groups, - metriclist) < 0) -diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h -index cc4a92492a61..9deee6691f2e 100644 ---- a/tools/perf/util/metricgroup.h -+++ b/tools/perf/util/metricgroup.h -@@ -53,7 +53,7 @@ int metricgroup__parse_groups_test(struct evlist *evlist, - struct rblist *metric_events); - - void metricgroup__print(bool metrics, bool groups, char *filter, -- bool raw, bool details); -+ bool raw, bool details, const char *pmu_name); - bool metricgroup__has_metric(const char *metric); - int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused); - void metricgroup__rblist_exit(struct rblist *metric_events); -diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c -index e62514577b97..533c4b216ae2 100644 ---- a/tools/perf/util/parse-events.c -+++ b/tools/perf/util/parse-events.c -@@ -3034,7 +3034,8 @@ void print_symbol_events(const char *event_glob, unsigned type, - * Print the help text for the event symbols: - */ - void print_events(const char *event_glob, bool name_only, bool quiet_flag, -- bool long_desc, bool details_flag, bool deprecated) -+ bool long_desc, bool details_flag, bool deprecated, -+ const char *pmu_name) - { - print_symbol_events(event_glob, PERF_TYPE_HARDWARE, - event_symbols_hw, PERF_COUNT_HW_MAX, name_only); -@@ -3046,7 +3047,7 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag, - print_hwcache_events(event_glob, name_only); - - print_pmu_events(event_glob, name_only, quiet_flag, long_desc, -- details_flag, deprecated); -+ details_flag, deprecated, pmu_name); - - if (event_glob != NULL) - return; -@@ -3072,7 +3073,8 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag, - - print_sdt_events(NULL, NULL, name_only); - -- metricgroup__print(true, true, NULL, name_only, details_flag); -+ metricgroup__print(true, true, NULL, name_only, details_flag, -+ pmu_name); - - print_libpfm_events(name_only, long_desc); - } -diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h -index 9de27b7c9eec..46e9ec9588ec 100644 ---- a/tools/perf/util/parse-events.h -+++ b/tools/perf/util/parse-events.h -@@ -221,7 +221,8 @@ void parse_events_evlist_error(struct parse_events_state *parse_state, - int idx, const char *str); - - void print_events(const char *event_glob, bool name_only, bool quiet, -- bool long_desc, bool details_flag, bool deprecated); -+ bool long_desc, bool details_flag, bool deprecated, -+ const char *pmu_name); - - struct event_symbol { - const char *symbol; -diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c -index c647b3633d1d..79ee52faaf9b 100644 ---- a/tools/perf/util/pmu.c -+++ b/tools/perf/util/pmu.c -@@ -1608,6 +1608,7 @@ static int cmp_sevent(const void *a, const void *b) - { - const struct sevent *as = a; - const struct sevent *bs = b; -+ int ret; - - /* Put extra events last */ - if (!!as->desc != !!bs->desc) -@@ -1623,7 +1624,13 @@ static int cmp_sevent(const void *a, const void *b) - if (as->is_cpu != bs->is_cpu) - return bs->is_cpu - as->is_cpu; - -- return strcmp(as->name, bs->name); -+ ret = strcmp(as->name, bs->name); -+ if (!ret) { -+ if (as->pmu && bs->pmu) -+ return strcmp(as->pmu, bs->pmu); -+ } -+ -+ return ret; - } - - static void wordwrap(char *s, int start, int max, int corr) -@@ -1653,7 +1660,8 @@ bool is_pmu_core(const char *name) - } - - void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, -- bool long_desc, bool details_flag, bool deprecated) -+ bool long_desc, bool details_flag, bool deprecated, -+ const char *pmu_name) - { - struct perf_pmu *pmu; - struct perf_pmu_alias *alias; -@@ -1679,10 +1687,16 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, - pmu = NULL; - j = 0; - while ((pmu = perf_pmu__scan(pmu)) != NULL) { -+ if (pmu_name && perf_pmu__is_hybrid(pmu->name) && -+ strcmp(pmu_name, pmu->name)) { -+ continue; -+ } -+ - list_for_each_entry(alias, &pmu->aliases, list) { - char *name = alias->desc ? alias->name : - format_alias(buf, sizeof(buf), pmu, alias); -- bool is_cpu = is_pmu_core(pmu->name); -+ bool is_cpu = is_pmu_core(pmu->name) || -+ perf_pmu__is_hybrid(pmu->name); - - if (alias->deprecated && !deprecated) - continue; -@@ -1730,8 +1744,13 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, - qsort(aliases, len, sizeof(struct sevent), cmp_sevent); - for (j = 0; j < len; j++) { - /* Skip duplicates */ -- if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) -- continue; -+ if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) { -+ if (!aliases[j].pmu || !aliases[j - 1].pmu || -+ !strcmp(aliases[j].pmu, aliases[j - 1].pmu)) { -+ continue; -+ } -+ } -+ - if (name_only) { - printf("%s ", aliases[j].name); - continue; -diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h -index dd0736de32c8..57f7b4847fe5 100644 ---- a/tools/perf/util/pmu.h -+++ b/tools/perf/util/pmu.h -@@ -111,7 +111,7 @@ struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); - bool is_pmu_core(const char *name); - void print_pmu_events(const char *event_glob, bool name_only, bool quiet, - bool long_desc, bool details_flag, -- bool deprecated); -+ bool deprecated, const char *pmu_name); - bool pmu_have_event(const char *pname, const char *name); - - int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...) __scanf(3, 4); --- -2.35.1 - diff --git a/queue-5.15/perf-metric-add-documentation-and-rename-a-variable.patch b/queue-5.15/perf-metric-add-documentation-and-rename-a-variable.patch deleted file mode 100644 index e6d759e7555..00000000000 --- a/queue-5.15/perf-metric-add-documentation-and-rename-a-variable.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 5089ed4bb34997f7fc6d7536f2d1ea1bf59bcd88 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 15 Oct 2021 10:21:17 -0700 -Subject: perf metric: Add documentation and rename a variable. - -From: Ian Rogers - -[ Upstream commit 68074811dfb9529bb7cade0e67d42c7f7bf209e6 ] - -Documentation to make current functionality clearer. - -Rename a variable called 'metric' to 'metric_name' as it can be -ambiguous as to whether a string is the name of a metric or the -expression. - -Signed-off-by: Ian Rogers -Acked-by: Andi Kleen -Cc: Adrian Hunter -Cc: Alexander Antonov -Cc: Alexander Shishkin -Cc: Andrew Kilroy -Cc: Andrew Morton -Cc: Changbin Du -Cc: Denys Zagorui -Cc: Fabian Hemmer -Cc: Felix Fietkau -Cc: Heiko Carstens -Cc: Ingo Molnar -Cc: Jacob Keller -Cc: Jiapeng Chong -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Joakim Zhang -Cc: John Garry -Cc: Kajol Jain -Cc: Kan Liang -Cc: Kees Kook -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Nicholas Fraser -Cc: Nick Desaulniers -Cc: Paul Clarke -Cc: Peter Zijlstra -Cc: Riccardo Mancini -Cc: Sami Tolvanen -Cc: ShihCheng Tu -Cc: Song Liu -Cc: Stephane Eranian -Cc: Sumanth Korikkar -Cc: Thomas Richter -Cc: Wan Jiabing -Cc: Zhen Lei -Link: https://lore.kernel.org/r/20211015172132.1162559-7-irogers@google.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/util/metricgroup.c | 59 ++++++++++++++++++++++++++++++++--- - 1 file changed, 54 insertions(+), 5 deletions(-) - -diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c -index 29b747ac31c1..2dc2a0dcf846 100644 ---- a/tools/perf/util/metricgroup.c -+++ b/tools/perf/util/metricgroup.c -@@ -772,13 +772,27 @@ int __weak arch_get_runtimeparam(struct pmu_event *pe __maybe_unused) - - struct metricgroup_add_iter_data { - struct list_head *metric_list; -- const char *metric; -+ const char *metric_name; - struct expr_ids *ids; - int *ret; - bool *has_match; - bool metric_no_group; - }; - -+/** -+ * __add_metric - Add a metric to metric_list. -+ * @metric_list: The list the metric is added to. -+ * @pe: The pmu_event containing the metric to be added. -+ * @metric_no_group: Should events written to events be grouped "{}" or -+ * global. Grouping is the default but due to multiplexing the -+ * user may override. -+ * @runtime: A special argument for the parser only known at runtime. -+ * @mp: The pointer to a location holding the first metric added to metric -+ * list. It is initialized here if this is the first metric. -+ * @parent: The last entry in a linked list of metrics being -+ * added/resolved. This is maintained to detect recursion. -+ * @ids: Storage for parent list. -+ */ - static int __add_metric(struct list_head *metric_list, - struct pmu_event *pe, - bool metric_no_group, -@@ -1068,7 +1082,7 @@ static int metricgroup__add_metric_sys_event_iter(struct pmu_event *pe, - struct metric *m = NULL; - int ret; - -- if (!match_pe_metric(pe, d->metric)) -+ if (!match_pe_metric(pe, d->metric_name)) - return 0; - - ret = add_metric(d->metric_list, pe, d->metric_no_group, &m, NULL, d->ids); -@@ -1087,7 +1101,22 @@ static int metricgroup__add_metric_sys_event_iter(struct pmu_event *pe, - return ret; - } - --static int metricgroup__add_metric(const char *metric, bool metric_no_group, -+/** -+ * metricgroup__add_metric - Find and add a metric, or a metric group. -+ * @metric_name: The name of the metric or metric group. For example, "IPC" -+ * could be the name of a metric and "TopDownL1" the name of a -+ * metric group. -+ * @metric_no_group: Should events written to events be grouped "{}" or -+ * global. Grouping is the default but due to multiplexing the -+ * user may override. -+ * @events: an out argument string of events that need to be parsed and -+ * associated with the metric. For example, the metric "IPC" would -+ * create an events string like "{instructions,cycles}:W". -+ * @metric_list: The list that the metric or metric group are added to. -+ * @map: The map that is searched for metrics, most commonly the table for the -+ * architecture perf is running upon. -+ */ -+static int metricgroup__add_metric(const char *metric_name, bool metric_no_group, - struct strbuf *events, - struct list_head *metric_list, - struct pmu_events_map *map) -@@ -1099,7 +1128,11 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, - int i, ret; - bool has_match = false; - -- map_for_each_metric(pe, i, map, metric) { -+ /* -+ * Iterate over all metrics seeing if metric matches either the name or -+ * group. When it does add the metric to the list. -+ */ -+ map_for_each_metric(pe, i, map, metric_name) { - has_match = true; - m = NULL; - -@@ -1122,7 +1155,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, - .fn = metricgroup__add_metric_sys_event_iter, - .data = (void *) &(struct metricgroup_add_iter_data) { - .metric_list = &list, -- .metric = metric, -+ .metric_name = metric_name, - .metric_no_group = metric_no_group, - .ids = &ids, - .has_match = &has_match, -@@ -1161,6 +1194,22 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group, - return ret; - } - -+/** -+ * metricgroup__add_metric_list - Find and add metrics, or metric groups, -+ * specified in a list. -+ * @list: the list of metrics or metric groups. For example, "IPC,CPI,TopDownL1" -+ * would match the IPC and CPI metrics, and TopDownL1 would match all -+ * the metrics in the TopDownL1 group. -+ * @metric_no_group: Should events written to events be grouped "{}" or -+ * global. Grouping is the default but due to multiplexing the -+ * user may override. -+ * @events: an out argument string of events that need to be parsed and -+ * associated with the metric. For example, the metric "IPC" would -+ * create an events string like "{instructions,cycles}:W". -+ * @metric_list: The list that metrics are added to. -+ * @map: The map that is searched for metrics, most commonly the table for the -+ * architecture perf is running upon. -+ */ - static int metricgroup__add_metric_list(const char *list, bool metric_no_group, - struct strbuf *events, - struct list_head *metric_list, --- -2.35.1 - diff --git a/queue-5.15/perf-metric-only-add-a-referenced-metric-once.patch b/queue-5.15/perf-metric-only-add-a-referenced-metric-once.patch deleted file mode 100644 index 0395cac9b5d..00000000000 --- a/queue-5.15/perf-metric-only-add-a-referenced-metric-once.patch +++ /dev/null @@ -1,91 +0,0 @@ -From aef9d246aa30dffd392308024c92bde60b7aa63a Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 15 Oct 2021 10:21:19 -0700 -Subject: perf metric: Only add a referenced metric once - -From: Ian Rogers - -[ 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 -Acked-by: Andi Kleen -Cc: Adrian Hunter -Cc: Alexander Antonov -Cc: Alexander Shishkin -Cc: Andrew Kilroy -Cc: Andrew Morton -Cc: Changbin Du -Cc: Denys Zagorui -Cc: Fabian Hemmer -Cc: Felix Fietkau -Cc: Heiko Carstens -Cc: Ingo Molnar -Cc: Jacob Keller -Cc: Jiapeng Chong -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Joakim Zhang -Cc: John Garry -Cc: Kajol Jain -Cc: Kan Liang -Cc: Kees Kook -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Nicholas Fraser -Cc: Nick Desaulniers -Cc: Paul Clarke -Cc: Peter Zijlstra -Cc: Riccardo Mancini -Cc: Sami Tolvanen -Cc: ShihCheng Tu -Cc: Song Liu -Cc: Stephane Eranian -Cc: Sumanth Korikkar -Cc: Thomas Richter -Cc: Wan Jiabing -Cc: Zhen Lei -Link: https://lore.kernel.org/r/20211015172132.1162559-9-irogers@google.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - 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 - diff --git a/queue-5.15/perf-parse-events-add-const-to-evsel-name.patch b/queue-5.15/perf-parse-events-add-const-to-evsel-name.patch deleted file mode 100644 index 622fe7569c4..00000000000 --- a/queue-5.15/perf-parse-events-add-const-to-evsel-name.patch +++ /dev/null @@ -1,274 +0,0 @@ -From 670bef849880696397b2bdc3fc485f1746e40449 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 15 Oct 2021 10:21:24 -0700 -Subject: perf parse-events: Add const to evsel name - -From: Ian Rogers - -[ Upstream commit 8e8bbfb311a26a17834f1839e15e2c29ea5e58c6 ] - -The evsel name is strdup-ed before assignment and so can be const. - -A later change will add another similar string. - -Using const makes it clearer that these are not out arguments. - -Signed-off-by: Ian Rogers -Acked-by: Andi Kleen -Cc: Adrian Hunter -Cc: Alexander Antonov -Cc: Alexander Shishkin -Cc: Andrew Kilroy -Cc: Andrew Morton -Cc: Changbin Du -Cc: Denys Zagorui -Cc: Fabian Hemmer -Cc: Felix Fietkau -Cc: Heiko Carstens -Cc: Ingo Molnar -Cc: Jacob Keller -Cc: Jiapeng Chong -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Joakim Zhang -Cc: John Garry -Cc: Kajol Jain -Cc: Kan Liang -Cc: Kees Kook -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Nicholas Fraser -Cc: Nick Desaulniers -Cc: Paul Clarke -Cc: Peter Zijlstra -Cc: Riccardo Mancini -Cc: Sami Tolvanen -Cc: ShihCheng Tu -Cc: Song Liu -Cc: Stephane Eranian -Cc: Sumanth Korikkar -Cc: Thomas Richter -Cc: Wan Jiabing -Cc: Zhen Lei -Link: https://lore.kernel.org/r/20211015172132.1162559-14-irogers@google.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/util/parse-events-hybrid.c | 15 +++++++++------ - tools/perf/util/parse-events-hybrid.h | 6 ++++-- - tools/perf/util/parse-events.c | 15 ++++++++------- - tools/perf/util/parse-events.h | 7 ++++--- - tools/perf/util/pmu.c | 2 +- - tools/perf/util/pmu.h | 2 +- - 6 files changed, 27 insertions(+), 20 deletions(-) - -diff --git a/tools/perf/util/parse-events-hybrid.c b/tools/perf/util/parse-events-hybrid.c -index b234d95fb10a..7e44deee1343 100644 ---- a/tools/perf/util/parse-events-hybrid.c -+++ b/tools/perf/util/parse-events-hybrid.c -@@ -38,7 +38,7 @@ static void config_hybrid_attr(struct perf_event_attr *attr, - - static int create_event_hybrid(__u32 config_type, int *idx, - struct list_head *list, -- struct perf_event_attr *attr, char *name, -+ struct perf_event_attr *attr, const char *name, - struct list_head *config_terms, - struct perf_pmu *pmu) - { -@@ -70,7 +70,7 @@ static int pmu_cmp(struct parse_events_state *parse_state, - - static int add_hw_hybrid(struct parse_events_state *parse_state, - struct list_head *list, struct perf_event_attr *attr, -- char *name, struct list_head *config_terms) -+ const char *name, struct list_head *config_terms) - { - struct perf_pmu *pmu; - int ret; -@@ -94,7 +94,8 @@ static int add_hw_hybrid(struct parse_events_state *parse_state, - } - - static int create_raw_event_hybrid(int *idx, struct list_head *list, -- struct perf_event_attr *attr, char *name, -+ struct perf_event_attr *attr, -+ const char *name, - struct list_head *config_terms, - struct perf_pmu *pmu) - { -@@ -113,7 +114,7 @@ static int create_raw_event_hybrid(int *idx, struct list_head *list, - - static int add_raw_hybrid(struct parse_events_state *parse_state, - struct list_head *list, struct perf_event_attr *attr, -- char *name, struct list_head *config_terms) -+ const char *name, struct list_head *config_terms) - { - struct perf_pmu *pmu; - int ret; -@@ -138,7 +139,8 @@ static int add_raw_hybrid(struct parse_events_state *parse_state, - int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - struct list_head *list, - struct perf_event_attr *attr, -- char *name, struct list_head *config_terms, -+ const char *name, -+ struct list_head *config_terms, - bool *hybrid) - { - *hybrid = false; -@@ -159,7 +161,8 @@ int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - } - - int parse_events__add_cache_hybrid(struct list_head *list, int *idx, -- struct perf_event_attr *attr, char *name, -+ struct perf_event_attr *attr, -+ const char *name, - struct list_head *config_terms, - bool *hybrid, - struct parse_events_state *parse_state) -diff --git a/tools/perf/util/parse-events-hybrid.h b/tools/perf/util/parse-events-hybrid.h -index f33bd67aa851..25a4a4f73f3a 100644 ---- a/tools/perf/util/parse-events-hybrid.h -+++ b/tools/perf/util/parse-events-hybrid.h -@@ -11,11 +11,13 @@ - int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - struct list_head *list, - struct perf_event_attr *attr, -- char *name, struct list_head *config_terms, -+ const char *name, -+ struct list_head *config_terms, - bool *hybrid); - - int parse_events__add_cache_hybrid(struct list_head *list, int *idx, -- struct perf_event_attr *attr, char *name, -+ struct perf_event_attr *attr, -+ const char *name, - struct list_head *config_terms, - bool *hybrid, - struct parse_events_state *parse_state); -diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c -index b93a36ffeb9e..aaeebf0752b7 100644 ---- a/tools/perf/util/parse-events.c -+++ b/tools/perf/util/parse-events.c -@@ -347,7 +347,7 @@ static int parse_events__is_name_term(struct parse_events_term *term) - return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; - } - --static char *get_config_name(struct list_head *head_terms) -+static const char *get_config_name(struct list_head *head_terms) - { - struct parse_events_term *term; - -@@ -365,7 +365,7 @@ static struct evsel * - __add_event(struct list_head *list, int *idx, - struct perf_event_attr *attr, - bool init_attr, -- char *name, struct perf_pmu *pmu, -+ const char *name, struct perf_pmu *pmu, - struct list_head *config_terms, bool auto_merge_stats, - const char *cpu_list) - { -@@ -404,14 +404,14 @@ __add_event(struct list_head *list, int *idx, - } - - struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, -- char *name, struct perf_pmu *pmu) -+ const char *name, struct perf_pmu *pmu) - { - return __add_event(NULL, &idx, attr, false, name, pmu, NULL, false, - NULL); - } - - static int add_event(struct list_head *list, int *idx, -- struct perf_event_attr *attr, char *name, -+ struct perf_event_attr *attr, const char *name, - struct list_head *config_terms) - { - return __add_event(list, idx, attr, true, name, NULL, config_terms, -@@ -474,7 +474,8 @@ int parse_events_add_cache(struct list_head *list, int *idx, - { - struct perf_event_attr attr; - LIST_HEAD(config_terms); -- char name[MAX_NAME_LEN], *config_name; -+ char name[MAX_NAME_LEN]; -+ const char *config_name; - int cache_type = -1, cache_op = -1, cache_result = -1; - char *op_result[2] = { op_result1, op_result2 }; - int i, n, ret; -@@ -2038,7 +2039,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add) - return 0; - } - --int parse_events_name(struct list_head *list, char *name) -+int parse_events_name(struct list_head *list, const char *name) - { - struct evsel *evsel; - -@@ -3295,7 +3296,7 @@ char *parse_events_formats_error_string(char *additional_terms) - - struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, -- char *name, struct perf_pmu *pmu, -+ const char *name, struct perf_pmu *pmu, - struct list_head *config_terms) - { - return __add_event(list, idx, attr, true, name, pmu, -diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h -index bf6e41aa9b6a..6ef506c1b29e 100644 ---- a/tools/perf/util/parse-events.h -+++ b/tools/perf/util/parse-events.h -@@ -162,7 +162,7 @@ void parse_events_terms__purge(struct list_head *terms); - void parse_events__clear_array(struct parse_events_array *a); - int parse_events__modifier_event(struct list_head *list, char *str, bool add); - int parse_events__modifier_group(struct list_head *list, char *event_mod); --int parse_events_name(struct list_head *list, char *name); -+int parse_events_name(struct list_head *list, const char *name); - int parse_events_add_tracepoint(struct list_head *list, int *idx, - const char *sys, const char *event, - struct parse_events_error *error, -@@ -200,7 +200,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, - bool use_alias); - - struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, -- char *name, struct perf_pmu *pmu); -+ const char *name, struct perf_pmu *pmu); - - int parse_events_multi_pmu_add(struct parse_events_state *parse_state, - char *str, -@@ -267,7 +267,8 @@ int perf_pmu__test_parse_init(void); - - struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, -- char *name, struct perf_pmu *pmu, -+ const char *name, -+ struct perf_pmu *pmu, - struct list_head *config_terms); - - #endif /* __PERF_PARSE_EVENTS_H */ -diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c -index bdabd62170d2..c647b3633d1d 100644 ---- a/tools/perf/util/pmu.c -+++ b/tools/perf/util/pmu.c -@@ -1906,7 +1906,7 @@ int perf_pmu__caps_parse(struct perf_pmu *pmu) - } - - void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, -- char *name) -+ const char *name) - { - struct perf_pmu_format *format; - __u64 masks = 0, bits; -diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h -index 394898b07fd9..dd0736de32c8 100644 ---- a/tools/perf/util/pmu.h -+++ b/tools/perf/util/pmu.h -@@ -134,7 +134,7 @@ int perf_pmu__convert_scale(const char *scale, char **end, double *sval); - int perf_pmu__caps_parse(struct perf_pmu *pmu); - - void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, -- char *name); -+ const char *name); - - bool perf_pmu__has_hybrid(void); - int perf_pmu__match(char *pattern, char *name, char *tok); --- -2.35.1 - diff --git a/queue-5.15/perf-parse-events-add-new-metric-id-term.patch b/queue-5.15/perf-parse-events-add-new-metric-id-term.patch deleted file mode 100644 index 8db8bbd7523..00000000000 --- a/queue-5.15/perf-parse-events-add-new-metric-id-term.patch +++ /dev/null @@ -1,597 +0,0 @@ -From 082651a7812b0dba20aaea970ebd529b78f6202d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 15 Oct 2021 10:21:25 -0700 -Subject: perf parse-events: Add new "metric-id" term - -From: Ian Rogers - -[ Upstream commit 2b62b3a611715d3ca612e3225cf436277ed9648b ] - -Add a new "metric-id" term to events so that metric parsing can set an -ID that can be reliably looked up. - -Metric parsing currently will turn a metric like "instructions/cycles" -into a parse events string of "{instructions,cycles}:W". - -However, parse-events may change "instructions" into "instructions:u" if -perf_event_paranoid=2. - -When this happens expr__resolve_id currently fails as stat-shadow adds -the ID "instructions:u" to match with the counter value and the metric -tries to look up the ID just "instructions". - -A later patch will use the new term. - -An example of the current problem: - - $ echo -1 > /proc/sys/kernel/perf_event_paranoid - $ perf stat -M IPC /bin/true - Performance counter stats for '/bin/true': - - 1,217,161 inst_retired.any # 0.97 IPC - 1,250,389 cpu_clk_unhalted.thread - - 0.002064773 seconds time elapsed - - 0.002378000 seconds user - 0.000000000 seconds sys - - $ echo 2 > /proc/sys/kernel/perf_event_paranoid - $ perf stat -M IPC /bin/true - Performance counter stats for '/bin/true': - - 150,298 inst_retired.any:u # nan IPC - 187,095 cpu_clk_unhalted.thread:u - - 0.002042731 seconds time elapsed - - 0.000000000 seconds user - 0.002377000 seconds sys - -Note: nan IPC is printed as an effect of "perf metric: Use NAN for -missing event IDs." but earlier versions of perf just fail with a parse -error and display no value. - -Signed-off-by: Ian Rogers -Acked-by: Andi Kleen -Cc: Adrian Hunter -Cc: Alexander Antonov -Cc: Alexander Shishkin -Cc: Andrew Kilroy -Cc: Andrew Morton -Cc: Changbin Du -Cc: Denys Zagorui -Cc: Fabian Hemmer -Cc: Felix Fietkau -Cc: Heiko Carstens -Cc: Ingo Molnar -Cc: Jacob Keller -Cc: Jiapeng Chong -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Joakim Zhang -Cc: John Garry -Cc: Kajol Jain -Cc: Kan Liang -Cc: Kees Kook -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Nicholas Fraser -Cc: Nick Desaulniers -Cc: Paul Clarke -Cc: Peter Zijlstra -Cc: Riccardo Mancini -Cc: Sami Tolvanen -Cc: ShihCheng Tu -Cc: Song Liu -Cc: Stephane Eranian -Cc: Sumanth Korikkar -Cc: Thomas Richter -Cc: Wan Jiabing -Cc: Zhen Lei -Link: https://lore.kernel.org/r/20211015172132.1162559-15-irogers@google.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/util/evsel.c | 17 +++++ - tools/perf/util/evsel.h | 2 + - tools/perf/util/parse-events-hybrid.c | 25 ++++--- - tools/perf/util/parse-events-hybrid.h | 4 +- - tools/perf/util/parse-events.c | 95 ++++++++++++++++++--------- - tools/perf/util/parse-events.h | 5 +- - tools/perf/util/parse-events.l | 1 + - tools/perf/util/pfm.c | 3 +- - 8 files changed, 107 insertions(+), 45 deletions(-) - -diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c -index c87f9974c0c1..1e43fac90fc8 100644 ---- a/tools/perf/util/evsel.c -+++ b/tools/perf/util/evsel.c -@@ -410,6 +410,11 @@ struct evsel *evsel__clone(struct evsel *orig) - if (evsel->filter == NULL) - goto out_err; - } -+ if (orig->metric_id) { -+ evsel->metric_id = strdup(orig->metric_id); -+ if (evsel->metric_id == NULL) -+ goto out_err; -+ } - evsel->cgrp = cgroup__get(orig->cgrp); - evsel->tp_format = orig->tp_format; - evsel->handler = orig->handler; -@@ -779,6 +784,17 @@ const char *evsel__name(struct evsel *evsel) - return "unknown"; - } - -+const char *evsel__metric_id(const struct evsel *evsel) -+{ -+ if (evsel->metric_id) -+ return evsel->metric_id; -+ -+ if (evsel->core.attr.type == PERF_TYPE_SOFTWARE && evsel->tool_event) -+ return "duration_time"; -+ -+ return "unknown"; -+} -+ - const char *evsel__group_name(struct evsel *evsel) - { - return evsel->group_name ?: "anon group"; -@@ -1432,6 +1448,7 @@ void evsel__exit(struct evsel *evsel) - zfree(&evsel->group_name); - zfree(&evsel->name); - zfree(&evsel->pmu_name); -+ zfree(&evsel->metric_id); - evsel__zero_per_pkg(evsel); - hashmap__free(evsel->per_pkg_mask); - evsel->per_pkg_mask = NULL; -diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h -index 1f7edfa8568a..45476a888942 100644 ---- a/tools/perf/util/evsel.h -+++ b/tools/perf/util/evsel.h -@@ -68,6 +68,7 @@ struct evsel { - double scale; - const char *unit; - struct cgroup *cgrp; -+ const char *metric_id; - enum perf_tool_event tool_event; - /* parse modifier helper */ - int exclude_GH; -@@ -261,6 +262,7 @@ bool evsel__match_bpf_counter_events(const char *name); - - int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size); - const char *evsel__name(struct evsel *evsel); -+const char *evsel__metric_id(const struct evsel *evsel); - - const char *evsel__group_name(struct evsel *evsel); - int evsel__group_desc(struct evsel *evsel, char *buf, size_t size); -diff --git a/tools/perf/util/parse-events-hybrid.c b/tools/perf/util/parse-events-hybrid.c -index 7e44deee1343..9fc86971027b 100644 ---- a/tools/perf/util/parse-events-hybrid.c -+++ b/tools/perf/util/parse-events-hybrid.c -@@ -39,6 +39,7 @@ static void config_hybrid_attr(struct perf_event_attr *attr, - static int create_event_hybrid(__u32 config_type, int *idx, - struct list_head *list, - struct perf_event_attr *attr, const char *name, -+ const char *metric_id, - struct list_head *config_terms, - struct perf_pmu *pmu) - { -@@ -47,7 +48,7 @@ static int create_event_hybrid(__u32 config_type, int *idx, - __u64 config = attr->config; - - config_hybrid_attr(attr, config_type, pmu->type); -- evsel = parse_events__add_event_hybrid(list, idx, attr, name, -+ evsel = parse_events__add_event_hybrid(list, idx, attr, name, metric_id, - pmu, config_terms); - if (evsel) - evsel->pmu_name = strdup(pmu->name); -@@ -70,7 +71,8 @@ static int pmu_cmp(struct parse_events_state *parse_state, - - static int add_hw_hybrid(struct parse_events_state *parse_state, - struct list_head *list, struct perf_event_attr *attr, -- const char *name, struct list_head *config_terms) -+ const char *name, const char *metric_id, -+ struct list_head *config_terms) - { - struct perf_pmu *pmu; - int ret; -@@ -84,7 +86,7 @@ static int add_hw_hybrid(struct parse_events_state *parse_state, - copy_config_terms(&terms, config_terms); - ret = create_event_hybrid(PERF_TYPE_HARDWARE, - &parse_state->idx, list, attr, name, -- &terms, pmu); -+ metric_id, &terms, pmu); - free_config_terms(&terms); - if (ret) - return ret; -@@ -96,13 +98,14 @@ static int add_hw_hybrid(struct parse_events_state *parse_state, - static int create_raw_event_hybrid(int *idx, struct list_head *list, - struct perf_event_attr *attr, - const char *name, -+ const char *metric_id, - struct list_head *config_terms, - struct perf_pmu *pmu) - { - struct evsel *evsel; - - attr->type = pmu->type; -- evsel = parse_events__add_event_hybrid(list, idx, attr, name, -+ evsel = parse_events__add_event_hybrid(list, idx, attr, name, metric_id, - pmu, config_terms); - if (evsel) - evsel->pmu_name = strdup(pmu->name); -@@ -114,7 +117,8 @@ static int create_raw_event_hybrid(int *idx, struct list_head *list, - - static int add_raw_hybrid(struct parse_events_state *parse_state, - struct list_head *list, struct perf_event_attr *attr, -- const char *name, struct list_head *config_terms) -+ const char *name, const char *metric_id, -+ struct list_head *config_terms) - { - struct perf_pmu *pmu; - int ret; -@@ -127,7 +131,7 @@ static int add_raw_hybrid(struct parse_events_state *parse_state, - - copy_config_terms(&terms, config_terms); - ret = create_raw_event_hybrid(&parse_state->idx, list, attr, -- name, &terms, pmu); -+ name, metric_id, &terms, pmu); - free_config_terms(&terms); - if (ret) - return ret; -@@ -139,7 +143,7 @@ static int add_raw_hybrid(struct parse_events_state *parse_state, - int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - struct list_head *list, - struct perf_event_attr *attr, -- const char *name, -+ const char *name, const char *metric_id, - struct list_head *config_terms, - bool *hybrid) - { -@@ -152,17 +156,18 @@ int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - - *hybrid = true; - if (attr->type != PERF_TYPE_RAW) { -- return add_hw_hybrid(parse_state, list, attr, name, -+ return add_hw_hybrid(parse_state, list, attr, name, metric_id, - config_terms); - } - -- return add_raw_hybrid(parse_state, list, attr, name, -+ return add_raw_hybrid(parse_state, list, attr, name, metric_id, - config_terms); - } - - int parse_events__add_cache_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, - const char *name, -+ const char *metric_id, - struct list_head *config_terms, - bool *hybrid, - struct parse_events_state *parse_state) -@@ -183,7 +188,7 @@ int parse_events__add_cache_hybrid(struct list_head *list, int *idx, - - copy_config_terms(&terms, config_terms); - ret = create_event_hybrid(PERF_TYPE_HW_CACHE, idx, list, -- attr, name, &terms, pmu); -+ attr, name, metric_id, &terms, pmu); - free_config_terms(&terms); - if (ret) - return ret; -diff --git a/tools/perf/util/parse-events-hybrid.h b/tools/perf/util/parse-events-hybrid.h -index 25a4a4f73f3a..cbc05fec02a2 100644 ---- a/tools/perf/util/parse-events-hybrid.h -+++ b/tools/perf/util/parse-events-hybrid.h -@@ -11,13 +11,13 @@ - int parse_events__add_numeric_hybrid(struct parse_events_state *parse_state, - struct list_head *list, - struct perf_event_attr *attr, -- const char *name, -+ const char *name, const char *metric_id, - struct list_head *config_terms, - bool *hybrid); - - int parse_events__add_cache_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, -- const char *name, -+ const char *name, const char *metric_id, - struct list_head *config_terms, - bool *hybrid, - struct parse_events_state *parse_state); -diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c -index aaeebf0752b7..e62514577b97 100644 ---- a/tools/perf/util/parse-events.c -+++ b/tools/perf/util/parse-events.c -@@ -342,12 +342,7 @@ const char *event_type(int type) - return "unknown"; - } - --static int parse_events__is_name_term(struct parse_events_term *term) --{ -- return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME; --} -- --static const char *get_config_name(struct list_head *head_terms) -+static char *get_config_str(struct list_head *head_terms, int type_term) - { - struct parse_events_term *term; - -@@ -355,17 +350,27 @@ static const char *get_config_name(struct list_head *head_terms) - return NULL; - - list_for_each_entry(term, head_terms, list) -- if (parse_events__is_name_term(term)) -+ if (term->type_term == type_term) - return term->val.str; - - return NULL; - } - -+static char *get_config_metric_id(struct list_head *head_terms) -+{ -+ return get_config_str(head_terms, PARSE_EVENTS__TERM_TYPE_METRIC_ID); -+} -+ -+static char *get_config_name(struct list_head *head_terms) -+{ -+ return get_config_str(head_terms, PARSE_EVENTS__TERM_TYPE_NAME); -+} -+ - static struct evsel * - __add_event(struct list_head *list, int *idx, - struct perf_event_attr *attr, - bool init_attr, -- const char *name, struct perf_pmu *pmu, -+ const char *name, const char *metric_id, struct perf_pmu *pmu, - struct list_head *config_terms, bool auto_merge_stats, - const char *cpu_list) - { -@@ -394,6 +399,9 @@ __add_event(struct list_head *list, int *idx, - if (name) - evsel->name = strdup(name); - -+ if (metric_id) -+ evsel->metric_id = strdup(metric_id); -+ - if (config_terms) - list_splice_init(config_terms, &evsel->config_terms); - -@@ -404,18 +412,21 @@ __add_event(struct list_head *list, int *idx, - } - - struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, -- const char *name, struct perf_pmu *pmu) -+ const char *name, const char *metric_id, -+ struct perf_pmu *pmu) - { -- return __add_event(NULL, &idx, attr, false, name, pmu, NULL, false, -- NULL); -+ return __add_event(/*list=*/NULL, &idx, attr, /*init_attr=*/false, name, -+ metric_id, pmu, /*config_terms=*/NULL, -+ /*auto_merge_stats=*/false, /*cpu_list=*/NULL); - } - - static int add_event(struct list_head *list, int *idx, - struct perf_event_attr *attr, const char *name, -- struct list_head *config_terms) -+ const char *metric_id, struct list_head *config_terms) - { -- return __add_event(list, idx, attr, true, name, NULL, config_terms, -- false, NULL) ? 0 : -ENOMEM; -+ return __add_event(list, idx, attr, /*init_attr*/true, name, metric_id, -+ /*pmu=*/NULL, config_terms, -+ /*auto_merge_stats=*/false, /*cpu_list=*/NULL) ? 0 : -ENOMEM; - } - - static int add_event_tool(struct list_head *list, int *idx, -@@ -427,8 +438,10 @@ static int add_event_tool(struct list_head *list, int *idx, - .config = PERF_COUNT_SW_DUMMY, - }; - -- evsel = __add_event(list, idx, &attr, true, NULL, NULL, NULL, false, -- "0"); -+ evsel = __add_event(list, idx, &attr, /*init_attr=*/true, /*name=*/NULL, -+ /*metric_id=*/NULL, /*pmu=*/NULL, -+ /*config_terms=*/NULL, /*auto_merge_stats=*/false, -+ /*cpu_list=*/"0"); - if (!evsel) - return -ENOMEM; - evsel->tool_event = tool_event; -@@ -475,7 +488,7 @@ int parse_events_add_cache(struct list_head *list, int *idx, - struct perf_event_attr attr; - LIST_HEAD(config_terms); - char name[MAX_NAME_LEN]; -- const char *config_name; -+ const char *config_name, *metric_id; - int cache_type = -1, cache_op = -1, cache_result = -1; - char *op_result[2] = { op_result1, op_result2 }; - int i, n, ret; -@@ -540,13 +553,17 @@ int parse_events_add_cache(struct list_head *list, int *idx, - return -ENOMEM; - } - -+ metric_id = get_config_metric_id(head_config); - ret = parse_events__add_cache_hybrid(list, idx, &attr, -- config_name ? : name, &config_terms, -+ config_name ? : name, -+ metric_id, -+ &config_terms, - &hybrid, parse_state); - if (hybrid) - goto out_free_terms; - -- ret = add_event(list, idx, &attr, config_name ? : name, &config_terms); -+ ret = add_event(list, idx, &attr, config_name ? : name, metric_id, -+ &config_terms); - out_free_terms: - free_config_terms(&config_terms); - return ret; -@@ -1023,7 +1040,8 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, - attr.type = PERF_TYPE_BREAKPOINT; - attr.sample_period = 1; - -- return add_event(list, idx, &attr, NULL, NULL); -+ return add_event(list, idx, &attr, /*name=*/NULL, /*mertic_id=*/NULL, -+ /*config_terms=*/NULL); - } - - static int check_type_val(struct parse_events_term *term, -@@ -1068,6 +1086,7 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = { - [PARSE_EVENTS__TERM_TYPE_PERCORE] = "percore", - [PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT] = "aux-output", - [PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE] = "aux-sample-size", -+ [PARSE_EVENTS__TERM_TYPE_METRIC_ID] = "metric-id", - }; - - static bool config_term_shrinked; -@@ -1090,6 +1109,7 @@ config_term_avail(int term_type, struct parse_events_error *err) - case PARSE_EVENTS__TERM_TYPE_CONFIG1: - case PARSE_EVENTS__TERM_TYPE_CONFIG2: - case PARSE_EVENTS__TERM_TYPE_NAME: -+ case PARSE_EVENTS__TERM_TYPE_METRIC_ID: - case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD: - case PARSE_EVENTS__TERM_TYPE_PERCORE: - return true; -@@ -1180,6 +1200,9 @@ do { \ - case PARSE_EVENTS__TERM_TYPE_NAME: - CHECK_TYPE_VAL(STR); - break; -+ case PARSE_EVENTS__TERM_TYPE_METRIC_ID: -+ CHECK_TYPE_VAL(STR); -+ break; - case PARSE_EVENTS__TERM_TYPE_MAX_STACK: - CHECK_TYPE_VAL(NUM); - break; -@@ -1449,6 +1472,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, - { - struct perf_event_attr attr; - LIST_HEAD(config_terms); -+ const char *name, *metric_id; - bool hybrid; - int ret; - -@@ -1465,14 +1489,16 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, - return -ENOMEM; - } - -+ name = get_config_name(head_config); -+ metric_id = get_config_metric_id(head_config); - ret = parse_events__add_numeric_hybrid(parse_state, list, &attr, -- get_config_name(head_config), -+ name, metric_id, - &config_terms, &hybrid); - if (hybrid) - goto out_free_terms; - -- ret = add_event(list, &parse_state->idx, &attr, -- get_config_name(head_config), &config_terms); -+ ret = add_event(list, &parse_state->idx, &attr, name, metric_id, -+ &config_terms); - out_free_terms: - free_config_terms(&config_terms); - return ret; -@@ -1574,8 +1600,11 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, - - if (!head_config) { - attr.type = pmu->type; -- evsel = __add_event(list, &parse_state->idx, &attr, true, NULL, -- pmu, NULL, auto_merge_stats, NULL); -+ evsel = __add_event(list, &parse_state->idx, &attr, -+ /*init_attr=*/true, /*name=*/NULL, -+ /*metric_id=*/NULL, pmu, -+ /*config_terms=*/NULL, auto_merge_stats, -+ /*cpu_list=*/NULL); - if (evsel) { - evsel->pmu_name = name ? strdup(name) : NULL; - evsel->use_uncore_alias = use_uncore_alias; -@@ -1628,9 +1657,10 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, - return -EINVAL; - } - -- evsel = __add_event(list, &parse_state->idx, &attr, true, -- get_config_name(head_config), pmu, -- &config_terms, auto_merge_stats, NULL); -+ evsel = __add_event(list, &parse_state->idx, &attr, /*init_attr=*/true, -+ get_config_name(head_config), -+ get_config_metric_id(head_config), pmu, -+ &config_terms, auto_merge_stats, /*cpu_list=*/NULL); - if (!evsel) - return -ENOMEM; - -@@ -3296,9 +3326,12 @@ char *parse_events_formats_error_string(char *additional_terms) - - struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, -- const char *name, struct perf_pmu *pmu, -+ const char *name, -+ const char *metric_id, -+ struct perf_pmu *pmu, - struct list_head *config_terms) - { -- return __add_event(list, idx, attr, true, name, pmu, -- config_terms, false, NULL); -+ return __add_event(list, idx, attr, /*init_attr=*/true, name, metric_id, -+ pmu, config_terms, /*auto_merge_stats=*/false, -+ /*cpu_list=*/NULL); - } -diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h -index 6ef506c1b29e..9de27b7c9eec 100644 ---- a/tools/perf/util/parse-events.h -+++ b/tools/perf/util/parse-events.h -@@ -87,6 +87,7 @@ enum { - PARSE_EVENTS__TERM_TYPE_PERCORE, - PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT, - PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE, -+ PARSE_EVENTS__TERM_TYPE_METRIC_ID, - __PARSE_EVENTS__TERM_TYPE_NR, - }; - -@@ -200,7 +201,8 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, - bool use_alias); - - struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr, -- const char *name, struct perf_pmu *pmu); -+ const char *name, const char *metric_id, -+ struct perf_pmu *pmu); - - int parse_events_multi_pmu_add(struct parse_events_state *parse_state, - char *str, -@@ -268,6 +270,7 @@ int perf_pmu__test_parse_init(void); - struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, - const char *name, -+ const char *metric_id, - struct perf_pmu *pmu, - struct list_head *config_terms); - -diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l -index 923849024b15..b752eb2c620a 100644 ---- a/tools/perf/util/parse-events.l -+++ b/tools/perf/util/parse-events.l -@@ -295,6 +295,7 @@ no-overwrite { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); } - percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); } - aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } - aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE); } -+metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } - r{num_raw_hex} { return raw(yyscanner); } - r0x{num_raw_hex} { return raw(yyscanner); } - , { return ','; } -diff --git a/tools/perf/util/pfm.c b/tools/perf/util/pfm.c -index 756295dedccc..f0bcfcab1a93 100644 ---- a/tools/perf/util/pfm.c -+++ b/tools/perf/util/pfm.c -@@ -87,7 +87,8 @@ int parse_libpfm_events_option(const struct option *opt, const char *str, - - pmu = perf_pmu__find_by_type((unsigned int)attr.type); - evsel = parse_events__add_event(evlist->core.nr_entries, -- &attr, q, pmu); -+ &attr, q, /*metric_id=*/NULL, -+ pmu); - if (evsel == NULL) - goto error; - --- -2.35.1 - diff --git a/queue-5.15/perf-parse-events-identify-broken-modifiers.patch b/queue-5.15/perf-parse-events-identify-broken-modifiers.patch deleted file mode 100644 index 875939690d2..00000000000 --- a/queue-5.15/perf-parse-events-identify-broken-modifiers.patch +++ /dev/null @@ -1,108 +0,0 @@ -From c2cc7442de4aac9fadc5ea07cd3ebd72a4d0ee26 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 15 Oct 2021 10:21:31 -0700 -Subject: perf parse-events: Identify broken modifiers - -From: Ian Rogers - -[ Upstream commit eabd4523395e4a8f2b049165642801f2ab8ff893 ] - -Previously the broken modifier causes a usage message to printed but -nothing else. - -After: - - $ perf stat -e 'cycles:kk' -a sleep 2 - event syntax error: 'cycles:kk' - \___ Bad modifier - Run 'perf list' for a list of valid events - - Usage: perf stat [] [] - - -e, --event event selector. use 'perf list' to list available events - - $ perf stat -e '{instructions,cycles}:kk' -a sleep 2 - event syntax error: '..ns,cycles}:kk' - \___ Bad modifier - Run 'perf list' for a list of valid events - - Usage: perf stat [] [] - - -e, --event event selector. use 'perf list' to list available events - -Signed-off-by: Ian Rogers -Acked-by: Andi Kleen -Cc: Adrian Hunter -Cc: Alexander Antonov -Cc: Alexander Shishkin -Cc: Andrew Kilroy -Cc: Andrew Morton -Cc: Changbin Du -Cc: Denys Zagorui -Cc: Fabian Hemmer -Cc: Felix Fietkau -Cc: Heiko Carstens -Cc: Ingo Molnar -Cc: Jacob Keller -Cc: Jiapeng Chong -Cc: Jin Yao -Cc: Jiri Olsa -Cc: Joakim Zhang -Cc: John Garry -Cc: Kajol Jain -Cc: Kan Liang -Cc: Kees Kook -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Nicholas Fraser -Cc: Nick Desaulniers -Cc: Paul Clarke -Cc: Peter Zijlstra -Cc: Riccardo Mancini -Cc: Sami Tolvanen -Cc: ShihCheng Tu -Cc: Song Liu -Cc: Stephane Eranian -Cc: Sumanth Korikkar -Cc: Thomas Richter -Cc: Wan Jiabing -Cc: Zhen Lei -Link: https://lore.kernel.org/r/20211015172132.1162559-21-irogers@google.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/util/parse-events.y | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y -index d94e48e1ff9b..467a426205a0 100644 ---- a/tools/perf/util/parse-events.y -+++ b/tools/perf/util/parse-events.y -@@ -183,6 +183,11 @@ group_def ':' PE_MODIFIER_EVENT - err = parse_events__modifier_group(list, $3); - free($3); - if (err) { -+ struct parse_events_state *parse_state = _parse_state; -+ struct parse_events_error *error = parse_state->error; -+ -+ parse_events__handle_error(error, @3.first_column, -+ strdup("Bad modifier"), NULL); - free_list_evsel(list); - YYABORT; - } -@@ -240,6 +245,11 @@ event_name PE_MODIFIER_EVENT - err = parse_events__modifier_event(list, $2, false); - free($2); - if (err) { -+ struct parse_events_state *parse_state = _parse_state; -+ struct parse_events_error *error = parse_state->error; -+ -+ parse_events__handle_error(error, @2.first_column, -+ strdup("Bad modifier"), NULL); - free_list_evsel(list); - YYABORT; - } --- -2.35.1 - diff --git a/queue-5.15/perf-pmu-fix-alias-events-list.patch b/queue-5.15/perf-pmu-fix-alias-events-list.patch deleted file mode 100644 index 21c5f2ab95c..00000000000 --- a/queue-5.15/perf-pmu-fix-alias-events-list.patch +++ /dev/null @@ -1,96 +0,0 @@ -From e0257a01d6689c273a019756ed5e13911cc1bfed Mon Sep 17 00:00:00 2001 -From: John Garry -Date: Wed, 22 Dec 2021 00:11:30 +0800 -Subject: perf pmu: Fix alias events list - -From: John Garry - -commit e0257a01d6689c273a019756ed5e13911cc1bfed upstream. - -Commit 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu -type") changes the event list for uncore PMUs or arm64 heterogeneous CPU -systems, such that duplicate aliases are incorrectly listed per PMU -(which they should not be), like: - - # perf list - ... - unc_cbo_cache_lookup.any_es - [Unit: uncore_cbox L3 Lookup any request that access cache and found - line in E or S-state] - unc_cbo_cache_lookup.any_es - [Unit: uncore_cbox L3 Lookup any request that access cache and found - line in E or S-state] - unc_cbo_cache_lookup.any_i - [Unit: uncore_cbox L3 Lookup any request that access cache and found - line in I-state] - unc_cbo_cache_lookup.any_i - [Unit: uncore_cbox L3 Lookup any request that access cache and found - line in I-state] - ... - -Notice how the events are listed twice. - -The named commit changed how we remove duplicate events, in that events -for different PMUs are not treated as duplicates. I suppose this is to -handle how "Each hybrid pmu event has been assigned with a pmu name". - -Fix PMU alias listing by restoring behaviour to remove duplicates for -non-hybrid PMUs. - -Fixes: 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu type") -Signed-off-by: John Garry -Tested-by: Zhengjun Xing -Cc: Alexander Shishkin -Cc: Ian Rogers -Cc: Ingo Molnar -Cc: Jiri Olsa -Cc: Kan Liang -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Peter Zijlstra -Link: https://lore.kernel.org/r/1640103090-140490-1-git-send-email-john.garry@huawei.com -Signed-off-by: Arnaldo Carvalho de Melo -Signed-off-by: Greg Kroah-Hartman ---- - tools/perf/util/pmu.c | 23 +++++++++++++++++------ - 1 file changed, 17 insertions(+), 6 deletions(-) - ---- a/tools/perf/util/pmu.c -+++ b/tools/perf/util/pmu.c -@@ -1659,6 +1659,21 @@ bool is_pmu_core(const char *name) - return !strcmp(name, "cpu") || is_arm_pmu_core(name); - } - -+static bool pmu_alias_is_duplicate(struct sevent *alias_a, -+ struct sevent *alias_b) -+{ -+ /* Different names -> never duplicates */ -+ if (strcmp(alias_a->name, alias_b->name)) -+ return false; -+ -+ /* Don't remove duplicates for hybrid PMUs */ -+ if (perf_pmu__is_hybrid(alias_a->pmu) && -+ perf_pmu__is_hybrid(alias_b->pmu)) -+ return false; -+ -+ return true; -+} -+ - void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, - bool long_desc, bool details_flag, bool deprecated, - const char *pmu_name) -@@ -1744,12 +1759,8 @@ void print_pmu_events(const char *event_ - qsort(aliases, len, sizeof(struct sevent), cmp_sevent); - for (j = 0; j < len; j++) { - /* Skip duplicates */ -- if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) { -- if (!aliases[j].pmu || !aliases[j - 1].pmu || -- !strcmp(aliases[j].pmu, aliases[j - 1].pmu)) { -- continue; -- } -- } -+ if (j > 0 && pmu_alias_is_duplicate(&aliases[j], &aliases[j - 1])) -+ continue; - - if (name_only) { - printf("%s ", aliases[j].name); diff --git a/queue-5.15/perf-tools-check-vmlinux-kallsyms-arguments-in-all-t.patch b/queue-5.15/perf-tools-check-vmlinux-kallsyms-arguments-in-all-t.patch deleted file mode 100644 index eab3cf129fd..00000000000 --- a/queue-5.15/perf-tools-check-vmlinux-kallsyms-arguments-in-all-t.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 5bfe448a3416e5cb7fe7c43623279e9d0c811407 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 18 Oct 2021 14:48:42 +0100 -Subject: perf tools: Check vmlinux/kallsyms arguments in all tools - -From: James Clark - -[ Upstream commit 7cc72553ac03ec20afe2dec91dce4624ccd379b8 ] - -Only perf report checked the validity of these arguments so apply the -same check to all tools that read them for consistency. - -Signed-off-by: James Clark -Cc: Alexander Shishkin -Cc: Denis Nikitin -Cc: Jiri Olsa -Cc: Mark Rutland -Cc: Namhyung Kim -Link: https://lore.kernel.org/r/20211018134844.2627174-3-james.clark@arm.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/builtin-annotate.c | 4 ++++ - tools/perf/builtin-c2c.c | 4 ++++ - tools/perf/builtin-probe.c | 5 +++++ - tools/perf/builtin-record.c | 4 ++++ - tools/perf/builtin-sched.c | 4 ++++ - tools/perf/builtin-script.c | 3 +++ - tools/perf/builtin-top.c | 4 ++++ - 7 files changed, 28 insertions(+) - -diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c -index 05eb098cb0e3..490bb9b8cf17 100644 ---- a/tools/perf/builtin-annotate.c -+++ b/tools/perf/builtin-annotate.c -@@ -591,6 +591,10 @@ int cmd_annotate(int argc, const char **argv) - return ret; - } - -+ ret = symbol__validate_sym_arguments(); -+ if (ret) -+ return ret; -+ - if (quiet) - perf_quiet_option(); - -diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c -index e6f900c3accb..6d901ba6678f 100644 ---- a/tools/perf/builtin-c2c.c -+++ b/tools/perf/builtin-c2c.c -@@ -2770,6 +2770,10 @@ static int perf_c2c__report(int argc, const char **argv) - if (c2c.stats_only) - c2c.use_stdio = true; - -+ err = symbol__validate_sym_arguments(); -+ if (err) -+ goto out; -+ - if (!input_name || !strlen(input_name)) - input_name = "perf.data"; - -diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c -index e1dd51f2874b..c31627af75d4 100644 ---- a/tools/perf/builtin-probe.c -+++ b/tools/perf/builtin-probe.c -@@ -21,6 +21,7 @@ - #include "util/build-id.h" - #include "util/strlist.h" - #include "util/strfilter.h" -+#include "util/symbol.h" - #include "util/symbol_conf.h" - #include "util/debug.h" - #include -@@ -629,6 +630,10 @@ __cmd_probe(int argc, const char **argv) - params.command = 'a'; - } - -+ ret = symbol__validate_sym_arguments(); -+ if (ret) -+ return ret; -+ - if (params.quiet) { - if (verbose != 0) { - pr_err(" Error: -v and -q are exclusive.\n"); -diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c -index b3509d9d20cc..dcb3ed24fc4a 100644 ---- a/tools/perf/builtin-record.c -+++ b/tools/perf/builtin-record.c -@@ -2680,6 +2680,10 @@ int cmd_record(int argc, const char **argv) - if (quiet) - perf_quiet_option(); - -+ err = symbol__validate_sym_arguments(); -+ if (err) -+ return err; -+ - /* Make system wide (-a) the default target. */ - if (!argc && target__none(&rec->opts.target)) - rec->opts.target.system_wide = true; -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 635a6b5a9ec9..4527f632ebe4 100644 ---- a/tools/perf/builtin-sched.c -+++ b/tools/perf/builtin-sched.c -@@ -3538,6 +3538,7 @@ int cmd_sched(int argc, const char **argv) - .fork_event = replay_fork_event, - }; - unsigned int i; -+ int ret; - - for (i = 0; i < ARRAY_SIZE(sched.curr_pid); i++) - sched.curr_pid[i] = -1; -@@ -3598,6 +3599,9 @@ int cmd_sched(int argc, const char **argv) - parse_options_usage(NULL, timehist_options, "n", true); - return -EINVAL; - } -+ ret = symbol__validate_sym_arguments(); -+ if (ret) -+ return ret; - - return perf_sched__timehist(&sched); - } else { -diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c -index c6c40191933d..f346275c9d21 100644 ---- a/tools/perf/builtin-script.c -+++ b/tools/perf/builtin-script.c -@@ -3839,6 +3839,9 @@ int cmd_script(int argc, const char **argv) - data.path = input_name; - data.force = symbol_conf.force; - -+ if (symbol__validate_sym_arguments()) -+ return -1; -+ - if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) { - rec_script_path = get_script_path(argv[1], RECORD_SUFFIX); - if (!rec_script_path) -diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c -index a3ae9176a83e..aa5190ecc72a 100644 ---- a/tools/perf/builtin-top.c -+++ b/tools/perf/builtin-top.c -@@ -1618,6 +1618,10 @@ int cmd_top(int argc, const char **argv) - if (argc) - usage_with_options(top_usage, options); - -+ status = symbol__validate_sym_arguments(); -+ if (status) -+ goto out_delete_evlist; -+ - if (annotate_check_args(&top.annotation_opts) < 0) - goto out_delete_evlist; - --- -2.35.1 - diff --git a/queue-5.15/perf-tools-enhance-the-matching-of-sub-commands-abbr.patch b/queue-5.15/perf-tools-enhance-the-matching-of-sub-commands-abbr.patch deleted file mode 100644 index 9c8f00063bf..00000000000 --- a/queue-5.15/perf-tools-enhance-the-matching-of-sub-commands-abbr.patch +++ /dev/null @@ -1,276 +0,0 @@ -From dfd877595c7a1781e02f81c5307883c321f5b8c6 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 25 Mar 2022 17:20:32 +0800 -Subject: perf tools: Enhance the matching of sub-commands abbreviations - -From: Wei Li - -[ Upstream commit ae0f4eb34fc3014f7eba78fab90a0e98e441a4cd ] - -We support short command 'rec*' for 'record' and 'rep*' for 'report' in -lots of sub-commands, but the matching is not quite strict currnetly. - -It may be puzzling sometime, like we mis-type a 'recport' to report but -it will perform 'record' in fact without any message. - -To fix this, add a check to ensure that the short cmd is valid prefix -of the real command. - -Committer testing: - - [root@quaco ~]# perf c2c re sleep 1 - - Usage: perf c2c {record|report} - - -v, --verbose be more verbose (show counter open errors, etc) - - # perf c2c rec sleep 1 - [ perf record: Woken up 1 times to write data ] - [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ] - # perf c2c recport sleep 1 - - Usage: perf c2c {record|report} - - -v, --verbose be more verbose (show counter open errors, etc) - - # perf c2c record sleep 1 - [ perf record: Woken up 1 times to write data ] - [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ] - # perf c2c records sleep 1 - - Usage: perf c2c {record|report} - - -v, --verbose be more verbose (show counter open errors, etc) - - # - -Signed-off-by: Wei Li -Tested-by: Arnaldo Carvalho de Melo -Cc: Alexander Shishkin -Cc: Hanjun Guo -Cc: Jiri Olsa -Cc: Mark Rutland -Cc: Namhyung Kim -Cc: Rui Xiang -Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.com -Signed-off-by: Arnaldo Carvalho de Melo -Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hybrid cache events") -Signed-off-by: Sasha Levin ---- - tools/perf/builtin-c2c.c | 5 +++-- - tools/perf/builtin-kmem.c | 2 +- - tools/perf/builtin-kvm.c | 9 +++++---- - tools/perf/builtin-lock.c | 5 +++-- - tools/perf/builtin-mem.c | 5 +++-- - tools/perf/builtin-sched.c | 4 ++-- - tools/perf/builtin-script.c | 4 ++-- - tools/perf/builtin-stat.c | 4 ++-- - tools/perf/builtin-timechart.c | 3 ++- - 9 files changed, 23 insertions(+), 18 deletions(-) - -diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c -index 6d901ba6678f..ba798c64fed9 100644 ---- a/tools/perf/builtin-c2c.c -+++ b/tools/perf/builtin-c2c.c -@@ -44,6 +44,7 @@ - #include "../perf.h" - #include "pmu.h" - #include "pmu-hybrid.h" -+#include "string2.h" - - struct c2c_hists { - struct hists hists; -@@ -3026,9 +3027,9 @@ int cmd_c2c(int argc, const char **argv) - if (!argc) - usage_with_options(c2c_usage, c2c_options); - -- if (!strncmp(argv[0], "rec", 3)) { -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - return perf_c2c__record(argc, argv); -- } else if (!strncmp(argv[0], "rep", 3)) { -+ } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) { - return perf_c2c__report(argc, argv); - } else { - usage_with_options(c2c_usage, c2c_options); -diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c -index da03a341c63c..8595e6a92d39 100644 ---- a/tools/perf/builtin-kmem.c -+++ b/tools/perf/builtin-kmem.c -@@ -1946,7 +1946,7 @@ int cmd_kmem(int argc, const char **argv) - kmem_page = 1; - } - -- if (!strncmp(argv[0], "rec", 3)) { -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - symbol__init(NULL); - return __cmd_record(argc, argv); - } -diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c -index aa1b127ffb5b..38735c405573 100644 ---- a/tools/perf/builtin-kvm.c -+++ b/tools/perf/builtin-kvm.c -@@ -24,6 +24,7 @@ - #include "util/ordered-events.h" - #include "util/kvm-stat.h" - #include "ui/ui.h" -+#include "util/string2.h" - - #include - #ifdef HAVE_TIMERFD_SUPPORT -@@ -1500,10 +1501,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv) - goto perf_stat; - } - -- if (!strncmp(argv[1], "rec", 3)) -+ if (strlen(argv[1]) > 2 && strstarts("record", argv[1])) - return kvm_events_record(&kvm, argc - 1, argv + 1); - -- if (!strncmp(argv[1], "rep", 3)) -+ if (strlen(argv[1]) > 2 && strstarts("report", argv[1])) - return kvm_events_report(&kvm, argc - 1 , argv + 1); - - #ifdef HAVE_TIMERFD_SUPPORT -@@ -1631,9 +1632,9 @@ int cmd_kvm(int argc, const char **argv) - } - } - -- if (!strncmp(argv[0], "rec", 3)) -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) - return __cmd_record(file_name, argc, argv); -- else if (!strncmp(argv[0], "rep", 3)) -+ else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) - return __cmd_report(file_name, argc, argv); - else if (!strncmp(argv[0], "diff", 4)) - return cmd_diff(argc, argv); -diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c -index d70131b7b1b1..24d402e84022 100644 ---- a/tools/perf/builtin-lock.c -+++ b/tools/perf/builtin-lock.c -@@ -18,6 +18,7 @@ - #include "util/session.h" - #include "util/tool.h" - #include "util/data.h" -+#include "util/string2.h" - - #include - #include -@@ -997,9 +998,9 @@ int cmd_lock(int argc, const char **argv) - if (!argc) - usage_with_options(lock_usage, lock_options); - -- if (!strncmp(argv[0], "rec", 3)) { -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - return __cmd_record(argc, argv); -- } else if (!strncmp(argv[0], "report", 6)) { -+ } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) { - trace_handler = &report_lock_ops; - if (argc) { - argc = parse_options(argc, argv, -diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c -index fcf65a59bea2..9e435fd23503 100644 ---- a/tools/perf/builtin-mem.c -+++ b/tools/perf/builtin-mem.c -@@ -20,6 +20,7 @@ - #include "util/symbol.h" - #include "util/pmu.h" - #include "util/pmu-hybrid.h" -+#include "util/string2.h" - #include - - #define MEM_OPERATION_LOAD 0x1 -@@ -496,9 +497,9 @@ int cmd_mem(int argc, const char **argv) - mem.input_name = "perf.data"; - } - -- if (!strncmp(argv[0], "rec", 3)) -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) - return __cmd_record(argc, argv, &mem); -- else if (!strncmp(argv[0], "rep", 3)) -+ else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) - return report_events(argc, argv, &mem); - else - usage_with_options(mem_usage, mem_options); -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index 4527f632ebe4..2cf806d66b1c 100644 ---- a/tools/perf/builtin-sched.c -+++ b/tools/perf/builtin-sched.c -@@ -3554,7 +3554,7 @@ int cmd_sched(int argc, const char **argv) - if (!strcmp(argv[0], "script")) - return cmd_script(argc, argv); - -- if (!strncmp(argv[0], "rec", 3)) { -+ if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - return __cmd_record(argc, argv); - } else if (!strncmp(argv[0], "lat", 3)) { - sched.tp_handler = &lat_ops; -@@ -3574,7 +3574,7 @@ int cmd_sched(int argc, const char **argv) - sched.tp_handler = &map_ops; - setup_sorting(&sched, latency_options, latency_usage); - return perf_sched__map(&sched); -- } else if (!strncmp(argv[0], "rep", 3)) { -+ } else if (strlen(argv[0]) > 2 && strstarts("replay", argv[0])) { - sched.tp_handler = &replay_ops; - if (argc) { - argc = parse_options(argc, argv, replay_options, replay_usage, 0); -diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c -index f346275c9d21..4baaf5652a42 100644 ---- a/tools/perf/builtin-script.c -+++ b/tools/perf/builtin-script.c -@@ -3842,13 +3842,13 @@ int cmd_script(int argc, const char **argv) - if (symbol__validate_sym_arguments()) - return -1; - -- if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) { -+ if (argc > 1 && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - rec_script_path = get_script_path(argv[1], RECORD_SUFFIX); - if (!rec_script_path) - return cmd_record(argc, argv); - } - -- if (argc > 1 && !strncmp(argv[0], "rep", strlen("rep"))) { -+ if (argc > 1 && strlen(argv[0]) > 2 && strstarts("report", argv[0])) { - rep_script_path = get_script_path(argv[1], REPORT_SUFFIX); - if (!rep_script_path) { - fprintf(stderr, -diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c -index abf88a1ad455..002eecc59536 100644 ---- a/tools/perf/builtin-stat.c -+++ b/tools/perf/builtin-stat.c -@@ -2255,11 +2255,11 @@ int cmd_stat(int argc, const char **argv) - } else - stat_config.csv_sep = DEFAULT_SEPARATOR; - -- if (argc && !strncmp(argv[0], "rec", 3)) { -+ if (argc && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - argc = __cmd_record(argc, argv); - if (argc < 0) - return -1; -- } else if (argc && !strncmp(argv[0], "rep", 3)) -+ } else if (argc && strlen(argv[0]) > 2 && strstarts("report", argv[0])) - return __cmd_report(argc, argv); - - interval = stat_config.interval; -diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c -index 43bf4d67edb0..afce731cec16 100644 ---- a/tools/perf/builtin-timechart.c -+++ b/tools/perf/builtin-timechart.c -@@ -35,6 +35,7 @@ - #include "util/tool.h" - #include "util/data.h" - #include "util/debug.h" -+#include "util/string2.h" - #include - - #ifdef LACKS_OPEN_MEMSTREAM_PROTOTYPE -@@ -1983,7 +1984,7 @@ int cmd_timechart(int argc, const char **argv) - return -1; - } - -- if (argc && !strncmp(argv[0], "rec", 3)) { -+ if (argc && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { - argc = parse_options(argc, argv, timechart_record_options, - timechart_record_usage, - PARSE_OPT_STOP_AT_NON_OPTION); --- -2.35.1 - diff --git a/queue-5.15/series b/queue-5.15/series index 8647f654635..98e9029a4b8 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -68,14 +68,5 @@ don-t-use-__kernel_write-on-kmap_local_page.patch clk-imx-imx6sx-remove-the-set_rate_parent-flag-for-q.patch clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch kvm-x86-hide-ia32_platform_dca_cap-31-0-from-the-gue.patch -perf-metric-add-documentation-and-rename-a-variable.patch -perf-metric-only-add-a-referenced-metric-once.patch -perf-parse-events-add-const-to-evsel-name.patch -perf-parse-events-add-new-metric-id-term.patch -perf-parse-events-identify-broken-modifiers.patch -perf-list-display-hybrid-pmu-events-with-cpu-type.patch -perf-tools-check-vmlinux-kallsyms-arguments-in-all-t.patch -perf-tools-enhance-the-matching-of-sub-commands-abbr.patch x86-alternative-fix-race-in-try_get_desc.patch drm-i915-gem-really-move-i915_gem_context.link-under-ref-protection.patch -perf-pmu-fix-alias-events-list.patch -- 2.47.3