Re: [PATCH] printk: Add printk_flush() to force buffered text toconsole

From: Steven Rostedt
Date: Fri Jun 22 2012 - 19:56:27 EST


On Fri, 2012-06-22 at 16:49 -0700, Andrew Morton wrote:

> If a driver does
>
> printk("testing the frobnozzle ...");
> do_test();
> printk(" OK\n");
>
> and do_test() hangs up, we really really want the user to know that
> there was a frobnozzle testing problem. Please tell me this isn't
> broken.

OK, then I wont tell you :-) But this is exactly what happened to me.
There was a config that caused the function tracer self test to triple
fault the machine. The test does exactly what you just described:

printk("Testing trace %s: ", tracer->name);
ret = run_tests(tracer);
if (ret == 0)
printk("PASSED!\n");
else
printk("FAILED!\n");

But because of this new buffering, that didn't print. And unfortunately,
the previous printk was the start of the rcu torture test. Thus when
Fengguang saw that the last thing printed before his machine crashed was
the rcu torture tests starting, he obviously (but incorrectly) blamed it
on the rcu torture test.

Yes, I think this is broken by design. But I have an idea for a fix.
I'll work on it on Monday, and it wont require adding a pr_flush() like
I did in this patch set.

-- Steve



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/