From a02e37d0a8d15b8178d6a3979bb7291fa445a4d7 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Aug 30 2023 17:41:08 +0000 Subject: Linux v6.4.13 Backport additional perf stat patch from v6.5.0 Signed-off-by: Michel Lind --- diff --git a/0001-perf-stat-Show-average-value-on-multiple-runs.patch b/0001-perf-stat-Show-average-value-on-multiple-runs.patch new file mode 100644 index 0000000..46b64c6 --- /dev/null +++ b/0001-perf-stat-Show-average-value-on-multiple-runs.patch @@ -0,0 +1,95 @@ +From c90a5d6209fa9a6e6cf25456828a5966c6e09206 Mon Sep 17 00:00:00 2001 +From: Namhyung Kim +Date: Fri, 16 Jun 2023 00:32:11 -0700 +Subject: [PATCH] perf stat: Show average value on multiple runs + +When -r option is used, perf stat runs the command multiple times and +update stats in the evsel->stats.res_stats for global aggregation. But +the value is never used and the value it prints at the end is just the +value from the last run. I think we should print the average number of +multiple runs. + +Add evlist__copy_res_stats() to update the aggr counter (for display) +using the values in the evsel->stats.res_stats. + +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Andi Kleen +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20230616073211.1057936-2-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +--- + tools/perf/builtin-stat.c | 5 ++++- + tools/perf/util/stat.c | 22 ++++++++++++++++++++++ + tools/perf/util/stat.h | 1 + + 3 files changed, 27 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c +index 463643cda0d5..fc8bc04ee1f2 100644 +--- a/tools/perf/builtin-stat.c ++++ b/tools/perf/builtin-stat.c +@@ -2569,8 +2569,11 @@ int cmd_stat(int argc, const char **argv) + } + } + +- if (!forever && status != -1 && (!interval || stat_config.summary)) ++ if (!forever && status != -1 && (!interval || stat_config.summary)) { ++ if (stat_config.run_count > 1) ++ evlist__copy_res_stats(&stat_config, evsel_list); + print_counters(NULL, argc, argv); ++ } + + evlist__finalize_ctlfd(evsel_list); + +diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c +index 0f7b8a8cdea6..967e583392c7 100644 +--- a/tools/perf/util/stat.c ++++ b/tools/perf/util/stat.c +@@ -264,6 +264,28 @@ void evlist__copy_prev_raw_counts(struct evlist *evlist) + evsel__copy_prev_raw_counts(evsel); + } + ++static void evsel__copy_res_stats(struct evsel *evsel) ++{ ++ struct perf_stat_evsel *ps = evsel->stats; ++ ++ /* ++ * For GLOBAL aggregation mode, it updates the counts for each run ++ * in the evsel->stats.res_stats. See perf_stat_process_counter(). ++ */ ++ *ps->aggr[0].counts.values = avg_stats(&ps->res_stats); ++} ++ ++void evlist__copy_res_stats(struct perf_stat_config *config, struct evlist *evlist) ++{ ++ struct evsel *evsel; ++ ++ if (config->aggr_mode != AGGR_GLOBAL) ++ return; ++ ++ evlist__for_each_entry(evlist, evsel) ++ evsel__copy_res_stats(evsel); ++} ++ + static size_t pkg_id_hash(long __key, void *ctx __maybe_unused) + { + uint64_t *key = (uint64_t *) __key; +diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h +index e35e188237c8..ff15bb3cbe19 100644 +--- a/tools/perf/util/stat.h ++++ b/tools/perf/util/stat.h +@@ -180,6 +180,7 @@ void evlist__save_aggr_prev_raw_counts(struct evlist *evlist); + + int evlist__alloc_aggr_stats(struct evlist *evlist, int nr_aggr); + void evlist__reset_aggr_stats(struct evlist *evlist); ++void evlist__copy_res_stats(struct perf_stat_config *config, struct evlist *evlist); + + int perf_stat_process_counter(struct perf_stat_config *config, + struct evsel *counter); +-- +2.41.0 + diff --git a/kernel-tools.spec b/kernel-tools.spec index 83404aa..7b0e6f5 100644 --- a/kernel-tools.spec +++ b/kernel-tools.spec @@ -33,7 +33,7 @@ %if 0%{?released_kernel} # Do we have a -stable update to apply? -%global stable_update 4 +%global stable_update 13 # Set rpm version accordingly %if 0%{?stable_update} %global stablerev %{stable_update} @@ -57,7 +57,7 @@ # pkg_release is what we'll fill in for the rpm Release: field %if 0%{?released_kernel} -%global pkg_release %{fedora_build}%{?buildid}%{?dist} +%global pkg_release %{fedora_build}%{?buildid}.1%{?dist} %else @@ -136,6 +136,8 @@ Source5000: patch-%{upstream_major}.%{upstream_sublevel}-rc%{rcrev}.xz %endif Patch1: kernel-tools-c99.patch +# perf stat patch cherry-picked from dada1a1f5fbc +Patch2: 0001-perf-stat-Show-average-value-on-multiple-runs.patch Name: kernel-tools Summary: Assortment of tools for the Linux kernel @@ -240,7 +242,7 @@ analysing the logical and timing behavior of Linux. %prep -%setup -q -n kernel-%{kversion}%{?dist} -c +%setup -q -n kernel-%{kversion}.1%{?dist} -c cd linux-%{kversion} @@ -253,7 +255,8 @@ cd linux-%{kversion} xzcat %{SOURCE5000} | patch -p1 -F1 -s %endif -%patch1 -p1 +%patch -P 1 -p1 +%patch -P 2 -p1 # END OF PATCH APPLICATIONS @@ -590,7 +593,12 @@ popd %{_includedir}/perf/bpf_perf.h %{_includedir}/perf/core.h %{_includedir}/perf/cpumap.h +%if 0%{?el8} +# conflicts with kernel-headers +%exclude %{_includedir}/perf/perf_dlfilter.h +%else %{_includedir}/perf/perf_dlfilter.h +%endif %{_includedir}/perf/event.h %{_includedir}/perf/evlist.h %{_includedir}/perf/evsel.h @@ -629,6 +637,10 @@ popd %{_mandir}/man1/rv.1.gz %changelog +* Wed Aug 30 2023 Michel Lind - 6.4.13-200.1 +- Linux v6.4.13 +- Backport additional perf stat patch from v6.5.0 + * Wed Jul 19 2023 Justin M. Forbes - 6.4.4-200 - Linux v6.4.4 diff --git a/sources b/sources index f9c3773..b4fa2a6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ SHA512 (linux-6.4.tar.xz) = 11a48b25e0b513782d3b89101c2ec8dd9cefd6ce08dc63a91137903b66392aa72ca1fe32816710673af84dd47de3ab8738056a6af93dc0d5e60ef4b869b49928 -SHA512 (patch-6.4.4.xz) = ff17b28aca777e4468aef9d278871f921a6d9c6d2ccbf1efbc85acc5bb002e3450cd1de7c50fa49c99531cfd8a29b5a504c2db22db05b956cfe7c085ba2e46aa +SHA512 (patch-6.4.13.xz) = 48d5dfc7b84e31842057c227858373e8d79a02dc495e6e12268f8e26edb3df4796ef2fbc0206cdf4f034fbb5f5f0b9650c97b5f6013ae14cf53462fdc1f0e915