[PATCH v7 5/5]: mtdoops: refactor as a kmsg_dumper

Simon Kagstrom simon.kagstrom at netinsight.net
Thu Jan 7 01:47:17 EST 2010


On Wed, 06 Jan 2010 14:33:16 +0000
David Woodhouse <dwmw2 at infradead.org> wrote:

> > +	/* Panics must be written immediately */
> > +	if (reason == kmsg_dump_panic) {
> > +		if (!cxt->mtd->panic_write)
> > +			printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
> > +		else
> > +			mtdoops_write(cxt, 1);
> > +		return;
> 
> Would there be any harm in scheduling the work_write function _anyway_,
> just in case it manages to run?
> 
> The bug report at http://bugzilla.kernel.org/show_bug.cgi?id=14102 seems
> to be suggesting that sometimes it _did_ manage to work, with a bit of
> luck and a following wind.

In my tests, I never got it to write out anything when using scheduled
work on panics. I did the tests on a uniprocessor though, maybe that
could be a reason.

But you are right, probably it doesn't hurt anyway. 

> Also, it looks like in the (in_interrupt() || panic_on_oops) case we end
> up calling kmsg_dump(KMSG_DUMP_OOPS) from oops_exit(), almost
> immediately followed by kmsg_dump(KMSG_DUMP_PANIC). Is that going to do
> the right thing?

Well, since I never got it to dump anything with the work queue, the
dump will be done when KMSG_DUMP_PANIC is called. The work queue never
gets to run, so I never saw double dumps with this approach.

Anyway, perhaps one could do a cancel_work() when running the panic
handler to avoid situations when both are written (since it apparently
is possible as above).

// Simon



More information about the linux-mtd mailing list