]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
7.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jul 2026 13:31:33 +0000 (15:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jul 2026 13:31:33 +0000 (15:31 +0200)
added patches:
perf-sample-add-file_offset-field-to-struct-perf_sample.patch

queue-7.1/perf-sample-add-file_offset-field-to-struct-perf_sample.patch [new file with mode: 0644]
queue-7.1/perf-sched-use-is_idle_sample-for-idle-thread-runtim.patch
queue-7.1/series

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 (file)
index 0000000..f4ee9e2
--- /dev/null
@@ -0,0 +1,89 @@
+From 7a490187f22b4bfae7ef752edbe3fb13017ca11c Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+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 <acme@redhat.com>
+
+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 <irogers@google.com>
+Assisted-by: Claude:claude-opus-4.6
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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);
index 53aeb05baf9767c17cd620bd3a31efe5f8eba1ed..d3892e245725579dd75b359155f2e80cf143c57f 100644 (file)
@@ -35,14 +35,12 @@ Assisted-by: Claude:claude-opus-4.6
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- 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
-
index ec91ab0e7b33f1655f5da5ba8c1d17f86b0fef19..6de1c14fc67e4a66445dc221da7c6508faaaf48d 100644 (file)
@@ -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