From: Greg KH <gregkh@linuxfoundation.org>
To: peterz@infradead.org, acme@redhat.com,
alexander.shishkin@linux.intel.com, eranian@google.com,
jolsa@redhat.com, kan.liang@intel.com, lukasz.odzioba@intel.com,
mingo@kernel.org, tglx@linutronix.de,
torvalds@linux-foundation.org, vincent.weaver@maine.edu
Cc: stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] perf/x86: Fix full width counter, counter overflow" failed to apply to 4.4-stable tree
Date: Mon, 12 Dec 2016 14:46:58 -0800 [thread overview]
Message-ID: <20161212224658.GA14887@kroah.com> (raw)
In-Reply-To: <14815822425213@kroah.com>
Nevermind, I got it to work, sorry for the noise...
greg k-h
On Mon, Dec 12, 2016 at 02:37:22PM -0800, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 4.4-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 7f612a7f0bc13a2361a152862435b7941156b6af Mon Sep 17 00:00:00 2001
> From: "Peter Zijlstra (Intel)" <peterz@infradead.org>
> Date: Tue, 29 Nov 2016 20:33:28 +0000
> Subject: [PATCH] perf/x86: Fix full width counter, counter overflow
>
> Lukasz reported that perf stat counters overflow handling is broken on KNL/SLM.
>
> Both these parts have full_width_write set, and that does indeed have
> a problem. In order to deal with counter wrap, we must sample the
> counter at at least half the counter period (see also the sampling
> theorem) such that we can unambiguously reconstruct the count.
>
> However commit:
>
> 069e0c3c4058 ("perf/x86/intel: Support full width counting")
>
> sets the sampling interval to the full period, not half.
>
> Fixing that exposes another issue, in that we must not sign extend the
> delta value when we shift it right; the counter cannot have
> decremented after all.
>
> With both these issues fixed, counter overflow functions correctly
> again.
>
> Reported-by: Lukasz Odzioba <lukasz.odzioba@intel.com>
> Tested-by: Liang, Kan <kan.liang@intel.com>
> Tested-by: Odzioba, Lukasz <lukasz.odzioba@intel.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vince Weaver <vincent.weaver@maine.edu>
> Cc: stable@vger.kernel.org
> Fixes: 069e0c3c4058 ("perf/x86/intel: Support full width counting")
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 9d4bf3ab049e..6e395c996900 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -69,7 +69,7 @@ u64 x86_perf_event_update(struct perf_event *event)
> int shift = 64 - x86_pmu.cntval_bits;
> u64 prev_raw_count, new_raw_count;
> int idx = hwc->idx;
> - s64 delta;
> + u64 delta;
>
> if (idx == INTEL_PMC_IDX_FIXED_BTS)
> return 0;
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index a74a2dbc0180..cb8522290e6a 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -4034,7 +4034,7 @@ __init int intel_pmu_init(void)
>
> /* Support full width counters using alternative MSR range */
> if (x86_pmu.intel_cap.full_width_write) {
> - x86_pmu.max_period = x86_pmu.cntval_mask;
> + x86_pmu.max_period = x86_pmu.cntval_mask >> 1;
> x86_pmu.perfctr = MSR_IA32_PMC0;
> pr_cont("full-width counters, ");
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-12-12 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 22:37 FAILED: patch "[PATCH] perf/x86: Fix full width counter, counter overflow" failed to apply to 4.4-stable tree gregkh
2016-12-12 22:46 ` Greg KH [this message]
2016-12-13 7:49 ` Peter Zijlstra
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=20161212224658.GA14887@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@intel.com \
--cc=lukasz.odzioba@intel.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.weaver@maine.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.