* [PATCH 6.5 387/550] perf parse-events: Remove unused PE_PMU_EVENT_FAKE token
[not found] <20231115191600.708733204@linuxfoundation.org>
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 388/550] perf parse-events: Remove unused PE_KERNEL_PMU_EVENT token Greg Kroah-Hartman
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Adrian Hunter,
Alexander Shishkin, Athira Rajeev, Ingo Molnar, Jiri Olsa,
Kan Liang, Mark Rutland, Namhyung Kim, Peter Zijlstra, bpf,
Arnaldo Carvalho de Melo, Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 84efbdb7fb8e0844a3f9c67a6bdcc89db1012e1c ]
Removed by commit 70c90e4a6b2f ("perf parse-events: Avoid scanning
PMUs before parsing").
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230627181030.95608-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: ede72dca45b1 ("perf parse-events: Fix tracepoint name memory leak")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/parse-events.y | 42 ++--------------------------------
1 file changed, 2 insertions(+), 40 deletions(-)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index c590cf7f02a45..43557f20d0989 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -70,7 +70,7 @@ static void free_list_evsel(struct list_head* list_evsel)
%token PE_LEGACY_CACHE
%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR
-%token PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
+%token PE_KERNEL_PMU_EVENT
%token PE_ARRAY_ALL PE_ARRAY_RANGE
%token PE_DRV_CFG_TERM
%token PE_TERM_HW
@@ -88,7 +88,7 @@ static void free_list_evsel(struct list_head* list_evsel)
%type <str> PE_MODIFIER_EVENT
%type <str> PE_MODIFIER_BP
%type <str> PE_EVENT_NAME
-%type <str> PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
+%type <str> PE_KERNEL_PMU_EVENT
%type <str> PE_DRV_CFG_TERM
%type <str> name_or_raw name_or_legacy
%destructor { free ($$); } <str>
@@ -421,44 +421,6 @@ PE_KERNEL_PMU_EVENT opt_pmu_config
YYABORT;
$$ = list;
}
-|
-PE_PMU_EVENT_FAKE sep_dc
-{
- struct list_head *list;
- int err;
-
- list = alloc_list();
- if (!list)
- YYABORT;
-
- err = parse_events_add_pmu(_parse_state, list, $1, /*head_config=*/NULL,
- /*auto_merge_stats=*/false);
- free($1);
- if (err < 0) {
- free(list);
- YYABORT;
- }
- $$ = list;
-}
-|
-PE_PMU_EVENT_FAKE opt_pmu_config
-{
- struct list_head *list;
- int err;
-
- list = alloc_list();
- if (!list)
- YYABORT;
-
- err = parse_events_add_pmu(_parse_state, list, $1, $2, /*auto_merge_stats=*/false);
- free($1);
- parse_events_terms__delete($2);
- if (err < 0) {
- free(list);
- YYABORT;
- }
- $$ = list;
-}
value_sym:
PE_VALUE_SYM_HW
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.5 388/550] perf parse-events: Remove unused PE_KERNEL_PMU_EVENT token
[not found] <20231115191600.708733204@linuxfoundation.org>
2023-11-15 19:16 ` [PATCH 6.5 387/550] perf parse-events: Remove unused PE_PMU_EVENT_FAKE token Greg Kroah-Hartman
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 389/550] perf parse-events: Remove ABORT_ON Greg Kroah-Hartman
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Adrian Hunter,
Alexander Shishkin, Athira Rajeev, Ingo Molnar, Jiri Olsa,
Kan Liang, Mark Rutland, Namhyung Kim, Peter Zijlstra, bpf,
Arnaldo Carvalho de Melo, Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit bf7d46b3a088ccb8f8045c5902d5848bc23286f9 ]
Removed by commit 70c90e4a6b2f ("perf parse-events: Avoid scanning
PMUs before parsing").
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230627181030.95608-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: ede72dca45b1 ("perf parse-events: Fix tracepoint name memory leak")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/parse-events.y | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 43557f20d0989..1393c39ebf330 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -70,7 +70,6 @@ static void free_list_evsel(struct list_head* list_evsel)
%token PE_LEGACY_CACHE
%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR
-%token PE_KERNEL_PMU_EVENT
%token PE_ARRAY_ALL PE_ARRAY_RANGE
%token PE_DRV_CFG_TERM
%token PE_TERM_HW
@@ -88,7 +87,6 @@ static void free_list_evsel(struct list_head* list_evsel)
%type <str> PE_MODIFIER_EVENT
%type <str> PE_MODIFIER_BP
%type <str> PE_EVENT_NAME
-%type <str> PE_KERNEL_PMU_EVENT
%type <str> PE_DRV_CFG_TERM
%type <str> name_or_raw name_or_legacy
%destructor { free ($$); } <str>
@@ -376,18 +374,6 @@ PE_NAME opt_pmu_config
#undef CLEANUP
}
|
-PE_KERNEL_PMU_EVENT sep_dc
-{
- struct list_head *list;
- int err;
-
- err = parse_events_multi_pmu_add(_parse_state, $1, NULL, &list);
- free($1);
- if (err < 0)
- YYABORT;
- $$ = list;
-}
-|
PE_NAME sep_dc
{
struct list_head *list;
@@ -408,19 +394,6 @@ PE_NAME sep_dc
free($1);
$$ = list;
}
-|
-PE_KERNEL_PMU_EVENT opt_pmu_config
-{
- struct list_head *list;
- int err;
-
- /* frees $2 */
- err = parse_events_multi_pmu_add(_parse_state, $1, $2, &list);
- free($1);
- if (err < 0)
- YYABORT;
- $$ = list;
-}
value_sym:
PE_VALUE_SYM_HW
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.5 389/550] perf parse-events: Remove ABORT_ON
[not found] <20231115191600.708733204@linuxfoundation.org>
2023-11-15 19:16 ` [PATCH 6.5 387/550] perf parse-events: Remove unused PE_PMU_EVENT_FAKE token Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 388/550] perf parse-events: Remove unused PE_KERNEL_PMU_EVENT token Greg Kroah-Hartman
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 390/550] perf tools: Revert enable indices setting syntax for BPF map Greg Kroah-Hartman
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Adrian Hunter,
Alexander Shishkin, Athira Rajeev, Ingo Molnar, Jiri Olsa,
Kan Liang, Mark Rutland, Namhyung Kim, Peter Zijlstra, bpf,
Arnaldo Carvalho de Melo, Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 4c11adff675652759a0f0ad2194f4646b5463a42 ]
Prefer informative messages rather than none with ABORT_ON. Document
one failure mode and add an error message for another.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230627181030.95608-14-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: ede72dca45b1 ("perf parse-events: Fix tracepoint name memory leak")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/parse-events.y | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 1393c39ebf330..24c9af561cf9d 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -22,12 +22,6 @@
void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
-#define ABORT_ON(val) \
-do { \
- if (val) \
- YYABORT; \
-} while (0)
-
#define PE_ABORT(val) \
do { \
if (val == -ENOMEM) \
@@ -618,7 +612,9 @@ PE_RAW opt_event_config
YYNOMEM;
errno = 0;
num = strtoull($1 + 1, NULL, 16);
- ABORT_ON(errno);
+ /* Given the lexer will only give [a-fA-F0-9]+ a failure here should be impossible. */
+ if (errno)
+ YYABORT;
free($1);
err = parse_events_add_numeric(_parse_state, list, PERF_TYPE_RAW, num, $2,
/*wildcard=*/false);
@@ -978,7 +974,17 @@ PE_VALUE PE_ARRAY_RANGE PE_VALUE
{
struct parse_events_array array;
- ABORT_ON($3 < $1);
+ if ($3 < $1) {
+ struct parse_events_state *parse_state = _parse_state;
+ struct parse_events_error *error = parse_state->error;
+ char *err_str;
+
+ if (asprintf(&err_str, "Expected '%ld' to be less-than '%ld'", $3, $1) < 0)
+ err_str = NULL;
+
+ parse_events_error__handle(error, @1.first_column, err_str, NULL);
+ YYABORT;
+ }
array.nr_ranges = 1;
array.ranges = malloc(sizeof(array.ranges[0]));
if (!array.ranges)
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.5 390/550] perf tools: Revert enable indices setting syntax for BPF map
[not found] <20231115191600.708733204@linuxfoundation.org>
` (2 preceding siblings ...)
2023-11-15 19:16 ` [PATCH 6.5 389/550] perf parse-events: Remove ABORT_ON Greg Kroah-Hartman
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 394/550] perf record: Fix BTF type checks in the off-cpu profiling Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 427/550] perf mem-events: Avoid uninitialized read Greg Kroah-Hartman
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Adrian Hunter,
Alexander Shishkin, Eduard Zingerman, He Kuang, Ingo Molnar,
Jiri Olsa, Kan Liang, Mark Rutland, Namhyung Kim, Peter Zijlstra,
Rob Herring, Wang Nan, Wang ShaoBo, YueHaibing, bpf,
Arnaldo Carvalho de Melo, Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 30f4ade33d649aa0e8603386721f184ad9d3cb55 ]
This reverts commit e571e029bdbf ("perf tools: Enable indices setting
syntax for BPF map").
The reverted commit added a notion of arrays that could be set as
event terms for BPF events. The parsing hasn't worked over multiple
Linux releases. Given the broken nature of the parsing it appears the
code isn't in use, nor could I find a way for it to be used to add a
test.
The original commit contains a test in the commit message,
however, running it yields:
```
$ perf record -e './test_bpf_map_3.c/map:channel.value[0,1,2,3...5]=101/' usleep 2
event syntax error: '..pf_map_3.c/map:channel.value[0,1,2,3...5]=101/'
\___ parser error
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
```
Given the code can't be used this commit reverts and removes it.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Wang ShaoBo <bobo.shaobowang@huawei.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230728001212.457900-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: ede72dca45b1 ("perf parse-events: Fix tracepoint name memory leak")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/parse-events.c | 8 +--
tools/perf/util/parse-events.l | 11 ---
tools/perf/util/parse-events.y | 122 ---------------------------------
3 files changed, 1 insertion(+), 140 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 30311844eea7b..979fc92c2f47d 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -793,13 +793,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state,
parse_events_error__handle(parse_state->error, idx,
strdup(errbuf),
- strdup(
-"Hint:\tValid config terms:\n"
-" \tmap:[<arraymap>].value<indices>=[value]\n"
-" \tmap:[<eventmap>].event<indices>=[event]\n"
-"\n"
-" \twhere <indices> is something like [0,3...5] or [all]\n"
-" \t(add -v to see detail)"));
+ NULL);
return err;
}
}
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 99335ec586ae8..d7d084cc4140d 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -175,7 +175,6 @@ do { \
%x mem
%s config
%x event
-%x array
group [^,{}/]*[{][^}]*[}][^,{}/]*
event_pmu [^,{}/]+[/][^/]*[/][^,{}/]*
@@ -251,14 +250,6 @@ non_digit [^0-9]
}
}
-<array>{
-"]" { BEGIN(config); return ']'; }
-{num_dec} { return value(yyscanner, 10); }
-{num_hex} { return value(yyscanner, 16); }
-, { return ','; }
-"\.\.\." { return PE_ARRAY_RANGE; }
-}
-
<config>{
/*
* Please update config_term_names when new static term is added.
@@ -302,8 +293,6 @@ r0x{num_raw_hex} { return str(yyscanner, PE_RAW); }
{lc_type}-{lc_op_result} { return lc_str(yyscanner, _parse_state); }
{lc_type}-{lc_op_result}-{lc_op_result} { return lc_str(yyscanner, _parse_state); }
{name_minus} { return str(yyscanner, PE_NAME); }
-\[all\] { return PE_ARRAY_ALL; }
-"[" { BEGIN(array); return '['; }
@{drv_cfg_term} { return drv_str(yyscanner, PE_DRV_CFG_TERM); }
}
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 24c9af561cf9d..8b25b964d6962 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -64,7 +64,6 @@ static void free_list_evsel(struct list_head* list_evsel)
%token PE_LEGACY_CACHE
%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR
-%token PE_ARRAY_ALL PE_ARRAY_RANGE
%token PE_DRV_CFG_TERM
%token PE_TERM_HW
%type <num> PE_VALUE
@@ -108,11 +107,6 @@ static void free_list_evsel(struct list_head* list_evsel)
%type <list_evsel> groups
%destructor { free_list_evsel ($$); } <list_evsel>
%type <tracepoint_name> tracepoint_name
-%destructor { free ($$.sys); free ($$.event); } <tracepoint_name>
-%type <array> array
-%type <array> array_term
-%type <array> array_terms
-%destructor { free ($$.ranges); } <array>
%type <hardware_term> PE_TERM_HW
%destructor { free ($$.str); } <hardware_term>
@@ -127,7 +121,6 @@ static void free_list_evsel(struct list_head* list_evsel)
char *sys;
char *event;
} tracepoint_name;
- struct parse_events_array array;
struct hardware_term {
char *str;
u64 num;
@@ -878,121 +871,6 @@ PE_TERM
$$ = term;
}
-|
-name_or_raw array '=' name_or_legacy
-{
- struct parse_events_term *term;
- int err = parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER, $1, $4, &@1, &@4);
-
- if (err) {
- free($1);
- free($4);
- free($2.ranges);
- PE_ABORT(err);
- }
- term->array = $2;
- $$ = term;
-}
-|
-name_or_raw array '=' PE_VALUE
-{
- struct parse_events_term *term;
- int err = parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, $1, $4, false, &@1, &@4);
-
- if (err) {
- free($1);
- free($2.ranges);
- PE_ABORT(err);
- }
- term->array = $2;
- $$ = term;
-}
-|
-PE_DRV_CFG_TERM
-{
- struct parse_events_term *term;
- char *config = strdup($1);
- int err;
-
- if (!config)
- YYNOMEM;
- err = parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_DRV_CFG, config, $1, &@1, NULL);
- if (err) {
- free($1);
- free(config);
- PE_ABORT(err);
- }
- $$ = term;
-}
-
-array:
-'[' array_terms ']'
-{
- $$ = $2;
-}
-|
-PE_ARRAY_ALL
-{
- $$.nr_ranges = 0;
- $$.ranges = NULL;
-}
-
-array_terms:
-array_terms ',' array_term
-{
- struct parse_events_array new_array;
-
- new_array.nr_ranges = $1.nr_ranges + $3.nr_ranges;
- new_array.ranges = realloc($1.ranges,
- sizeof(new_array.ranges[0]) *
- new_array.nr_ranges);
- if (!new_array.ranges)
- YYNOMEM;
- memcpy(&new_array.ranges[$1.nr_ranges], $3.ranges,
- $3.nr_ranges * sizeof(new_array.ranges[0]));
- free($3.ranges);
- $$ = new_array;
-}
-|
-array_term
-
-array_term:
-PE_VALUE
-{
- struct parse_events_array array;
-
- array.nr_ranges = 1;
- array.ranges = malloc(sizeof(array.ranges[0]));
- if (!array.ranges)
- YYNOMEM;
- array.ranges[0].start = $1;
- array.ranges[0].length = 1;
- $$ = array;
-}
-|
-PE_VALUE PE_ARRAY_RANGE PE_VALUE
-{
- struct parse_events_array array;
-
- if ($3 < $1) {
- struct parse_events_state *parse_state = _parse_state;
- struct parse_events_error *error = parse_state->error;
- char *err_str;
-
- if (asprintf(&err_str, "Expected '%ld' to be less-than '%ld'", $3, $1) < 0)
- err_str = NULL;
-
- parse_events_error__handle(error, @1.first_column, err_str, NULL);
- YYABORT;
- }
- array.nr_ranges = 1;
- array.ranges = malloc(sizeof(array.ranges[0]));
- if (!array.ranges)
- YYNOMEM;
- array.ranges[0].start = $1;
- array.ranges[0].length = $3 - $1 + 1;
- $$ = array;
-}
sep_dc: ':' |
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.5 394/550] perf record: Fix BTF type checks in the off-cpu profiling
[not found] <20231115191600.708733204@linuxfoundation.org>
` (3 preceding siblings ...)
2023-11-15 19:16 ` [PATCH 6.5 390/550] perf tools: Revert enable indices setting syntax for BPF map Greg Kroah-Hartman
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 427/550] perf mem-events: Avoid uninitialized read Greg Kroah-Hartman
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Song Liu, Hao Luo, bpf,
Namhyung Kim, Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <namhyung@kernel.org>
[ Upstream commit 0e501a65d35bf72414379fed0e31a0b6b81ab57d ]
The BTF func proto for a tracepoint has one more argument than the
actual tracepoint function since it has a context argument at the
begining. So it should compare to 5 when the tracepoint has 4
arguments.
typedef void (*btf_trace_sched_switch)(void *, bool, struct task_struct *, struct task_struct *, unsigned int);
Also, recent change in the perf tool would use a hand-written minimal
vmlinux.h to generate BTF in the skeleton. So it won't have the info
of the tracepoint. Anyway it should use the kernel's vmlinux BTF to
check the type in the kernel.
Fixes: b36888f71c85 ("perf record: Handle argument change in sched_switch")
Reviewed-by: Ian Rogers <irogers@google.com>
Acked-by: Song Liu <song@kernel.org>
Cc: Hao Luo <haoluo@google.com>
CC: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230922234444.3115821-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/bpf_off_cpu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/bpf_off_cpu.c b/tools/perf/util/bpf_off_cpu.c
index 01f70b8e705a8..21f4d9ba023d9 100644
--- a/tools/perf/util/bpf_off_cpu.c
+++ b/tools/perf/util/bpf_off_cpu.c
@@ -98,7 +98,7 @@ static void off_cpu_finish(void *arg __maybe_unused)
/* v5.18 kernel added prev_state arg, so it needs to check the signature */
static void check_sched_switch_args(void)
{
- const struct btf *btf = bpf_object__btf(skel->obj);
+ const struct btf *btf = btf__load_vmlinux_btf();
const struct btf_type *t1, *t2, *t3;
u32 type_id;
@@ -116,7 +116,8 @@ static void check_sched_switch_args(void)
return;
t3 = btf__type_by_id(btf, t2->type);
- if (t3 && btf_is_func_proto(t3) && btf_vlen(t3) == 4) {
+ /* btf_trace func proto has one more argument for the context */
+ if (t3 && btf_is_func_proto(t3) && btf_vlen(t3) == 5) {
/* new format: pass prev_state as 4th arg */
skel->rodata->has_prev_state = true;
}
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.5 427/550] perf mem-events: Avoid uninitialized read
[not found] <20231115191600.708733204@linuxfoundation.org>
` (4 preceding siblings ...)
2023-11-15 19:16 ` [PATCH 6.5 394/550] perf record: Fix BTF type checks in the off-cpu profiling Greg Kroah-Hartman
@ 2023-11-15 19:16 ` Greg Kroah-Hartman
5 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-15 19:16 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Namhyung Kim,
Ravi Bangoria, Nick Desaulniers, Yang Jihong, Huacai Chen,
Nathan Chancellor, Kan Liang, llvm, Ming Wang, Tom Rix, bpf,
Sasha Levin
6.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 85f73c377b2ac9988a204b119aebb33ca5c60083 ]
pmu should be initialized to NULL before perf_pmus__scan loop. Fix and
shrink the scope of pmu at the same time. Issue detected by clang-tidy.
Fixes: 5752c20f3787 ("perf mem: Scan all PMUs instead of just core ones")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: llvm@lists.linux.dev
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20231009183920.200859-10-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/mem-events.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 39ffe8ceb3809..954b235e12e51 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -185,7 +185,6 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
{
int i = *argv_nr, k = 0;
struct perf_mem_event *e;
- struct perf_pmu *pmu;
for (int j = 0; j < PERF_MEM_EVENTS__MAX; j++) {
e = perf_mem_events__ptr(j);
@@ -202,6 +201,8 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
rec_argv[i++] = "-e";
rec_argv[i++] = perf_mem_events__name(j, NULL);
} else {
+ struct perf_pmu *pmu = NULL;
+
if (!e->supported) {
perf_mem_events__print_unsupport_hybrid(e, j);
return -1;
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-15 19:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20231115191600.708733204@linuxfoundation.org>
2023-11-15 19:16 ` [PATCH 6.5 387/550] perf parse-events: Remove unused PE_PMU_EVENT_FAKE token Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 388/550] perf parse-events: Remove unused PE_KERNEL_PMU_EVENT token Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 389/550] perf parse-events: Remove ABORT_ON Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 390/550] perf tools: Revert enable indices setting syntax for BPF map Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 394/550] perf record: Fix BTF type checks in the off-cpu profiling Greg Kroah-Hartman
2023-11-15 19:16 ` [PATCH 6.5 427/550] perf mem-events: Avoid uninitialized read Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox