Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

samples/trace_printk: Wait for IRQ work to finish

trace_printk schedules work via irq_work_queue(), but doesn't
wait until it was processed. The kprobe_module.tc 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().

Link: http://lore.kernel.org/linux-trace-devel/20191218074427.96184-3-svens@linux.ibm.com

Cc: stable@vger.kernel.org
Fixes: af2a0750f3749 ("selftests/ftrace: Improve kprobe on module testcase to load/unload module")
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Sven Schnelle and committed by
Steven Rostedt (VMware)
01f36a55 3a53acf1

+1
+1
samples/trace_printk/trace-printk.c
··· 36 36 37 37 /* Kick off printing in irq context */ 38 38 irq_work_queue(&irqwork); 39 + irq_work_sync(&irqwork); 39 40 40 41 trace_printk("This is a %s that will use trace_bprintk()\n", 41 42 "static string");