summaryrefslogtreecommitdiff
path: root/arch/x86/events/msr.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-05-10 15:16:54 +0300
committerIngo Molnar <mingo@kernel.org>2016-05-12 11:14:30 +0300
commit3c3116b745c08dc76ccbed7223c4edddcfd9a186 (patch)
treef45c7a531d0ec4a2436787816479f176f6341ca7 /arch/x86/events/msr.c
parentec336c879c3b422d2876085be1cbb110e44dc0de (diff)
downloadlinux-3c3116b745c08dc76ccbed7223c4edddcfd9a186.tar.xz
perf/x86/msr: Fix SMI overflow
We compute 'delta' and properly sign extend it and then ignore it and recompute the raw value, loosing the sign extention. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andy Lutomirski <luto@amacapital.net> 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: kan.liang@intel.com Cc: linux-kernel@vger.kernel.org Cc: luto@kernel.org Cc: ray.huang@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/events/msr.c')
-rw-r--r--arch/x86/events/msr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c
index ec863b9a9f78..8bef19f098d4 100644
--- a/arch/x86/events/msr.c
+++ b/arch/x86/events/msr.c
@@ -166,7 +166,7 @@ again:
if (unlikely(event->hw.event_base == MSR_SMI_COUNT))
delta = sign_extend64(delta, 31);
- local64_add(now - prev, &event->count);
+ local64_add(delta, &event->count);
}
static void msr_event_start(struct perf_event *event, int flags)