[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.17 / 0099-tracing-Fix-stacktrace-of-latency-tracers-irqsoff-an.patch
1 From e2b214ae8c691f0fd7aeb572dda62401b9221ee4 Mon Sep 17 00:00:00 2001
2 From: Steven Rostedt <srostedt@redhat.com>
3 Date: Thu, 19 Apr 2012 10:31:47 -0400
4 Subject: [PATCH 099/165] tracing: Fix stacktrace of latency tracers (irqsoff
5 and friends)
7 commit db4c75cbebd7e5910cd3bcb6790272fcc3042857 upstream.
9 While debugging a latency with someone on IRC (mirage335) on #linux-rt (OFTC),
10 we discovered that the stacktrace output of the latency tracers
11 (preemptirqsoff) was empty.
13 This bug was caused by the creation of the dynamic length stack trace
14 again (like commit 12b5da3 "tracing: Fix ent_size in trace output" was).
16 This bug is caused by the latency tracers requiring the next event
17 to determine the time between the current event and the next. But by
18 grabbing the next event, the iter->ent_size is set to the next event
19 instead of the current one. As the stacktrace event is the last event,
20 this makes the ent_size zero and causes nothing to be printed for
21 the stack trace. The dynamic stacktrace uses the ent_size to determine
22 how much of the stack can be printed. The ent_size of zero means
23 no stack.
25 The simple fix is to save the iter->ent_size before finding the next event.
27 Note, mirage335 asked to remain anonymous from LKML and git, so I will
28 not add the Reported-by and Tested-by tags, even though he did report
29 the issue and tested the fix.
31 Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
32 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
33 ---
34 kernel/trace/trace_output.c | 5 +++++
35 1 files changed, 5 insertions(+), 0 deletions(-)
37 diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
38 index 5199930..1dcf253 100644
39 --- a/kernel/trace/trace_output.c
40 +++ b/kernel/trace/trace_output.c
41 @@ -638,6 +638,8 @@ int trace_print_lat_context(struct trace_iterator *iter)
42 {
43 u64 next_ts;
44 int ret;
45 + /* trace_find_next_entry will reset ent_size */
46 + int ent_size = iter->ent_size;
47 struct trace_seq *s = &iter->seq;
48 struct trace_entry *entry = iter->ent,
49 *next_entry = trace_find_next_entry(iter, NULL,
50 @@ -646,6 +648,9 @@ int trace_print_lat_context(struct trace_iterator *iter)
51 unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start);
52 unsigned long rel_usecs;
54 + /* Restore the original ent_size */
55 + iter->ent_size = ent_size;
56 +
57 if (!next_entry)
58 next_ts = iter->ts;
59 rel_usecs = ns2usecs(next_ts - iter->ts);
60 --
61 1.7.7.6