linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Pavel Machek <pavel@ucw.cz>
Cc: Jan Kara <jack@suse.cz>, Frederic Weisbecker <fweisbec@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.cz>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 3/4] printk: Defer printing to irq work when we printed too much
Date: Mon, 11 Nov 2013 23:17:55 +0100	[thread overview]
Message-ID: <20131111221755.GA31266@quack.suse.cz> (raw)
In-Reply-To: <20131111215415.GA23331@amd.pavel.ucw.cz>

On Mon 11-11-13 22:54:15, Pavel Machek wrote:
> Hi!
> 
> > > > A CPU can be caught in console_unlock() for a long time (tens of seconds
> > > > are reported by our customers) when other CPUs are using printk heavily
> > > > and serial console makes printing slow. Despite serial console drivers
> > > > are calling touch_nmi_watchdog() this triggers softlockup warnings
> > > > because interrupts are disabled for the whole time console_unlock() runs
> > > > (e.g. vprintk() calls console_unlock() with interrupts disabled). Thus
> > > > IPIs cannot be processed and other CPUs get stuck spinning in calls like
> > > > smp_call_function_many(). Also RCU eventually starts reporting lockups.
> > > >
> > > > In my artifical testing I can also easily trigger a situation when disk
> > > > disappears from the system apparently because interrupt from it wasn't
> > > > served for too long. This is why just silencing watchdogs isn't a
> > > > reliable solution to the problem and we simply have to avoid spending
> > > > too long in console_unlock() with interrupts disabled.
> > > >
> > > > The solution this patch works toward is to postpone printing to a later
> > > > moment / different CPU when we already printed over X characters in
> > > > current console_unlock() invocation. This is a crude heuristic but
> > > > measuring time we spent printing doesn't seem to be really viable - we
> > > > cannot rely on high resolution time being available and with interrupts
> > > > disabled jiffies are not updated. User can tune the value X via
> > > > printk.offload_chars kernel parameter.
> > > >
> > > > Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
> > > > Signed-off-by: Jan Kara <jack@suse.cz>
> > > 
> > > When a message takes tens of seconds to be printed, it usually means
> > > we are in trouble somehow :)
> > > I wonder what printk source can trigger such a high volume.
> >   Machines with tens of processors and thousands of scsi devices. When
> > device discovery happens on boot, all processors are busily reporting new
> > scsi devices and one poor looser is bound to do the printing for ever and
> > ever until the machine dies...
> 
> Dunno. In these cases, would it make sense to:
> 
> 1) reduce amount of text printed
  I thought about this as well. But
a) It doesn't seem practical as you would have to modify lots of drivers
   and keep them rather silent. That seems rather fragile. Plus you will
   not display some potentially useful information.
b) It doesn't address the real underlying problem that the way printk() is
   currently implemented, there is no bound on the time CPU spends in the
   loop printing from buffer to console. And the fact that this loop
   sometimes happens with interrupts disabled makes the situation even
   worse.
 
> 2) just print [XXX characters lost] on overruns?
  We don't overrun the printk buffer so no characters are lost. It just
takes too long to feed the whole printk buffer through serial console...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2013-11-11 22:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 21:48 [PATCH 0/4 v6] Avoid softlockups in console_unlock() Jan Kara
2013-11-07 21:48 ` [PATCH 1/4] printk: Remove separate printk_sched buffers and use printk buf instead Jan Kara
2013-11-07 21:48 ` [PATCH 2/4] irq_work: Provide a irq work that can be processed on any cpu Jan Kara
2013-11-07 22:13   ` Frederic Weisbecker
2013-11-07 22:19     ` Jan Kara
2013-11-07 22:23       ` Frederic Weisbecker
2013-11-07 22:50         ` Jan Kara
2013-11-07 22:54           ` Frederic Weisbecker
2013-11-07 23:01             ` Jan Kara
2013-11-07 23:31               ` Steven Rostedt
2013-11-08 10:18                 ` Jan Kara
2013-11-07 22:32       ` Frederic Weisbecker
2013-11-07 21:48 ` [PATCH 3/4] printk: Defer printing to irq work when we printed too much Jan Kara
2013-11-07 22:43   ` Frederic Weisbecker
2013-11-07 22:57     ` Jan Kara
2013-11-07 23:21       ` Frederic Weisbecker
2013-11-07 23:37         ` Steven Rostedt
2013-11-07 23:44           ` Frederic Weisbecker
2013-11-07 23:46           ` Frederic Weisbecker
2013-11-08 10:21             ` Jan Kara
2013-11-22 23:27               ` Andrew Morton
2013-11-25 12:08                 ` Jan Kara
2013-11-11 21:54       ` Pavel Machek
2013-11-11 22:17         ` Jan Kara [this message]
2013-11-16 11:35           ` Pavel Machek
2013-11-07 22:59     ` Steven Rostedt
2013-11-07 21:48 ` [PATCH 4/4] printk: Use unbound irq work for printing and waking Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2013-08-21  8:08 [PATCH 0/4 v6] Avoid softlockups in console_unlock() Jan Kara
2013-08-21  8:08 ` [PATCH 3/4] printk: Defer printing to irq work when we printed too much Jan Kara
2013-08-21 19:06   ` Steven Rostedt
2013-08-14 13:28 [PATCH 0/4 v5] Avoid softlockups in console_unlock() Jan Kara
2013-08-14 13:28 ` [PATCH 3/4] printk: Defer printing to irq work when we printed too much Jan Kara
2013-08-15  1:38   ` Steven Rostedt
2013-08-15  7:52     ` Jan Kara
2013-08-15 13:26       ` Steven Rostedt

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=20131111221755.GA31266@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=pavel@ucw.cz \
    --cc=rostedt@goodmis.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).