From: Greg Kroah-Hartman Date: Tue, 3 Mar 2020 15:54:10 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v4.19.108~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60b68f42326f89e499ea331a0760bd4d3bbe2fbc;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: perf-stat-fix-shadow-stats-for-clock-events.patch perf-stat-use-perf_evsel__is_clocki-for-clock-events.patch --- diff --git a/queue-4.19/perf-stat-fix-shadow-stats-for-clock-events.patch b/queue-4.19/perf-stat-fix-shadow-stats-for-clock-events.patch new file mode 100644 index 00000000000..2157816c5c6 --- /dev/null +++ b/queue-4.19/perf-stat-fix-shadow-stats-for-clock-events.patch @@ -0,0 +1,64 @@ +From 57ddf09173c1e7d0511ead8924675c7198e56545 Mon Sep 17 00:00:00 2001 +From: Ravi Bangoria +Date: Fri, 16 Nov 2018 09:58:43 +0530 +Subject: perf stat: Fix shadow stats for clock events + +From: Ravi Bangoria + +commit 57ddf09173c1e7d0511ead8924675c7198e56545 upstream. + +Commit 0aa802a79469 ("perf stat: Get rid of extra clock display +function") introduced scale and unit for clock events. Thus, +perf_stat__update_shadow_stats() now saves scaled values of clock events +in msecs, instead of original nsecs. But while calculating values of +shadow stats we still consider clock event values in nsecs. This results +in a wrong shadow stat values. Ex, + + # ./perf stat -e task-clock,cycles ls + + 2.60 msec task-clock:u # 0.877 CPUs utilized + 2,430,564 cycles:u # 1215282.000 GHz + +Fix this by saving original nsec values for clock events in +perf_stat__update_shadow_stats(). After patch: + + # ./perf stat -e task-clock,cycles ls + + 3.14 msec task-clock:u # 0.839 CPUs utilized + 3,094,528 cycles:u # 0.985 GHz + +Suggested-by: Jiri Olsa +Reported-by: Anton Blanchard +Signed-off-by: Ravi Bangoria +Reviewed-by: Jiri Olsa +Cc: Alexander Shishkin +Cc: Jin Yao +Cc: Namhyung Kim +Cc: Thomas Richter +Cc: yuzhoujian@didichuxing.com +Fixes: 0aa802a79469 ("perf stat: Get rid of extra clock display function") +Link: http://lkml.kernel.org/r/20181116042843.24067-1-ravi.bangoria@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Cc: Tommi Rantala +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/stat-shadow.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/tools/perf/util/stat-shadow.c ++++ b/tools/perf/util/stat-shadow.c +@@ -209,11 +209,12 @@ void perf_stat__update_shadow_stats(stru + int cpu, struct runtime_stat *st) + { + int ctx = evsel_context(counter); ++ u64 count_ns = count; + + count *= counter->scale; + + if (perf_evsel__is_clock(counter)) +- update_runtime_stat(st, STAT_NSECS, 0, cpu, count); ++ update_runtime_stat(st, STAT_NSECS, 0, cpu, count_ns); + else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) + update_runtime_stat(st, STAT_CYCLES, ctx, cpu, count); + else if (perf_stat_evsel__is(counter, CYCLES_IN_TX)) diff --git a/queue-4.19/perf-stat-use-perf_evsel__is_clocki-for-clock-events.patch b/queue-4.19/perf-stat-use-perf_evsel__is_clocki-for-clock-events.patch new file mode 100644 index 00000000000..335e600f76e --- /dev/null +++ b/queue-4.19/perf-stat-use-perf_evsel__is_clocki-for-clock-events.patch @@ -0,0 +1,41 @@ +From eb08d006054e7e374592068919e32579988602d4 Mon Sep 17 00:00:00 2001 +From: Ravi Bangoria +Date: Thu, 15 Nov 2018 15:25:32 +0530 +Subject: perf stat: Use perf_evsel__is_clocki() for clock events + +From: Ravi Bangoria + +commit eb08d006054e7e374592068919e32579988602d4 upstream. + +We already have function to check if a given event is either +SW_CPU_CLOCK or SW_TASK_CLOCK. Utilize it. + +Signed-off-by: Ravi Bangoria +Acked-by: Jiri Olsa +Cc: Alexander Shishkin +Cc: Anton Blanchard +Cc: Jin Yao +Cc: Namhyung Kim +Cc: Thomas Richter +Cc: yuzhoujian@didichuxing.com +Link: http://lkml.kernel.org/r/20181115095533.16930-1-ravi.bangoria@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Cc: Tommi Rantala +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/stat-shadow.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/tools/perf/util/stat-shadow.c ++++ b/tools/perf/util/stat-shadow.c +@@ -212,8 +212,7 @@ void perf_stat__update_shadow_stats(stru + + count *= counter->scale; + +- if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK) || +- perf_evsel__match(counter, SOFTWARE, SW_CPU_CLOCK)) ++ if (perf_evsel__is_clock(counter)) + update_runtime_stat(st, STAT_NSECS, 0, cpu, count); + else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) + update_runtime_stat(st, STAT_CYCLES, ctx, cpu, count); diff --git a/queue-4.19/series b/queue-4.19/series index 93671ab53cd..c4f141f3cd0 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -71,3 +71,5 @@ kvm-svm-override-default-mmio-mask-if-memory-encryption-is-enabled.patch kvm-check-for-a-bad-hva-before-dropping-into-the-ghc-slow-path.patch sched-fair-optimize-update_blocked_averages.patch sched-fair-fix-o-nr_cgroups-in-the-load-balancing-path.patch +perf-stat-use-perf_evsel__is_clocki-for-clock-events.patch +perf-stat-fix-shadow-stats-for-clock-events.patch