]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.3/perf-session-do-not-fail-on-processing-out-of-order-event.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.18.3 / perf-session-do-not-fail-on-processing-out-of-order-event.patch
CommitLineData
5bdb2afd
GKH
1From f61ff6c06dc8f32c7036013ad802c899ec590607 Mon Sep 17 00:00:00 2001
2From: Jiri Olsa <jolsa@kernel.org>
3Date: Wed, 26 Nov 2014 16:39:31 +0100
4Subject: perf session: Do not fail on processing out of order event
5
6From: Jiri Olsa <jolsa@kernel.org>
7
8commit f61ff6c06dc8f32c7036013ad802c899ec590607 upstream.
9
10Linus reported perf report command being interrupted due to processing
11of 'out of order' event, with following error:
12
13 Timestamp below last timeslice flush
14 0x5733a8 [0x28]: failed to process type: 3
15
16I could reproduce the issue and in my case it was caused by one CPU
17(mmap) being behind during record and userspace mmap reader seeing the
18data after other CPUs data were already stored.
19
20This is expected under some circumstances because we need to limit the
21number of events that we queue for reordering when we receive a
22PERF_RECORD_FINISHED_ROUND or when we force flush due to memory
23pressure.
24
25Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
26Signed-off-by: Jiri Olsa <jolsa@kernel.org>
27Acked-by: Ingo Molnar <mingo@kernel.org>
28Cc: Andi Kleen <ak@linux.intel.com>
29Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
30Cc: David Ahern <dsahern@gmail.com>
31Cc: Frederic Weisbecker <fweisbec@gmail.com>
32Cc: Ingo Molnar <mingo@kernel.org>
33Cc: Linus Torvalds <torvalds@linux-foundation.org>
34Cc: Matt Fleming <matt.fleming@intel.com>
35Cc: Namhyung Kim <namhyung@kernel.org>
36Cc: Paul Mackerras <paulus@samba.org>
37Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
38Cc: Stephane Eranian <eranian@google.com>
39Link: http://lkml.kernel.org/r/1417016371-30249-1-git-send-email-jolsa@kernel.org
40Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
41Signed-off-by: Zhiqiang Zhang <zhangzhiqiang.zhang@huawei.com>
42Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43
44---
45 tools/perf/util/event.h | 1 +
46 tools/perf/util/session.c | 11 +++++------
47 2 files changed, 6 insertions(+), 6 deletions(-)
48
49--- a/tools/perf/util/event.h
50+++ b/tools/perf/util/event.h
51@@ -214,6 +214,7 @@ struct events_stats {
52 u32 nr_invalid_chains;
53 u32 nr_unknown_id;
54 u32 nr_unprocessable_samples;
55+ u32 nr_unordered_events;
56 };
57
58 struct attr_event {
59--- a/tools/perf/util/session.c
60+++ b/tools/perf/util/session.c
61@@ -521,15 +521,11 @@ int perf_session_queue_event(struct perf
62 return -ETIME;
63
64 if (timestamp < oe->last_flush) {
65- WARN_ONCE(1, "Timestamp below last timeslice flush\n");
66-
67- pr_oe_time(timestamp, "out of order event");
68+ pr_oe_time(timestamp, "out of order event\n");
69 pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
70 oe->last_flush_type);
71
72- /* We could get out of order messages after forced flush. */
73- if (oe->last_flush_type != OE_FLUSH__HALF)
74- return -EINVAL;
75+ s->stats.nr_unordered_events++;
76 }
77
78 new = ordered_events__new(oe, timestamp, event);
79@@ -1057,6 +1053,9 @@ static void perf_session__warn_about_err
80 "Do you have a KVM guest running and not using 'perf kvm'?\n",
81 session->stats.nr_unprocessable_samples);
82 }
83+
84+ if (session->stats.nr_unordered_events != 0)
85+ ui__warning("%u out of order events recorded.\n", session->stats.nr_unordered_events);
86 }
87
88 volatile int session_done;