From: Ingo Molnar <mingo@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"kay.sievers" <kay.sievers@vrfy.org>,
Fengguang Wu <fengguang.wu@intel.com>,
Ingo Molnar <mingo@elte.hu>,
AndrewMorton <akpm@linux-foundation.org>
Subject: Re: [PATCH] printk: Add printk_flush() to force buffered text to console
Date: Fri, 22 Jun 2012 09:17:18 +0200 [thread overview]
Message-ID: <20120622071718.GC22167@gmail.com> (raw)
In-Reply-To: <1340322723.27036.220.camel@gandalf.stny.rr.com>
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Fengguang Wu had a config that caused the system to lockup. It reported:
>
> [ 6.086395] type=2000 audit(1339501575.085:1): initialized
> [ 6.116356] Kprobe smoke test started
> [ 6.125915] Kprobe smoke test passed successfully
> [ 6.127478] rcu-torture:--- Start of test: nreaders=2 nfakewriters=4 stat_interval=0 verbose=0 test_no_idle_hz=0 shuffle_interval=3 stutter=5 irqreader=1 fqs_duration=0
> +fqs_holdoff=0 fqs_stutter=3 test_boost=1/0 test_boost_interval=7 test_boost_duration=4 shutdown_secs=0 onoff_interval=0 onoff_holdoff=0
>
> and then froze. So naturally, the suspected bug was with rcu-torture.
> Fengguang did a git bisect and discovered that the crash came with a
> function trace update. He also noticed that if he reverted that update,
> the system got farther and showed:
>
> [ 1.611901] Testing tracer function: PASSED
>
> His time was wasted by the fact that the function tracing self test
> first prints:
>
> "Testing tracer function: "
>
> then runs the test, and if it succeeds, it prints "PASSED", giving us
> the nice output you see above.
>
> But with the new printk() changes, text without a newline gets buffered
> and does not print out to the console at the location of the printk.
> This caused the "Testing tracer function: " not to print out and because
> the test caused the kernel to lock up, we are clueless to the fact that
> the problem was with the function tracer test and not the rcu_torture
> test. As it made sense that the rcu_torture test could lock up the
> system, many kernel developer hours were wasted chasing the wrong wild
> goose.
>
> If the "Testing tracer function: " had printed out in the first place,
> we would have caught the correct wild goose and saved precious kernel
> developer's time.
>
> Thus a need for the following utility. That is to add a 'printk_flush()'
> that acts like a fflush() in userspace to flush out the buffers used by
> the printing facility so we don't have unexpected hunts for nature
> roaming fowl.
>
> I hooked onto the 'facility' infrastructure and used '0x1ffc' (the max
> number) as a way to communicate printk() commands to the msg_print_text()
> which is performed at a later time (console_unlock()).
>
> I tested this out, (adding pr_flush() after my printk) and now the
> lockup shows:
>
> [ 9.018231] Kprobe smoke test passed successfully
> [ 9.023084] rcu-torture:--- Start of test: nreaders=4 nfakewriters=4 stat_interval=0 verbose=0 test_no_idle_hz=0 shuffle_interval=3 stutter=5 irqreader=1 fqs_duration=0 fqs_hold
> off=0 fqs_stutter=3 test_boost=1/0 test_boost_interval=7 test_boost_duration=4 shutdown_secs=0 onoff_interval=0 onoff_holdoff=0
> [ 9.066065] Testing tracer function:
>
> To prevent the flush to cause the next printk to have a timestamp that
> would produce the following:
>
> [ 6.834073] Testing tracer function: [ 7.136194] PASSED
>
> I made the KERN_CONT ("<c>") use the facility as well to pass info to
> not print the timestamp. This fixes the abve issue to print:
>
> [ 1.291025] Testing tracer function: PASSED
>
> Link: http://lkml.kernel.org/r/1339649173.13377.191.camel@gandalf.stny.rr.com
>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "kay.sievers" <kay.sievers@vrfy.org>
> Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
> Cc: Fengguang Wu <fengguang.wu@intel.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> include/linux/printk.h | 8 ++++
> kernel/printk.c | 104 ++++++++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 101 insertions(+), 11 deletions(-)
Maybe also add the actual usage sites, to demonstrate how it's
going to be used?
Thanks,
Ingo
next prev parent reply other threads:[~2012-06-22 7:17 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 23:52 [PATCH] printk: Add printk_flush() to force buffered text to console Steven Rostedt
2012-06-22 7:17 ` Ingo Molnar [this message]
2012-06-22 10:45 ` Steven Rostedt
2012-06-22 8:24 ` Joe Perches
2012-06-22 10:48 ` Steven Rostedt
2012-06-22 21:54 ` Andrew Morton
2012-06-22 23:41 ` Steven Rostedt
2012-06-22 23:49 ` Andrew Morton
2012-06-22 23:56 ` Steven Rostedt
2012-06-23 6:13 ` Ingo Molnar
2012-06-23 7:44 ` Joe Perches
2012-06-25 8:45 ` Ingo Molnar
2012-06-25 16:53 ` Joe Perches
2012-06-23 11:47 ` Kay Sievers
2012-06-23 12:04 ` Fengguang Wu
2012-06-23 15:28 ` Joe Perches
2012-06-23 16:56 ` Kay Sievers
2012-06-25 9:09 ` [PATCH] printk: Revert the buffered-printk() changes for now Ingo Molnar
2012-06-25 10:06 ` Kay Sievers
2012-06-25 13:42 ` Steven Rostedt
2012-06-25 14:07 ` Ingo Molnar
2012-06-25 14:48 ` Steven Rostedt
2012-06-25 16:40 ` Greg Kroah-Hartman
2012-06-27 5:52 ` Ingo Molnar
2012-06-27 5:59 ` Joe Perches
2012-07-06 11:04 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2012-06-14 4:46 [PATCH] printk: Add printk_flush() to force buffered text to console Steven Rostedt
2012-06-14 4:59 ` Greg Kroah-Hartman
2012-06-14 11:01 ` Steven Rostedt
2012-06-14 15:41 ` Greg Kroah-Hartman
2012-06-14 17:07 ` Steven Rostedt
2012-06-15 4:22 ` Fengguang Wu
2012-06-15 4:30 ` Greg Kroah-Hartman
2012-06-15 4:37 ` Fengguang Wu
2012-06-15 12:04 ` Ingo Molnar
2012-06-15 23:13 ` Greg Kroah-Hartman
2012-06-15 23:53 ` Steven Rostedt
2012-06-18 23:03 ` Greg Kroah-Hartman
2012-06-19 1:28 ` Steven Rostedt
2012-06-20 12:25 ` Ingo Molnar
2012-06-21 17:13 ` Greg Kroah-Hartman
2012-06-21 17:41 ` Steven Rostedt
2012-06-21 18:17 ` Joe Perches
2012-06-21 18:22 ` Joe Perches
2012-06-21 18:29 ` Steven Rostedt
2012-06-21 18:39 ` Joe Perches
2012-06-21 18:49 ` Steven Rostedt
2012-06-21 18:55 ` Joe Perches
2012-06-21 19:38 ` Steven Rostedt
2012-06-16 6:59 ` Ingo Molnar
2012-06-16 12:51 ` Joe Perches
2012-06-16 15:38 ` Greg Kroah-Hartman
2012-06-16 15:40 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120622071718.GC22167@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).