diff mbox

[for-4.9] tracing: Use SOFTIRQ_OFFSET for softirq dectection for more accurate results

Message ID 1499797497-9552-1-git-send-email-amit.pundir@linaro.org
State New
Headers show

Commit Message

Amit Pundir July 11, 2017, 6:24 p.m. UTC
From: Pavankumar Kondeti <pkondeti@codeaurora.org>


commit c59f29cb144a6a0dfac16ede9dc8eafc02dc56ca upstream.

The 's' flag is supposed to indicate that a softirq is running. This
can be detected by testing the preempt_count with SOFTIRQ_OFFSET.

The current code tests the preempt_count with SOFTIRQ_MASK, which
would be true even when softirqs are disabled but not serving a
softirq.

Link: http://lkml.kernel.org/r/1481300417-3564-1-git-send-email-pkondeti@codeaurora.org

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

---
This upstream patch fixed a CPU soft lockup and rcu stall bug
reported on linux-4.9.y while running ftracetest on Hikey, with
usb-ethernet plugged-in but not connected to any network. Bug
can be reproduced and fixed on linux-4.4.y as well. Most likely
applicable for linux-3.18.y too but I couldn't boot up hikey
with 3.18 kernel.
Here is the bug report: https://bugs.linaro.org/show_bug.cgi?id=3034

 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4
diff mbox

Patch

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 6011148b0239..49d086753a0b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1927,7 +1927,7 @@  tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
 #endif
 		((pc & NMI_MASK    ) ? TRACE_FLAG_NMI     : 0) |
 		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
-		((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
+		((pc & SOFTIRQ_OFFSET) ? TRACE_FLAG_SOFTIRQ : 0) |
 		(tif_need_resched() ? TRACE_FLAG_NEED_RESCHED : 0) |
 		(test_preempt_need_resched() ? TRACE_FLAG_PREEMPT_RESCHED : 0);
 }