Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: srikar@linux.vnet.ibm.com, acme@redhat.com, eranian@google.com,
	jolsa@kernel.org, namhyung@kernel.org,
	naveen.n.rao@linux.vnet.ibm.com, ravi.bangoria@linux.ibm.com,
	stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] perf stat: Reset previous counts on repeat with interval" failed to apply to 5.3-stable tree
Date: Tue, 8 Oct 2019 20:12:36 -0400	[thread overview]
Message-ID: <20191009001236.GO1396@sasha-vm> (raw)
In-Reply-To: <157055530314038@kroah.com>

On Tue, Oct 08, 2019 at 07:21:43PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 5.3-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From b63fd11cced17fcb8e133def29001b0f6aaa5e06 Mon Sep 17 00:00:00 2001
>From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>Date: Wed, 4 Sep 2019 15:17:37 +0530
>Subject: [PATCH] perf stat: Reset previous counts on repeat with interval
>
>When using 'perf stat' with repeat and interval option, it shows wrong
>values for events.
>
>The wrong values will be shown for the first interval on the second and
>subsequent repetitions.
>
>Without the fix:
>
>  # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5
>
>     2.000282489                 53      faults
>     2.000282489                513      sched:sched_switch
>     4.005478208              3,721      faults
>     4.005478208              2,666      sched:sched_switch
>     5.025470933                395      faults
>     5.025470933              1,307      sched:sched_switch
>     2.009602825 1,84,46,74,40,73,70,95,47,520      faults 		<------
>     2.009602825 1,84,46,74,40,73,70,95,49,568      sched:sched_switch  <------
>     4.019612206              4,730      faults
>     4.019612206              2,746      sched:sched_switch
>     5.039615484              3,953      faults
>     5.039615484              1,496      sched:sched_switch
>     2.000274620 1,84,46,74,40,73,70,95,47,520      faults		<------
>     2.000274620 1,84,46,74,40,73,70,95,47,520      sched:sched_switch	<------
>     4.000480342              4,282      faults
>     4.000480342              2,303      sched:sched_switch
>     5.000916811              1,322      faults
>     5.000916811              1,064      sched:sched_switch
>  #
>
>prev_raw_counts is allocated when using intervals. This is used when
>calculating the difference in the counts of events when using interval.
>
>The current counts are stored in prev_raw_counts to calculate the
>differences in the next iteration.
>
>On the first interval of the second and subsequent repetitions,
>prev_raw_counts would be the values stored in the last interval of the
>previous repetitions, while the current counts will only be for the
>first interval of the current repetition.
>
>Hence there is a possibility of events showing up as big number.
>
>Fix this by resetting prev_raw_counts whenever perf stat repeats the
>command.
>
>With the fix:
>
>  # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5
>
>     2.019349347              2,597      faults
>     2.019349347              2,753      sched:sched_switch
>     4.019577372              3,098      faults
>     4.019577372              2,532      sched:sched_switch
>     5.019415481              1,879      faults
>     5.019415481              1,356      sched:sched_switch
>     2.000178813              8,468      faults
>     2.000178813              2,254      sched:sched_switch
>     4.000404621              7,440      faults
>     4.000404621              1,266      sched:sched_switch
>     5.040196079              2,458      faults
>     5.040196079                556      sched:sched_switch
>     2.000191939              6,870      faults
>     2.000191939              1,170      sched:sched_switch
>     4.000414103                541      faults
>     4.000414103                902      sched:sched_switch
>     5.000809863                450      faults
>     5.000809863                364      sched:sched_switch
>  #
>
>Committer notes:
>
>This was broken since the cset introducing the --interval feature, i.e.
>--repeat + --interval wasn't tested at that point, add the Fixes tag so
>that automatic scripts can pick this up.
>
>Fixes: 13370a9b5bb8 ("perf stat: Add interval printing")
>Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>Acked-by: Jiri Olsa <jolsa@kernel.org>
>Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
>Cc: Namhyung Kim <namhyung@kernel.org>
>Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
>Cc: Stephane Eranian <eranian@google.com>
>Cc: stable@vger.kernel.org # v3.9+
>Link: http://lore.kernel.org/lkml/20190904094738.9558-2-srikar@linux.vnet.ibm.com
>[ Fixed up conflicts with libperf, i.e. some perf_{evsel,evlist} lost the 'perf' prefix ]
>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Conflicts due to the perf_evsel -> evsel rename. Fixed up and queued for
all kernels.

-- 
Thanks,
Sasha

      reply	other threads:[~2019-10-09  0:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 17:21 FAILED: patch "[PATCH] perf stat: Reset previous counts on repeat with interval" failed to apply to 5.3-stable tree gregkh
2019-10-09  0:12 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191009001236.GO1396@sasha-vm \
    --to=sashal@kernel.org \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jolsa@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox