mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Mitchell Blank Jr <mitch@sfgoth.com>
Cc: mpm@selenic.com, linux-kernel@vger.kernel.org, mc@cs.stanford.edu
Subject: Re: [PATCH 2/3] netpoll: netconsole
Date: Fri, 12 Sep 2003 12:40:27 -0700	[thread overview]
Message-ID: <20030912124027.76306077.akpm@osdl.org> (raw)
In-Reply-To: <20030912053335.GJ41254@gaz.sfgoth.com>

Mitchell Blank Jr <mitch@sfgoth.com> wrote:
>
> Mitchell Blank Jr wrote:
> > The netconsole problem is only if the net driver calls printk() with
> > its spinlock held (but when not called from netconsole).  Then printk()
> > won't know that it's unsafe to re-enter the network driver.
> 
> BTW, this isn't neccesarily a netconsole-only thing.  For instance, has
> anyone ever audited all of the serial and lp drivers to make sure that
> nothing they call can call printk() while holding a lock?  This sounds
> fairly serious - we could have any number of simple error cases that would
> cause a deadlock with the right "console=" setting.
> 
> It'd be interesting if we could do something like:
>   1. For every function that appears as a "struct console -> write()" call,
>      follow every possible code path and make a list of every lock that they
>      can try to acquire exclusively.
>   2. Then scan the entire code base see if we ever call can printk() while
>      holding that same lock.

If a driver calls printk() while in ->write(), printk will fail to acquire
the console_sem.  The printk output will be buffered in log_buf[].  When
->write() releases console_sem it will then display the buffered text.

So the deadlocks to which you refer can only happen when the console driver
calls printk while holding driver locks, in a code path where console_sem
is not held.


  parent reply	other threads:[~2003-09-12 19:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030910074256.GD4489@waste.org.suse.lists.linux.kernel>
2003-09-10  8:11 ` Andi Kleen
2003-09-10  8:24   ` Matt Mackall
2003-09-10  8:29     ` Andi Kleen
2003-09-10  9:01       ` Matt Mackall
2003-09-10 16:00         ` Mitchell Blank Jr
2003-09-12  5:33           ` Mitchell Blank Jr
2003-09-12  5:57             ` Matt Mackall
2003-09-12 19:40             ` Andrew Morton [this message]
2003-09-10  7:42 Matt Mackall

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=20030912124027.76306077.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mc@cs.stanford.edu \
    --cc=mitch@sfgoth.com \
    --cc=mpm@selenic.com \
    /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

all inboxes | Powered by JetHome®