From: Andrew Morton <akpm@linux-foundation.org>
To: Jan Kara <jack@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>,
jslaby@suse.cz, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2] printk: Avoid softlockups in console_unlock()
Date: Tue, 5 Feb 2013 12:38:38 -0800 [thread overview]
Message-ID: <20130205123838.146a5371.akpm@linux-foundation.org> (raw)
In-Reply-To: <1360016230-26696-1-git-send-email-jack@suse.cz>
On Mon, 4 Feb 2013 23:17:10 +0100
Jan Kara <jack@suse.cz> wrote:
> 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 also managed to trigger a situation when disk
> disappeared from the system apparently because commands to / from it
> could not be delivered for long enough. 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().
>
> We fix the issue by limiting the time we spend in console_unlock() to
> watchdog_thresh() / 4 (unless we are in an early boot stage or oops is
> happening). The rest of the buffer will be printed either by further
> callers to printk() or by a queued work.
I still hate the patch :(
> ...
>
> +void console_unlock(void)
> +{
> + if (__console_unlock()) {
> + /* Let worker do the rest of printing */
> + schedule_work(&printk_work);
> + }
> }
This creates another place from where we cannot call printk(): anywhere
where worker_pool.lock is held.
And as schedule_work() can do a wakeup it creates a third reason why
the sched code cannot call printk (along with rq->lock taken by
wake_up(klogd) and rq->lock taken by up(&console_sem). Hence
printk_sched(). See the lkml thread "[GIT PULL] printk: Support for
full dynticks mode".
We already have machinery for doing async tickling in printk: the
printk_pending stuff. Did you consider adding another
PRINTK_PENDING_foo in some fashion?
next prev parent reply other threads:[~2013-02-05 20:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 22:17 [PATCH v2] printk: Avoid softlockups in console_unlock() Jan Kara
2013-02-05 20:38 ` Andrew Morton [this message]
2013-02-05 22:56 ` Frederic Weisbecker
2013-02-06 0:42 ` Steven Rostedt
2013-02-06 14:23 ` Jan Kara
2013-02-06 17:58 ` David Rientjes
2013-02-06 18:52 ` Jan Kara
2013-02-06 19:26 ` David Rientjes
2013-02-06 19:51 ` Jan Kara
2013-02-06 20:19 ` Hugh Dickins
2013-02-06 21:29 ` Jan Kara
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=20130205123838.146a5371.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.