From: Greg Kroah-Hartman Date: Wed, 22 Jul 2026 13:31:33 +0000 (+0200) Subject: 7.1-stable patches X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=e73b9f2e5cfa87c2d77eda649b933551e6d59cc6;p=thirdparty%2Fkernel%2Fstable-queue.git 7.1-stable patches added patches: perf-sample-add-file_offset-field-to-struct-perf_sample.patch --- diff --git a/queue-7.1/perf-sample-add-file_offset-field-to-struct-perf_sample.patch b/queue-7.1/perf-sample-add-file_offset-field-to-struct-perf_sample.patch new file mode 100644 index 0000000000..f4ee9e2c83 --- /dev/null +++ b/queue-7.1/perf-sample-add-file_offset-field-to-struct-perf_sample.patch @@ -0,0 +1,89 @@ +From 7a490187f22b4bfae7ef752edbe3fb13017ca11c Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Mon, 1 Jun 2026 13:07:52 -0300 +Subject: perf sample: Add file_offset field to struct perf_sample + +From: Arnaldo Carvalho de Melo + +commit 7a490187f22b4bfae7ef752edbe3fb13017ca11c upstream. + +Add a file_offset field to struct perf_sample so that event processing +callbacks can report the byte offset of the problematic event in +perf.data, letting users cross-reference with 'perf report -D' output. + +Set sample.file_offset in perf_session__deliver_event(), which is the +common entry point for both file mode (mmap'd offset) and pipe mode +(running byte counter from __perf_session__process_pipe_events). + +The assignment is placed after evsel__parse_sample(), which zeroes +the struct via memset. + +Preserve file_offset through the deferred callchain delivery path by +storing it in struct deferred_event and restoring it after +evlist__parse_sample() in both evlist__deliver_deferred_callchain() +and session__flush_deferred_samples(). + +Subsequent patches will use this field in skip/stop warning messages. + +Reviewed-by: Ian Rogers +Assisted-by: Claude:claude-opus-4.6 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/sample.h | 2 ++ + tools/perf/util/session.c | 5 +++++ + 2 files changed, 7 insertions(+) + +--- a/tools/perf/util/sample.h ++++ b/tools/perf/util/sample.h +@@ -158,6 +158,8 @@ struct perf_sample { + u64 code_page_size; + /** @cgroup: The sample event PERF_SAMPLE_CGROUP value. */ + u64 cgroup; ++ /** @file_offset: Byte offset of this event in the perf.data file. */ ++ u64 file_offset; + /** @flags: Extra flag data from auxiliary events like intel-pt. */ + u32 flags; + /** @machine_pid: The guest machine pid derived from the sample id. */ +--- a/tools/perf/util/session.c ++++ b/tools/perf/util/session.c +@@ -1352,6 +1352,7 @@ static int evlist__deliver_sample(struct + struct deferred_event { + struct list_head list; + union perf_event *event; ++ u64 file_offset; + }; + + /* +@@ -1387,6 +1388,7 @@ static int evlist__deliver_deferred_call + perf_sample__exit(&orig_sample); + break; + } ++ orig_sample.file_offset = de->file_offset; + + if (sample->tid != orig_sample.tid) { + perf_sample__exit(&orig_sample); +@@ -1435,6 +1437,7 @@ static int session__flush_deferred_sampl + perf_sample__exit(&sample); + break; + } ++ sample.file_offset = de->file_offset; + + sample.evsel = evlist__id2evsel(evlist, sample.id); + ret = evlist__deliver_sample(evlist, tool, de->event, +@@ -1496,6 +1499,7 @@ static int machines__deliver_event(struc + return -ENOMEM; + } + memcpy(de->event, event, sz); ++ de->file_offset = sample->file_offset; + list_add_tail(&de->list, &evlist->deferred_samples); + return 0; + } +@@ -1589,6 +1593,7 @@ static int perf_session__deliver_event(s + ret = 0; + goto out; + } ++ sample.file_offset = file_offset; + + ret = machines__deliver_event(&session->machines, session->evlist, + event, &sample, tool, file_offset, file_path); diff --git a/queue-7.1/perf-sched-use-is_idle_sample-for-idle-thread-runtim.patch b/queue-7.1/perf-sched-use-is_idle_sample-for-idle-thread-runtim.patch index 53aeb05baf..d3892e2457 100644 --- a/queue-7.1/perf-sched-use-is_idle_sample-for-idle-thread-runtim.patch +++ b/queue-7.1/perf-sched-use-is_idle_sample-for-idle-thread-runtim.patch @@ -35,14 +35,12 @@ Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- - tools/perf/builtin-sched.c | 8 +++++++- + tools/perf/builtin-sched.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c -index fc8ae0342dd6c2..9ea3416f30ac6d 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c -@@ -2904,7 +2904,13 @@ static int timehist_sched_change_event(const struct perf_tool *tool, +@@ -2904,7 +2904,13 @@ static int timehist_sched_change_event(c t = ptime->end; } @@ -53,10 +51,7 @@ index fc8ae0342dd6c2..9ea3416f30ac6d 100644 + * whose priv is thread_runtime, not idle_thread_runtime — the cast + * below would read past the allocation. + */ -+ if (!sched->idle_hist || is_idle_sample(sample)) { ++ if (!sched->idle_hist || is_idle_sample(sample, evsel)) { if (!cpu_list || (sample->cpu < MAX_NR_CPUS && test_bit(sample->cpu, cpu_bitmap))) timehist_update_runtime_stats(tr, t, tprev); --- -2.53.0 - diff --git a/queue-7.1/series b/queue-7.1/series index ec91ab0e7b..6de1c14fc6 100644 --- a/queue-7.1/series +++ b/queue-7.1/series @@ -929,6 +929,7 @@ perf-fix-off-by-one-stack-buffer-overflow-in-kallsym.patch perf-annotate-fix-crashes-on-empty-annotate-windows.patch perf-tools-guard-test_bit-from-out-of-bounds-sample-.patch perf-sched-fix-thread-reference-leak-in-latency_swit.patch +perf-sample-add-file_offset-field-to-struct-perf_sample.patch perf-sched-replace-bug_on-on-invalid-cpu-with-gracef.patch perf-sched-fix-null-dereference-in-latency_runtime_e.patch perf-sched-fix-comp_cpus-heap-overflow-with-cross-ma.patch