From 88aa16b43275c9c8467874ffb59b8047036c51e6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 10 Oct 2024 12:25:05 +0200 Subject: [PATCH] 6.6-stable patches added patches: revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch series --- ...allchain-fix-stitch-lbr-memory-leaks.patch | 119 ++++++++++++++++++ queue-6.6/series | 1 + 2 files changed, 120 insertions(+) create mode 100644 queue-6.6/revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch create mode 100644 queue-6.6/series diff --git a/queue-6.6/revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch b/queue-6.6/revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch new file mode 100644 index 00000000000..1e68556ca2a --- /dev/null +++ b/queue-6.6/revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch @@ -0,0 +1,119 @@ +From c27740b5d76b37c0adabf61db17aedffc480f7e8 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Thu, 10 Oct 2024 12:17:30 +0200 +Subject: Revert "perf callchain: Fix stitch LBR memory leaks" + +From: Greg Kroah-Hartman + +This reverts commit 42cd165b4cf89fb42b794d3a9ee792a7696c49b3 which is +commit 599c19397b17d197fc1184bbc950f163a292efc9 upstream. + +It causes build breaks in the 6.6.y tree and should not have been +applied, so revert it. + +Link: https://lore.kernel.org/r/894e27c0-c1e8-476d-ae16-11ab65853d1f@oracle.com +Link: https://lore.kernel.org/r/f7bbebca-4da4-4270-ba6c-659a4c40b430@gmail.com +Reported-by: Harshit Mogalapalli +Reported-by: Florian Fainelli +Cc: Kan Liang +Cc: Ian Rogers +Cc: Arnaldo Carvalho de Melo +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Andi Kleen +Cc: Anne Macedo +Cc: Changbin Du +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Arnaldo Carvalho de Melo +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/machine.c | 17 ++--------------- + tools/perf/util/thread.c | 4 ---- + tools/perf/util/thread.h | 1 - + 3 files changed, 2 insertions(+), 20 deletions(-) + +--- a/tools/perf/util/machine.c ++++ b/tools/perf/util/machine.c +@@ -2536,12 +2536,8 @@ static void save_lbr_cursor_node(struct + cursor->curr = cursor->first; + else + cursor->curr = cursor->curr->next; +- +- map_symbol__exit(&lbr_stitch->prev_lbr_cursor[idx].ms); + memcpy(&lbr_stitch->prev_lbr_cursor[idx], cursor->curr, + sizeof(struct callchain_cursor_node)); +- lbr_stitch->prev_lbr_cursor[idx].ms.maps = maps__get(cursor->curr->ms.maps); +- lbr_stitch->prev_lbr_cursor[idx].ms.map = map__get(cursor->curr->ms.map); + + lbr_stitch->prev_lbr_cursor[idx].valid = true; + cursor->pos++; +@@ -2752,9 +2748,6 @@ static bool has_stitched_lbr(struct thre + memcpy(&stitch_node->cursor, &lbr_stitch->prev_lbr_cursor[i], + sizeof(struct callchain_cursor_node)); + +- stitch_node->cursor.ms.maps = maps__get(lbr_stitch->prev_lbr_cursor[i].ms.maps); +- stitch_node->cursor.ms.map = map__get(lbr_stitch->prev_lbr_cursor[i].ms.map); +- + if (callee) + list_add(&stitch_node->node, &lbr_stitch->lists); + else +@@ -2778,8 +2771,6 @@ static bool alloc_lbr_stitch(struct thre + if (!thread__lbr_stitch(thread)->prev_lbr_cursor) + goto free_lbr_stitch; + +- thread__lbr_stitch(thread)->prev_lbr_cursor_size = max_lbr + 1; +- + INIT_LIST_HEAD(&thread__lbr_stitch(thread)->lists); + INIT_LIST_HEAD(&thread__lbr_stitch(thread)->free_lists); + +@@ -2835,12 +2826,8 @@ static int resolve_lbr_callchain_sample( + max_lbr, callee); + + if (!stitched_lbr && !list_empty(&lbr_stitch->lists)) { +- struct stitch_list *stitch_node; +- +- list_for_each_entry(stitch_node, &lbr_stitch->lists, node) +- map_symbol__exit(&stitch_node->cursor.ms); +- +- list_splice_init(&lbr_stitch->lists, &lbr_stitch->free_lists); ++ list_replace_init(&lbr_stitch->lists, ++ &lbr_stitch->free_lists); + } + memcpy(&lbr_stitch->prev_sample, sample, sizeof(*sample)); + } +--- a/tools/perf/util/thread.c ++++ b/tools/perf/util/thread.c +@@ -478,7 +478,6 @@ void thread__free_stitch_list(struct thr + return; + + list_for_each_entry_safe(pos, tmp, &lbr_stitch->lists, node) { +- map_symbol__exit(&pos->cursor.ms); + list_del_init(&pos->node); + free(pos); + } +@@ -488,9 +487,6 @@ void thread__free_stitch_list(struct thr + free(pos); + } + +- for (unsigned int i = 0 ; i < lbr_stitch->prev_lbr_cursor_size; i++) +- map_symbol__exit(&lbr_stitch->prev_lbr_cursor[i].ms); +- + zfree(&lbr_stitch->prev_lbr_cursor); + free(thread__lbr_stitch(thread)); + thread__set_lbr_stitch(thread, NULL); +--- a/tools/perf/util/thread.h ++++ b/tools/perf/util/thread.h +@@ -28,7 +28,6 @@ struct lbr_stitch { + struct list_head free_lists; + struct perf_sample prev_sample; + struct callchain_cursor_node *prev_lbr_cursor; +- unsigned int prev_lbr_cursor_size; + }; + + struct thread_rb_node { diff --git a/queue-6.6/series b/queue-6.6/series new file mode 100644 index 00000000000..3c40cfcb888 --- /dev/null +++ b/queue-6.6/series @@ -0,0 +1 @@ +revert-perf-callchain-fix-stitch-lbr-memory-leaks.patch -- 2.47.2