blob: 96074c9f875418495192ea82bf743d1ee8ef7e48 [file] [log] [blame]
From 0fec33788526dc20d63a10627849be601a46ef45 Mon Sep 17 00:00:00 2001
From: Sven Schnelle <>
Date: Wed, 18 Dec 2019 08:44:26 +0100
Subject: [PATCH] samples/trace_printk: Wait for IRQ work to finish
commit 01f36a554e3ef32f9fc4b81a4437cf08fd0e4742 upstream.
trace_printk schedules work via irq_work_queue(), but doesn't
wait until it was processed. The testcase does:
:;: "Load module again, which means the event1 should be recorded";:
modprobe trace-printk
grep "event1:" trace
so the grep which checks the trace file might run before the irq work
was processed. Fix this by adding a irq_work_sync().
Fixes: af2a0750f3749 ("selftests/ftrace: Improve kprobe on module testcase to load/unload module")
Signed-off-by: Sven Schnelle <>
Signed-off-by: Steven Rostedt (VMware) <>
Signed-off-by: Paul Gortmaker <>
diff --git a/samples/trace_printk/trace-printk.c b/samples/trace_printk/trace-printk.c
index 7affc3b50b61..cfc159580263 100644
--- a/samples/trace_printk/trace-printk.c
+++ b/samples/trace_printk/trace-printk.c
@@ -36,6 +36,7 @@ static int __init trace_printk_init(void)
/* Kick off printing in irq context */
+ irq_work_sync(&irqwork);
trace_printk("This is a %s that will use trace_bprintk()\n",
"static string");