]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop some 5.15 perf patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2024 07:35:09 +0000 (09:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2024 07:35:09 +0000 (09:35 +0200)
queue-5.15/perf-evsel-reduce-scope-of-evsel__ignore_missing_thr.patch [deleted file]
queue-5.15/perf-evsel-rename-variable-cpu-to-index.patch [deleted file]
queue-5.15/perf-inject-fix-leader-sampling-inserting-additional.patch [deleted file]
queue-5.15/perf-test-sample-parsing-add-endian-test-for-struct-.patch [deleted file]
queue-5.15/perf-test-sample-parsing-fix-branch_stack-entry-endianness-check.patch [deleted file]
queue-5.15/perf-tools-support-reading-perf_format_lost.patch [deleted file]
queue-5.15/series

diff --git a/queue-5.15/perf-evsel-reduce-scope-of-evsel__ignore_missing_thr.patch b/queue-5.15/perf-evsel-reduce-scope-of-evsel__ignore_missing_thr.patch
deleted file mode 100644 (file)
index d7e3604..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-From 9b5aeaea335555afe1d92f3983d33034915ce1b5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 4 Jan 2022 22:13:41 -0800
-Subject: perf evsel: Reduce scope of evsel__ignore_missing_thread
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 1fa497d4c01d497e25131ccdd5def6f24dd1f330 ]
-
-Move to being static.
-
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Andi Kleen <ak@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: John Garry <john.garry@huawei.com>
-Cc: Kajol Jain <kjain@linux.ibm.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linaro.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Paul Clarke <pc@us.ibm.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Riccardo Mancini <rickyman7@gmail.com>
-Cc: Stephane Eranian <eranian@google.com>
-Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
-Cc: Vineet Singh <vineet.singh@intel.com>
-Cc: coresight@lists.linaro.org
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: zhengjun.xing@intel.com
-Link: https://lore.kernel.org/r/20220105061351.120843-39-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: 79bcd34e0f3d ("perf inject: Fix leader sampling inserting additional samples")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/evsel.c | 8 ++++----
- tools/perf/util/evsel.h | 4 ----
- 2 files changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
-index c19a583ca9f66..b5b8f723e577b 100644
---- a/tools/perf/util/evsel.c
-+++ b/tools/perf/util/evsel.c
-@@ -1675,10 +1675,10 @@ static int update_fds(struct evsel *evsel,
-       return 0;
- }
--bool evsel__ignore_missing_thread(struct evsel *evsel,
--                                int nr_cpus, int cpu,
--                                struct perf_thread_map *threads,
--                                int thread, int err)
-+static bool evsel__ignore_missing_thread(struct evsel *evsel,
-+                                       int nr_cpus, int cpu,
-+                                       struct perf_thread_map *threads,
-+                                       int thread, int err)
- {
-       pid_t ignore_pid = perf_thread_map__pid(threads, thread);
-diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
-index 0492cafac4430..461eb0feb5365 100644
---- a/tools/perf/util/evsel.h
-+++ b/tools/perf/util/evsel.h
-@@ -302,10 +302,6 @@ bool evsel__detect_missing_features(struct evsel *evsel);
- enum rlimit_action { NO_CHANGE, SET_TO_MAX, INCREASED_MAX };
- bool evsel__increase_rlimit(enum rlimit_action *set_rlimit);
--bool evsel__ignore_missing_thread(struct evsel *evsel,
--                                int nr_cpus, int cpu,
--                                struct perf_thread_map *threads,
--                                int thread, int err);
- bool evsel__precise_ip_fallback(struct evsel *evsel);
- struct perf_sample;
--- 
-2.43.0
-
diff --git a/queue-5.15/perf-evsel-rename-variable-cpu-to-index.patch b/queue-5.15/perf-evsel-rename-variable-cpu-to-index.patch
deleted file mode 100644 (file)
index f86b073..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-From 1c8c0880b69bd41952ddf8fca60b7c289713b37c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 4 Jan 2022 22:13:42 -0800
-Subject: perf evsel: Rename variable cpu to index
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 6f844b1fdd3bc3a25995ff83edea32a73bfa72d9 ]
-
-Make naming less error prone.
-
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Andi Kleen <ak@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: John Garry <john.garry@huawei.com>
-Cc: Kajol Jain <kjain@linux.ibm.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linaro.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Paul Clarke <pc@us.ibm.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Riccardo Mancini <rickyman7@gmail.com>
-Cc: Stephane Eranian <eranian@google.com>
-Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
-Cc: Vineet Singh <vineet.singh@intel.com>
-Cc: coresight@lists.linaro.org
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: zhengjun.xing@intel.com
-Link: https://lore.kernel.org/r/20220105061351.120843-40-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: 79bcd34e0f3d ("perf inject: Fix leader sampling inserting additional samples")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/evsel.c | 83 +++++++++++++++++++++--------------------
- tools/perf/util/evsel.h |  6 +--
- tools/perf/util/stat.c  |  4 +-
- tools/perf/util/stat.h  |  2 +-
- 4 files changed, 48 insertions(+), 47 deletions(-)
-
-diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
-index b5b8f723e577b..4f4226f380d1c 100644
---- a/tools/perf/util/evsel.c
-+++ b/tools/perf/util/evsel.c
-@@ -1364,9 +1364,9 @@ int evsel__append_addr_filter(struct evsel *evsel, const char *filter)
- }
- /* Caller has to clear disabled after going through all CPUs. */
--int evsel__enable_cpu(struct evsel *evsel, int cpu)
-+int evsel__enable_cpu(struct evsel *evsel, int cpu_map_idx)
- {
--      return perf_evsel__enable_cpu(&evsel->core, cpu);
-+      return perf_evsel__enable_cpu(&evsel->core, cpu_map_idx);
- }
- int evsel__enable(struct evsel *evsel)
-@@ -1379,9 +1379,9 @@ int evsel__enable(struct evsel *evsel)
- }
- /* Caller has to set disabled after going through all CPUs. */
--int evsel__disable_cpu(struct evsel *evsel, int cpu)
-+int evsel__disable_cpu(struct evsel *evsel, int cpu_map_idx)
- {
--      return perf_evsel__disable_cpu(&evsel->core, cpu);
-+      return perf_evsel__disable_cpu(&evsel->core, cpu_map_idx);
- }
- int evsel__disable(struct evsel *evsel)
-@@ -1445,7 +1445,7 @@ void evsel__delete(struct evsel *evsel)
-       free(evsel);
- }
--void evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
-+void evsel__compute_deltas(struct evsel *evsel, int cpu_map_idx, int thread,
-                          struct perf_counts_values *count)
- {
-       struct perf_counts_values tmp;
-@@ -1453,12 +1453,12 @@ void evsel__compute_deltas(struct evsel *evsel, int cpu, int thread,
-       if (!evsel->prev_raw_counts)
-               return;
--      if (cpu == -1) {
-+      if (cpu_map_idx == -1) {
-               tmp = evsel->prev_raw_counts->aggr;
-               evsel->prev_raw_counts->aggr = *count;
-       } else {
--              tmp = *perf_counts(evsel->prev_raw_counts, cpu, thread);
--              *perf_counts(evsel->prev_raw_counts, cpu, thread) = *count;
-+              tmp = *perf_counts(evsel->prev_raw_counts, cpu_map_idx, thread);
-+              *perf_counts(evsel->prev_raw_counts, cpu_map_idx, thread) = *count;
-       }
-       count->val = count->val - tmp.val;
-@@ -1492,20 +1492,21 @@ static int evsel__read_one(struct evsel *evsel, int cpu, int thread)
-       return perf_evsel__read(&evsel->core, cpu, thread, count);
- }
--static void evsel__set_count(struct evsel *counter, int cpu, int thread, u64 val, u64 ena, u64 run)
-+static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread,
-+                           u64 val, u64 ena, u64 run)
- {
-       struct perf_counts_values *count;
--      count = perf_counts(counter->counts, cpu, thread);
-+      count = perf_counts(counter->counts, cpu_map_idx, thread);
-       count->val    = val;
-       count->ena    = ena;
-       count->run    = run;
--      perf_counts__set_loaded(counter->counts, cpu, thread, true);
-+      perf_counts__set_loaded(counter->counts, cpu_map_idx, thread, true);
- }
--static int evsel__process_group_data(struct evsel *leader, int cpu, int thread, u64 *data)
-+static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int thread, u64 *data)
- {
-       u64 read_format = leader->core.attr.read_format;
-       struct sample_read_value *v;
-@@ -1524,7 +1525,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu, int thread,
-       v = (struct sample_read_value *) data;
--      evsel__set_count(leader, cpu, thread, v[0].value, ena, run);
-+      evsel__set_count(leader, cpu_map_idx, thread, v[0].value, ena, run);
-       for (i = 1; i < nr; i++) {
-               struct evsel *counter;
-@@ -1533,7 +1534,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu, int thread,
-               if (!counter)
-                       return -EINVAL;
--              evsel__set_count(counter, cpu, thread, v[i].value, ena, run);
-+              evsel__set_count(counter, cpu_map_idx, thread, v[i].value, ena, run);
-       }
-       return 0;
-@@ -1652,16 +1653,16 @@ static void evsel__remove_fd(struct evsel *pos, int nr_cpus, int nr_threads, int
- }
- static int update_fds(struct evsel *evsel,
--                    int nr_cpus, int cpu_idx,
-+                    int nr_cpus, int cpu_map_idx,
-                     int nr_threads, int thread_idx)
- {
-       struct evsel *pos;
--      if (cpu_idx >= nr_cpus || thread_idx >= nr_threads)
-+      if (cpu_map_idx >= nr_cpus || thread_idx >= nr_threads)
-               return -EINVAL;
-       evlist__for_each_entry(evsel->evlist, pos) {
--              nr_cpus = pos != evsel ? nr_cpus : cpu_idx;
-+              nr_cpus = pos != evsel ? nr_cpus : cpu_map_idx;
-               evsel__remove_fd(pos, nr_cpus, nr_threads, thread_idx);
-@@ -1676,7 +1677,7 @@ static int update_fds(struct evsel *evsel,
- }
- static bool evsel__ignore_missing_thread(struct evsel *evsel,
--                                       int nr_cpus, int cpu,
-+                                       int nr_cpus, int cpu_map_idx,
-                                        struct perf_thread_map *threads,
-                                        int thread, int err)
- {
-@@ -1701,7 +1702,7 @@ static bool evsel__ignore_missing_thread(struct evsel *evsel,
-        * We should remove fd for missing_thread first
-        * because thread_map__remove() will decrease threads->nr.
-        */
--      if (update_fds(evsel, nr_cpus, cpu, threads->nr, thread))
-+      if (update_fds(evsel, nr_cpus, cpu_map_idx, threads->nr, thread))
-               return false;
-       if (thread_map__remove(threads, thread))
-@@ -1966,9 +1967,9 @@ bool evsel__increase_rlimit(enum rlimit_action *set_rlimit)
- static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-               struct perf_thread_map *threads,
--              int start_cpu, int end_cpu)
-+              int start_cpu_map_idx, int end_cpu_map_idx)
- {
--      int cpu, thread, nthreads;
-+      int idx, thread, nthreads;
-       int pid = -1, err, old_errno;
-       enum rlimit_action set_rlimit = NO_CHANGE;
-@@ -1995,7 +1996,7 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-       display_attr(&evsel->core.attr);
--      for (cpu = start_cpu; cpu < end_cpu; cpu++) {
-+      for (idx = start_cpu_map_idx; idx < end_cpu_map_idx; idx++) {
-               for (thread = 0; thread < nthreads; thread++) {
-                       int fd, group_fd;
-@@ -2006,17 +2007,17 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-                       if (!evsel->cgrp && !evsel->core.system_wide)
-                               pid = perf_thread_map__pid(threads, thread);
--                      group_fd = get_group_fd(evsel, cpu, thread);
-+                      group_fd = get_group_fd(evsel, idx, thread);
-                       test_attr__ready();
-                       pr_debug2_peo("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
--                              pid, cpus->map[cpu], group_fd, evsel->open_flags);
-+                              pid, cpus->map[idx], group_fd, evsel->open_flags);
--                      fd = sys_perf_event_open(&evsel->core.attr, pid, cpus->map[cpu],
-+                      fd = sys_perf_event_open(&evsel->core.attr, pid, cpus->map[idx],
-                                               group_fd, evsel->open_flags);
--                      FD(evsel, cpu, thread) = fd;
-+                      FD(evsel, idx, thread) = fd;
-                       if (fd < 0) {
-                               err = -errno;
-@@ -2026,10 +2027,10 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-                               goto try_fallback;
-                       }
--                      bpf_counter__install_pe(evsel, cpu, fd);
-+                      bpf_counter__install_pe(evsel, idx, fd);
-                       if (unlikely(test_attr__enabled)) {
--                              test_attr__open(&evsel->core.attr, pid, cpus->map[cpu],
-+                              test_attr__open(&evsel->core.attr, pid, cpus->map[idx],
-                                               fd, group_fd, evsel->open_flags);
-                       }
-@@ -2070,7 +2071,7 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-       if (evsel__precise_ip_fallback(evsel))
-               goto retry_open;
--      if (evsel__ignore_missing_thread(evsel, cpus->nr, cpu, threads, thread, err)) {
-+      if (evsel__ignore_missing_thread(evsel, cpus->nr, idx, threads, thread, err)) {
-               /* We just removed 1 thread, so lower the upper nthreads limit. */
-               nthreads--;
-@@ -2085,7 +2086,7 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-       if (err == -EMFILE && evsel__increase_rlimit(&set_rlimit))
-               goto retry_open;
--      if (err != -EINVAL || cpu > 0 || thread > 0)
-+      if (err != -EINVAL || idx > 0 || thread > 0)
-               goto out_close;
-       if (evsel__detect_missing_features(evsel))
-@@ -2097,12 +2098,12 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
-       old_errno = errno;
-       do {
-               while (--thread >= 0) {
--                      if (FD(evsel, cpu, thread) >= 0)
--                              close(FD(evsel, cpu, thread));
--                      FD(evsel, cpu, thread) = -1;
-+                      if (FD(evsel, idx, thread) >= 0)
-+                              close(FD(evsel, idx, thread));
-+                      FD(evsel, idx, thread) = -1;
-               }
-               thread = nthreads;
--      } while (--cpu >= 0);
-+      } while (--idx >= 0);
-       errno = old_errno;
-       return err;
- }
-@@ -2119,13 +2120,13 @@ void evsel__close(struct evsel *evsel)
-       perf_evsel__free_id(&evsel->core);
- }
--int evsel__open_per_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, int cpu)
-+int evsel__open_per_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, int cpu_map_idx)
- {
--      if (cpu == -1)
-+      if (cpu_map_idx == -1)
-               return evsel__open_cpu(evsel, cpus, NULL, 0,
-                                       cpus ? cpus->nr : 1);
--      return evsel__open_cpu(evsel, cpus, NULL, cpu, cpu + 1);
-+      return evsel__open_cpu(evsel, cpus, NULL, cpu_map_idx, cpu_map_idx + 1);
- }
- int evsel__open_per_thread(struct evsel *evsel, struct perf_thread_map *threads)
-@@ -2872,15 +2873,15 @@ struct perf_env *evsel__env(struct evsel *evsel)
- static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
- {
--      int cpu, thread;
-+      int cpu_map_idx, thread;
--      for (cpu = 0; cpu < xyarray__max_x(evsel->core.fd); cpu++) {
-+      for (cpu_map_idx = 0; cpu_map_idx < xyarray__max_x(evsel->core.fd); cpu_map_idx++) {
-               for (thread = 0; thread < xyarray__max_y(evsel->core.fd);
-                    thread++) {
--                      int fd = FD(evsel, cpu, thread);
-+                      int fd = FD(evsel, cpu_map_idx, thread);
-                       if (perf_evlist__id_add_fd(&evlist->core, &evsel->core,
--                                                 cpu, thread, fd) < 0)
-+                                                 cpu_map_idx, thread, fd) < 0)
-                               return -1;
-               }
-       }
-diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
-index 461eb0feb5365..9e89dc02a116e 100644
---- a/tools/perf/util/evsel.h
-+++ b/tools/perf/util/evsel.h
-@@ -285,12 +285,12 @@ void arch_evsel__set_sample_weight(struct evsel *evsel);
- int evsel__set_filter(struct evsel *evsel, const char *filter);
- int evsel__append_tp_filter(struct evsel *evsel, const char *filter);
- int evsel__append_addr_filter(struct evsel *evsel, const char *filter);
--int evsel__enable_cpu(struct evsel *evsel, int cpu);
-+int evsel__enable_cpu(struct evsel *evsel, int cpu_map_idx);
- int evsel__enable(struct evsel *evsel);
- int evsel__disable(struct evsel *evsel);
--int evsel__disable_cpu(struct evsel *evsel, int cpu);
-+int evsel__disable_cpu(struct evsel *evsel, int cpu_map_idx);
--int evsel__open_per_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, int cpu);
-+int evsel__open_per_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, int cpu_map_idx);
- int evsel__open_per_thread(struct evsel *evsel, struct perf_thread_map *threads);
- int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
-               struct perf_thread_map *threads);
-diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
-index 5a0b3db1cab11..5f0e2ac91cea7 100644
---- a/tools/perf/util/stat.c
-+++ b/tools/perf/util/stat.c
-@@ -531,7 +531,7 @@ size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp)
- int create_perf_stat_counter(struct evsel *evsel,
-                            struct perf_stat_config *config,
-                            struct target *target,
--                           int cpu)
-+                           int cpu_map_idx)
- {
-       struct perf_event_attr *attr = &evsel->core.attr;
-       struct evsel *leader = evsel__leader(evsel);
-@@ -581,7 +581,7 @@ int create_perf_stat_counter(struct evsel *evsel,
-       }
-       if (target__has_cpu(target) && !target__has_per_thread(target))
--              return evsel__open_per_cpu(evsel, evsel__cpus(evsel), cpu);
-+              return evsel__open_per_cpu(evsel, evsel__cpus(evsel), cpu_map_idx);
-       return evsel__open_per_thread(evsel, evsel->core.threads);
- }
-diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
-index 977616cf69e46..5b7a5aeee1c1c 100644
---- a/tools/perf/util/stat.h
-+++ b/tools/perf/util/stat.h
-@@ -248,7 +248,7 @@ size_t perf_event__fprintf_stat_config(union perf_event *event, FILE *fp);
- int create_perf_stat_counter(struct evsel *evsel,
-                            struct perf_stat_config *config,
-                            struct target *target,
--                           int cpu);
-+                           int cpu_map_idx);
- void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *config,
-                           struct target *_target, struct timespec *ts, int argc, const char **argv);
--- 
-2.43.0
-
diff --git a/queue-5.15/perf-inject-fix-leader-sampling-inserting-additional.patch b/queue-5.15/perf-inject-fix-leader-sampling-inserting-additional.patch
deleted file mode 100644 (file)
index 45730a7..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-From 4204dd342041d4d6f9d9950685b6de61fc0b46d3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Jul 2024 15:06:20 -0700
-Subject: perf inject: Fix leader sampling inserting additional samples
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 79bcd34e0f3da39fda841406ccc957405e724852 ]
-
-The processing of leader samples would turn an individual sample with
-a group of read values into multiple samples. 'perf inject' would pass
-through the additional samples increasing the output data file size:
-
-  $ perf record -g -e "{instructions,cycles}:S" -o perf.orig.data true
-  $ perf script -D -i perf.orig.data | sed -e 's/perf.orig.data/perf.data/g' > orig.txt
-  $ perf inject -i perf.orig.data -o perf.new.data
-  $ perf script -D -i perf.new.data | sed -e 's/perf.new.data/perf.data/g' > new.txt
-  $ diff -u orig.txt new.txt
-  --- orig.txt    2024-07-29 14:29:40.606576769 -0700
-  +++ new.txt     2024-07-29 14:30:04.142737434 -0700
-  ...
-  -0xc550@perf.data [0x30]: event: 3
-  +0xc550@perf.data [0xd0]: event: 9
-  +.
-  +. ... raw event: size 208 bytes
-  +.  0000:  09 00 00 00 01 00 d0 00 fc 72 01 86 ff ff ff ff  .........r......
-  +.  0010:  74 7d 2c 00 74 7d 2c 00 fb c3 79 f9 ba d5 05 00  t},.t},...y.....
-  +.  0020:  e6 cb 1a 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
-  +.  0030:  02 00 00 00 00 00 00 00 76 01 00 00 00 00 00 00  ........v.......
-  +.  0040:  e6 cb 1a 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
-  +.  0050:  62 18 00 00 00 00 00 00 f6 cb 1a 00 00 00 00 00  b...............
-  +.  0060:  00 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00  ................
-  +.  0070:  80 ff ff ff ff ff ff ff fc 72 01 86 ff ff ff ff  .........r......
-  +.  0080:  f3 0e 6e 85 ff ff ff ff 0c cb 7f 85 ff ff ff ff  ..n.............
-  +.  0090:  bc f2 87 85 ff ff ff ff 44 af 7f 85 ff ff ff ff  ........D.......
-  +.  00a0:  bd be 7f 85 ff ff ff ff 26 d0 7f 85 ff ff ff ff  ........&.......
-  +.  00b0:  6d a4 ff 85 ff ff ff ff ea 00 20 86 ff ff ff ff  m......... .....
-  +.  00c0:  00 fe ff ff ff ff ff ff 57 14 4f 43 fc 7e 00 00  ........W.OC.~..
-  +
-  +1642373909693435 0xc550 [0xd0]: PERF_RECORD_SAMPLE(IP, 0x1): 2915700/2915700: 0xffffffff860172fc period: 1 addr: 0
-  +... FP chain: nr:12
-  +.....  0: ffffffffffffff80
-  +.....  1: ffffffff860172fc
-  +.....  2: ffffffff856e0ef3
-  +.....  3: ffffffff857fcb0c
-  +.....  4: ffffffff8587f2bc
-  +.....  5: ffffffff857faf44
-  +.....  6: ffffffff857fbebd
-  +.....  7: ffffffff857fd026
-  +.....  8: ffffffff85ffa46d
-  +.....  9: ffffffff862000ea
-  +..... 10: fffffffffffffe00
-  +..... 11: 00007efc434f1457
-  +... sample_read:
-  +.... group nr 2
-  +..... id 00000000001acbe6, value 0000000000000176, lost 0
-  +..... id 00000000001acbf6, value 0000000000001862, lost 0
-  +
-  +0xc620@perf.data [0x30]: event: 3
-  ...
-
-This behavior is incorrect as in the case above 'perf inject' should
-have done nothing. Fix this behavior by disabling separating samples
-for a tool that requests it. Only request this for `perf inject` so as
-to not affect other perf tools. With the patch and the test above
-there are no differences between the orig.txt and new.txt.
-
-Fixes: e4caec0d1af3d608 ("perf evsel: Add PERF_SAMPLE_READ sample related processing")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Acked-by: Namhyung Kim <namhyung@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Andi Kleen <ak@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240729220620.2957754-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-inject.c | 1 +
- tools/perf/util/session.c   | 3 +++
- tools/perf/util/tool.h      | 1 +
- 3 files changed, 5 insertions(+)
-
-diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
-index 8e7a65a8d86ed..2e9d81a16133c 100644
---- a/tools/perf/builtin-inject.c
-+++ b/tools/perf/builtin-inject.c
-@@ -910,6 +910,7 @@ int cmd_inject(int argc, const char **argv)
-                       .feature        = perf_event__repipe_op2_synth,
-                       .compressed     = perf_event__repipe_op4_synth,
-                       .auxtrace       = perf_event__repipe_auxtrace,
-+                      .dont_split_sample_group = true,
-               },
-               .input_name  = "-",
-               .samples = LIST_HEAD_INIT(inject.samples),
-diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
-index 7ba9dd1402ed2..60c44cb33d4a2 100644
---- a/tools/perf/util/session.c
-+++ b/tools/perf/util/session.c
-@@ -1453,6 +1453,9 @@ static int deliver_sample_group(struct evlist *evlist,
-       int ret = -EINVAL;
-       struct sample_read_value *v = sample->read.group.values;
-+      if (tool->dont_split_sample_group)
-+              return deliver_sample_value(evlist, tool, event, sample, v, machine);
-+
-       sample_read_group__for_each(v, sample->read.group.nr, read_format) {
-               ret = deliver_sample_value(evlist, tool, event, sample, v,
-                                          machine);
-diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
-index bbbc0dcd461ff..504bed227d1e1 100644
---- a/tools/perf/util/tool.h
-+++ b/tools/perf/util/tool.h
-@@ -82,6 +82,7 @@ struct perf_tool {
-       bool            namespace_events;
-       bool            cgroup_events;
-       bool            no_warn;
-+      bool            dont_split_sample_group;
-       enum show_feature_header show_feat_hdr;
- };
--- 
-2.43.0
-
diff --git a/queue-5.15/perf-test-sample-parsing-add-endian-test-for-struct-.patch b/queue-5.15/perf-test-sample-parsing-add-endian-test-for-struct-.patch
deleted file mode 100644 (file)
index 6bc1288..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-From 3cf002e2724e30205478df45fb91e8df072c4fce Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Oct 2021 17:07:14 +0530
-Subject: perf test sample-parsing: Add endian test for struct branch_flags
-
-From: Madhavan Srinivasan <maddy@linux.ibm.com>
-
-[ Upstream commit 10269a2ca2b08cbdda9232771e59ba901b87a074 ]
-
-Extend the sample-parsing test to include a branch_flag bitfield-endian
-swap test.
-
-This patch adds a include for "util/trace-event.h" in the sample-parsing
-test for importing tep_is_bigendian() and extends samples_same() to
-include "needs_swap" to detect/enable check for bitfield-endian swap.
-
-Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
-Acked-by: Jiri Olsa <jolsa@redhat.com>
-Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Kajol Jain <kjain@linux.ibm.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Michael Ellerman <michael@ellerman.id.au>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Stephane Eranian <eranian@google.com>
-Link: http://lore.kernel.org/lkml/20211028113714.600549-2-maddy@linux.ibm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: 79bcd34e0f3d ("perf inject: Fix leader sampling inserting additional samples")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/tests/sample-parsing.c | 43 +++++++++++++++++++++++++++----
- 1 file changed, 38 insertions(+), 5 deletions(-)
-
-diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
-index 8fd8a4ef97da1..c83a115141291 100644
---- a/tools/perf/tests/sample-parsing.c
-+++ b/tools/perf/tests/sample-parsing.c
-@@ -13,6 +13,7 @@
- #include "evsel.h"
- #include "debug.h"
- #include "util/synthetic-events.h"
-+#include "util/trace-event.h"
- #include "tests.h"
-@@ -30,9 +31,18 @@
-       }                                               \
- } while (0)
-+/*
-+ * Hardcode the expected values for branch_entry flags.
-+ * These are based on the input value (213) specified
-+ * in branch_stack variable.
-+ */
-+#define BS_EXPECTED_BE        0xa00d000000000000
-+#define BS_EXPECTED_LE        0xd5000000
-+#define FLAG(s)       s->branch_stack->entries[i].flags
-+
- static bool samples_same(const struct perf_sample *s1,
-                        const struct perf_sample *s2,
--                       u64 type, u64 read_format)
-+                       u64 type, u64 read_format, bool needs_swap)
- {
-       size_t i;
-@@ -100,8 +110,14 @@ static bool samples_same(const struct perf_sample *s1,
-       if (type & PERF_SAMPLE_BRANCH_STACK) {
-               COMP(branch_stack->nr);
-               COMP(branch_stack->hw_idx);
--              for (i = 0; i < s1->branch_stack->nr; i++)
--                      MCOMP(branch_stack->entries[i]);
-+              for (i = 0; i < s1->branch_stack->nr; i++) {
-+                      if (needs_swap)
-+                              return ((tep_is_bigendian()) ?
-+                                      (FLAG(s2).value == BS_EXPECTED_BE) :
-+                                      (FLAG(s2).value == BS_EXPECTED_LE));
-+                      else
-+                              MCOMP(branch_stack->entries[i]);
-+              }
-       }
-       if (type & PERF_SAMPLE_REGS_USER) {
-@@ -248,7 +264,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
-               },
-       };
-       struct sample_read_value values[] = {{1, 5}, {9, 3}, {2, 7}, {6, 4},};
--      struct perf_sample sample_out;
-+      struct perf_sample sample_out, sample_out_endian;
-       size_t i, sz, bufsz;
-       int err, ret = -1;
-@@ -313,12 +329,29 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
-               goto out_free;
-       }
--      if (!samples_same(&sample, &sample_out, sample_type, read_format)) {
-+      if (!samples_same(&sample, &sample_out, sample_type, read_format, evsel.needs_swap)) {
-               pr_debug("parsing failed for sample_type %#"PRIx64"\n",
-                        sample_type);
-               goto out_free;
-       }
-+      if (sample_type == PERF_SAMPLE_BRANCH_STACK) {
-+              evsel.needs_swap = true;
-+              evsel.sample_size = __evsel__sample_size(sample_type);
-+              err = evsel__parse_sample(&evsel, event, &sample_out_endian);
-+              if (err) {
-+                      pr_debug("%s failed for sample_type %#"PRIx64", error %d\n",
-+                               "evsel__parse_sample", sample_type, err);
-+                      goto out_free;
-+              }
-+
-+              if (!samples_same(&sample, &sample_out_endian, sample_type, read_format, evsel.needs_swap)) {
-+                      pr_debug("parsing failed for sample_type %#"PRIx64"\n",
-+                               sample_type);
-+                      goto out_free;
-+              }
-+      }
-+
-       ret = 0;
- out_free:
-       free(event);
--- 
-2.43.0
-
diff --git a/queue-5.15/perf-test-sample-parsing-fix-branch_stack-entry-endianness-check.patch b/queue-5.15/perf-test-sample-parsing-fix-branch_stack-entry-endianness-check.patch
deleted file mode 100644 (file)
index f07af85..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-From cb5a63feae2d963cac7b687e6598d620bed13507 Mon Sep 17 00:00:00 2001
-From: Thomas Richter <tmricht@linux.ibm.com>
-Date: Wed, 17 Nov 2021 09:26:09 +0100
-Subject: perf test sample-parsing: Fix branch_stack entry endianness check
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-commit cb5a63feae2d963cac7b687e6598d620bed13507 upstream.
-
-Commit 10269a2ca2b08cbd ("perf test sample-parsing: Add endian test for
-struct branch_flags") broke the test case 27 (Sample parsing) on s390 on
-linux-next tree:
-
-  # perf test -Fv 27
-  27: Sample parsing
-  --- start ---
-  parsing failed for sample_type 0x800
-  ---- end ----
-  Sample parsing: FAILED!
-  #
-
-The cause of the failure is a wrong #define BS_EXPECTED_BE statement in
-above commit.  Correct this define and the test case runs fine.
-
-Output After:
-
-  # perf test -Fv 27
-  27: Sample parsing                                                  :
-  --- start ---
-  ---- end ----
-  Sample parsing: Ok
-  #
-
-Fixes: 10269a2ca2b08c ("perf test sample-parsing: Add endian test for struct branch_flags")
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Tested-by: Madhavan Srinivasan <maddy@linux.ibm.com>
-Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com>
-CC: Sven Schnelle <svens@linux.ibm.com>
-Cc: Heiko Carstens <hca@linux.ibm.com>
-Cc: Jiri Olsa <jolsa@redhat.com>
-Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Cc: Vasily Gorbik <gor@linux.ibm.com>
-Link: https://lore.kernel.org/r/54077e81-503e-3405-6cb0-6541eb5532cc@linux.ibm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- tools/perf/tests/sample-parsing.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/tools/perf/tests/sample-parsing.c
-+++ b/tools/perf/tests/sample-parsing.c
-@@ -36,7 +36,7 @@
-  * These are based on the input value (213) specified
-  * in branch_stack variable.
-  */
--#define BS_EXPECTED_BE        0xa00d000000000000
-+#define BS_EXPECTED_BE        0xa000d00000000000
- #define BS_EXPECTED_LE        0xd5000000
- #define FLAG(s)       s->branch_stack->entries[i].flags
diff --git a/queue-5.15/perf-tools-support-reading-perf_format_lost.patch b/queue-5.15/perf-tools-support-reading-perf_format_lost.patch
deleted file mode 100644 (file)
index adc068b..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-From 174aa0b3d67756588b5050e01a4075eb6fdaec55 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Aug 2022 17:36:44 -0700
-Subject: perf tools: Support reading PERF_FORMAT_LOST
-
-From: Namhyung Kim <namhyung@kernel.org>
-
-[ Upstream commit f52679b78877f17e95a317e18a4c9c46cc3d845a ]
-
-The recent kernel added lost count can be read from either read(2) or
-ring buffer data with PERF_SAMPLE_READ.  As it's a variable length data
-we need to access it according to the format info.
-
-But for perf tools use cases, PERF_FORMAT_ID is always set.  So we can
-only check PERF_FORMAT_LOST bit to determine the data format.
-
-Add sample_read_value_size() and next_sample_read_value() helpers to
-make it a bit easier to access.  Use them in all places where it reads
-the struct sample_read_value.
-
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Acked-by: Jiri Olsa <jolsa@kernel.org>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20220819003644.508916-5-namhyung@kernel.org
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: 79bcd34e0f3d ("perf inject: Fix leader sampling inserting additional samples")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/tests/sample-parsing.c             | 14 +++++---
- tools/perf/util/event.h                       | 21 ++++++++++-
- tools/perf/util/evsel.c                       | 29 +++++++++------
- .../scripting-engines/trace-event-python.c    | 19 +++++++---
- tools/perf/util/session.c                     | 35 +++++++++++--------
- tools/perf/util/synthetic-events.c            | 32 +++++++++++++----
- 6 files changed, 108 insertions(+), 42 deletions(-)
-
-diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
-index c83a115141291..ac2c21d402a4b 100644
---- a/tools/perf/tests/sample-parsing.c
-+++ b/tools/perf/tests/sample-parsing.c
-@@ -86,10 +86,15 @@ static bool samples_same(const struct perf_sample *s1,
-                       COMP(read.time_running);
-               /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
-               if (read_format & PERF_FORMAT_GROUP) {
--                      for (i = 0; i < s1->read.group.nr; i++)
--                              MCOMP(read.group.values[i]);
-+                      for (i = 0; i < s1->read.group.nr; i++) {
-+                              /* FIXME: check values without LOST */
-+                              if (read_format & PERF_FORMAT_LOST)
-+                                      MCOMP(read.group.values[i]);
-+                      }
-               } else {
-                       COMP(read.one.id);
-+                      if (read_format & PERF_FORMAT_LOST)
-+                              COMP(read.one.lost);
-               }
-       }
-@@ -263,7 +268,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
-                       .data   = (void *)aux_data,
-               },
-       };
--      struct sample_read_value values[] = {{1, 5}, {9, 3}, {2, 7}, {6, 4},};
-+      struct sample_read_value values[] = {{1, 5, 0}, {9, 3, 0}, {2, 7, 0}, {6, 4, 1},};
-       struct perf_sample sample_out, sample_out_endian;
-       size_t i, sz, bufsz;
-       int err, ret = -1;
-@@ -286,6 +291,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
-       } else {
-               sample.read.one.value = 0x08789faeb786aa87ULL;
-               sample.read.one.id    = 99;
-+              sample.read.one.lost  = 1;
-       }
-       sz = perf_event__sample_event_size(&sample, sample_type, read_format);
-@@ -370,7 +376,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
-  */
- int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_unused)
- {
--      const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15};
-+      const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 28, 29, 30, 31};
-       u64 sample_type;
-       u64 sample_regs;
-       size_t i;
-diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
-index 19ad64f2bd830..144c82f8e7ffd 100644
---- a/tools/perf/util/event.h
-+++ b/tools/perf/util/event.h
-@@ -62,7 +62,8 @@ struct stack_dump {
- struct sample_read_value {
-       u64 value;
--      u64 id;
-+      u64 id;   /* only if PERF_FORMAT_ID */
-+      u64 lost; /* only if PERF_FORMAT_LOST */
- };
- struct sample_read {
-@@ -77,6 +78,24 @@ struct sample_read {
-       };
- };
-+static inline size_t sample_read_value_size(u64 read_format)
-+{
-+      /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
-+      if (read_format & PERF_FORMAT_LOST)
-+              return sizeof(struct sample_read_value);
-+      else
-+              return offsetof(struct sample_read_value, lost);
-+}
-+
-+static inline struct sample_read_value *
-+next_sample_read_value(struct sample_read_value *v, u64 read_format)
-+{
-+      return (void *)v + sample_read_value_size(read_format);
-+}
-+
-+#define sample_read_group__for_each(v, nr, rf)                \
-+      for (int __i = 0; __i < (int)nr; v = next_sample_read_value(v, rf), __i++)
-+
- struct ip_callchain {
-       u64 nr;
-       u64 ips[];
-diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
-index 4f4226f380d1c..1a6f42924cca8 100644
---- a/tools/perf/util/evsel.c
-+++ b/tools/perf/util/evsel.c
-@@ -1493,7 +1493,7 @@ static int evsel__read_one(struct evsel *evsel, int cpu, int thread)
- }
- static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread,
--                           u64 val, u64 ena, u64 run)
-+                           u64 val, u64 ena, u64 run, u64 lost)
- {
-       struct perf_counts_values *count;
-@@ -1502,6 +1502,7 @@ static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread,
-       count->val    = val;
-       count->ena    = ena;
-       count->run    = run;
-+      count->lost   = lost;
-       perf_counts__set_loaded(counter->counts, cpu_map_idx, thread, true);
- }
-@@ -1510,7 +1511,7 @@ static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int
- {
-       u64 read_format = leader->core.attr.read_format;
-       struct sample_read_value *v;
--      u64 nr, ena = 0, run = 0, i;
-+      u64 nr, ena = 0, run = 0, lost = 0;
-       nr = *data++;
-@@ -1523,18 +1524,18 @@ static int evsel__process_group_data(struct evsel *leader, int cpu_map_idx, int
-       if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
-               run = *data++;
--      v = (struct sample_read_value *) data;
--
--      evsel__set_count(leader, cpu_map_idx, thread, v[0].value, ena, run);
--
--      for (i = 1; i < nr; i++) {
-+      v = (void *)data;
-+      sample_read_group__for_each(v, nr, read_format) {
-               struct evsel *counter;
--              counter = evlist__id2evsel(leader->evlist, v[i].id);
-+              counter = evlist__id2evsel(leader->evlist, v->id);
-               if (!counter)
-                       return -EINVAL;
--              evsel__set_count(counter, cpu_map_idx, thread, v[i].value, ena, run);
-+              if (read_format & PERF_FORMAT_LOST)
-+                      lost = v->lost;
-+
-+              evsel__set_count(counter, cpu_map_idx, thread, v->value, ena, run, lost);
-       }
-       return 0;
-@@ -2358,8 +2359,8 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
-                       if (data->read.group.nr > max_group_nr)
-                               return -EFAULT;
--                      sz = data->read.group.nr *
--                           sizeof(struct sample_read_value);
-+
-+                      sz = data->read.group.nr * sample_read_value_size(read_format);
-                       OVERFLOW_CHECK(array, sz, max_size);
-                       data->read.group.values =
-                                       (struct sample_read_value *)array;
-@@ -2368,6 +2369,12 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
-                       OVERFLOW_CHECK_u64(array);
-                       data->read.one.id = *array;
-                       array++;
-+
-+                      if (read_format & PERF_FORMAT_LOST) {
-+                              OVERFLOW_CHECK_u64(array);
-+                              data->read.one.lost = *array;
-+                              array++;
-+                      }
-               }
-       }
-diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
-index c0c010350bc2a..ec547bf99182b 100644
---- a/tools/perf/util/scripting-engines/trace-event-python.c
-+++ b/tools/perf/util/scripting-engines/trace-event-python.c
-@@ -622,15 +622,19 @@ static PyObject *python_process_brstacksym(struct perf_sample *sample,
-       return pylist;
- }
--static PyObject *get_sample_value_as_tuple(struct sample_read_value *value)
-+static PyObject *get_sample_value_as_tuple(struct sample_read_value *value,
-+                                         u64 read_format)
- {
-       PyObject *t;
--      t = PyTuple_New(2);
-+      t = PyTuple_New(3);
-       if (!t)
-               Py_FatalError("couldn't create Python tuple");
-       PyTuple_SetItem(t, 0, PyLong_FromUnsignedLongLong(value->id));
-       PyTuple_SetItem(t, 1, PyLong_FromUnsignedLongLong(value->value));
-+      if (read_format & PERF_FORMAT_LOST)
-+              PyTuple_SetItem(t, 2, PyLong_FromUnsignedLongLong(value->lost));
-+
-       return t;
- }
-@@ -661,12 +665,17 @@ static void set_sample_read_in_dict(PyObject *dict_sample,
-               Py_FatalError("couldn't create Python list");
-       if (read_format & PERF_FORMAT_GROUP) {
--              for (i = 0; i < sample->read.group.nr; i++) {
--                      PyObject *t = get_sample_value_as_tuple(&sample->read.group.values[i]);
-+              struct sample_read_value *v = sample->read.group.values;
-+
-+              i = 0;
-+              sample_read_group__for_each(v, sample->read.group.nr, read_format) {
-+                      PyObject *t = get_sample_value_as_tuple(v, read_format);
-                       PyList_SET_ITEM(values, i, t);
-+                      i++;
-               }
-       } else {
--              PyObject *t = get_sample_value_as_tuple(&sample->read.one);
-+              PyObject *t = get_sample_value_as_tuple(&sample->read.one,
-+                                                      read_format);
-               PyList_SET_ITEM(values, 0, t);
-       }
-       pydict_set_item_string_decref(dict_sample, "values", values);
-diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
-index 562e9b8080272..7ba9dd1402ed2 100644
---- a/tools/perf/util/session.c
-+++ b/tools/perf/util/session.c
-@@ -1254,21 +1254,25 @@ static void sample_read__printf(struct perf_sample *sample, u64 read_format)
-                      sample->read.time_running);
-       if (read_format & PERF_FORMAT_GROUP) {
--              u64 i;
-+              struct sample_read_value *value = sample->read.group.values;
-               printf(".... group nr %" PRIu64 "\n", sample->read.group.nr);
--              for (i = 0; i < sample->read.group.nr; i++) {
--                      struct sample_read_value *value;
--
--                      value = &sample->read.group.values[i];
-+              sample_read_group__for_each(value, sample->read.group.nr, read_format) {
-                       printf("..... id %016" PRIx64
--                             ", value %016" PRIx64 "\n",
-+                             ", value %016" PRIx64,
-                              value->id, value->value);
-+                      if (read_format & PERF_FORMAT_LOST)
-+                              printf(", lost %" PRIu64, value->lost);
-+                      printf("\n");
-               }
--      } else
--              printf("..... id %016" PRIx64 ", value %016" PRIx64 "\n",
-+      } else {
-+              printf("..... id %016" PRIx64 ", value %016" PRIx64,
-                       sample->read.one.id, sample->read.one.value);
-+              if (read_format & PERF_FORMAT_LOST)
-+                      printf(", lost %" PRIu64, sample->read.one.lost);
-+              printf("\n");
-+      }
- }
- static void dump_event(struct evlist *evlist, union perf_event *event,
-@@ -1381,6 +1385,9 @@ static void dump_read(struct evsel *evsel, union perf_event *event)
-       if (read_format & PERF_FORMAT_ID)
-               printf("... id           : %" PRI_lu64 "\n", read_event->id);
-+
-+      if (read_format & PERF_FORMAT_LOST)
-+              printf("... lost         : %" PRI_lu64 "\n", read_event->lost);
- }
- static struct machine *machines__find_for_cpumode(struct machines *machines,
-@@ -1440,14 +1447,14 @@ static int deliver_sample_group(struct evlist *evlist,
-                               struct perf_tool *tool,
-                               union  perf_event *event,
-                               struct perf_sample *sample,
--                              struct machine *machine)
-+                              struct machine *machine,
-+                              u64 read_format)
- {
-       int ret = -EINVAL;
--      u64 i;
-+      struct sample_read_value *v = sample->read.group.values;
--      for (i = 0; i < sample->read.group.nr; i++) {
--              ret = deliver_sample_value(evlist, tool, event, sample,
--                                         &sample->read.group.values[i],
-+      sample_read_group__for_each(v, sample->read.group.nr, read_format) {
-+              ret = deliver_sample_value(evlist, tool, event, sample, v,
-                                          machine);
-               if (ret)
-                       break;
-@@ -1471,7 +1478,7 @@ static int evlist__deliver_sample(struct evlist *evlist, struct perf_tool *tool,
-       /* For PERF_SAMPLE_READ we have either single or group mode. */
-       if (read_format & PERF_FORMAT_GROUP)
-               return deliver_sample_group(evlist, tool, event, sample,
--                                          machine);
-+                                          machine, read_format);
-       else
-               return deliver_sample_value(evlist, tool, event, sample,
-                                           &sample->read.one, machine);
-diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
-index c69ad7a1a6a78..d020f286b9c1f 100644
---- a/tools/perf/util/synthetic-events.c
-+++ b/tools/perf/util/synthetic-events.c
-@@ -1436,11 +1436,12 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
-                       result += sizeof(u64);
-               /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
-               if (read_format & PERF_FORMAT_GROUP) {
--                      sz = sample->read.group.nr *
--                           sizeof(struct sample_read_value);
--                      result += sz;
-+                      sz = sample_read_value_size(read_format);
-+                      result += sz * sample->read.group.nr;
-               } else {
-                       result += sizeof(u64);
-+                      if (read_format & PERF_FORMAT_LOST)
-+                              result += sizeof(u64);
-               }
-       }
-@@ -1525,6 +1526,20 @@ void __weak arch_perf_synthesize_sample_weight(const struct perf_sample *data,
-       *array = data->weight;
- }
-+static __u64 *copy_read_group_values(__u64 *array, __u64 read_format,
-+                                   const struct perf_sample *sample)
-+{
-+      size_t sz = sample_read_value_size(read_format);
-+      struct sample_read_value *v = sample->read.group.values;
-+
-+      sample_read_group__for_each(v, sample->read.group.nr, read_format) {
-+              /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
-+              memcpy(array, v, sz);
-+              array = (void *)array + sz;
-+      }
-+      return array;
-+}
-+
- int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format,
-                                 const struct perf_sample *sample)
- {
-@@ -1606,13 +1621,16 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_fo
-               /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
-               if (read_format & PERF_FORMAT_GROUP) {
--                      sz = sample->read.group.nr *
--                           sizeof(struct sample_read_value);
--                      memcpy(array, sample->read.group.values, sz);
--                      array = (void *)array + sz;
-+                      array = copy_read_group_values(array, read_format,
-+                                                     sample);
-               } else {
-                       *array = sample->read.one.id;
-                       array++;
-+
-+                      if (read_format & PERF_FORMAT_LOST) {
-+                              *array = sample->read.one.lost;
-+                              array++;
-+                      }
-               }
-       }
--- 
-2.43.0
-
index a51d237346d3f6b92c772eeec6849b89c7e782f4..1518c316ba727a7e40169516bb7cab2484409513 100644 (file)
@@ -212,11 +212,6 @@ nilfs2-determine-empty-node-blocks-as-corrupted.patch
 nilfs2-fix-potential-oob-read-in-nilfs_btree_check_d.patch
 bpf-fix-bpf_strtol-and-bpf_strtoul-helpers-for-32bit.patch
 perf-mem-free-the-allocated-sort-string-fixing-a-lea.patch
-perf-test-sample-parsing-add-endian-test-for-struct-.patch
-perf-evsel-reduce-scope-of-evsel__ignore_missing_thr.patch
-perf-evsel-rename-variable-cpu-to-index.patch
-perf-tools-support-reading-perf_format_lost.patch
-perf-inject-fix-leader-sampling-inserting-additional.patch
 perf-sched-timehist-fix-missing-free-of-session-in-p.patch
 perf-sched-timehist-fixed-timestamp-error-when-unabl.patch
 perf-time-utils-fix-32-bit-nsec-parsing.patch
@@ -677,7 +672,6 @@ mptcp-pm-do-not-remove-closing-subflows.patch
 nouveau-dmem-fix-vulnerability-in-migrate_to_ram-upon-copy-error.patch
 kthread-unpark-only-parked-kthread.patch
 block-bfq-fix-uaf-for-accessing-waker_bfqq-after-splitting.patch
-perf-test-sample-parsing-fix-branch_stack-entry-endianness-check.patch
 i2c-smbus-check-for-parent-device-before-dereference.patch
 net-geneve-add-missing-netlink-policy-and-size-for-ifla_geneve_inner_proto_inherit.patch
 xfrm-pass-flowi_oif-or-l3mdev-as-oif-to-xfrm_dst_lookup.patch