All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@openedhand.com>
To: matt@bubblegen.co.uk
Cc: linux-mtd@lists.infradead.org
Subject: Re: mtdoops and non pre-emptible kernel
Date: Thu, 27 Aug 2009 11:06:14 +0100	[thread overview]
Message-ID: <1251367574.9940.2.camel@dax.rpnet.com> (raw)
In-Reply-To: <9f22e03e9efbb90b242869d7652caa97.squirrel@webmail.plus.net>

On Thu, 2009-08-27 at 09:59 +0100, Matthew Lear wrote: 
> In any case, yes I saw the two paths the code can go, ie if the mtd
> device's panic_write() is available and we're in interrupt context then
> use the panic_write function to write to flash, else use the work queue.
> The path that my scenario takes is always the latter but the write in
> context of the work queue never happens.
> 
> If this is because of the small window in which to perform the write and
> there are other factors coming into play involving scheduling then
> obviously that's not a direct issue for the mtdoops code.
> 
> However, the call to mtdoops_console_sync() (which causes the flash write
> to be initiated from console_unblank() for the ttyMTD console device) is
> eventually followed by the panic routine spinning in a tight loop with an
> mdelay(1). There doesn't appear to be anywhere in this path where
> schedule() is invoked. Because of running a non pre-emptible kernel, there
> is no way, certainly that I can see, that a context can switch can happen
> to allow the jobs in the work queue to be run without at least calling
> schedule() after calling schedule_work() from within
> mtdoops_console_sync().
> 
> Maybe I've missed something :-) but calling schedule() after
> schedule_work() certainly seems to be the correct approach to at least
> allow the code to do what it's trying to do, especially on non
> pre-emptible kernels.

That isn't the right solution since calling schedule() is not something
allowed at that point in the code, particularly in the middle of a
kernel panic. We really need to detect that we're about to head into the
panic spining loop and then call the write function directly. How we do
that I'm not so sure without going into the code in more detail. I
suspect something has subtly changed in the kernel meaning that
particular circumstances no longer works :/

Cheers,

Richard

  reply	other threads:[~2009-08-27 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 17:41 mtdoops and non pre-emptible kernel Matthew Lear
2009-08-26 21:53 ` Richard Purdie
2009-08-27  8:59   ` Matthew Lear
2009-08-27 10:06     ` Richard Purdie [this message]
2009-08-27 10:30       ` Matthew Lear
2009-08-27 15:44         ` Richard Purdie
2009-08-27 16:20           ` Matthew Lear
2009-09-01  9:55             ` Matthew Lear

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=1251367574.9940.2.camel@dax.rpnet.com \
    --to=rpurdie@openedhand.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matt@bubblegen.co.uk \
    /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.