mtdoops and non pre-emptible kernel

Richard Purdie rpurdie at openedhand.com
Thu Aug 27 11:44:14 EDT 2009


On Thu, 2009-08-27 at 11:30 +0100, Matthew Lear wrote:
> That's fair enough. I suppose a possible solution would be to do what I've
> done locally for testing, ie:
> 
> diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
> index 1a6b3be..2d734e2 100644
> --- a/drivers/mtd/mtdoops.c
> +++ b/drivers/mtd/mtdoops.c
> @@ -335,7 +335,7 @@ static void mtdoops_console_sync(void)
>                 /* Interrupt context, we're going to panic so try and log */
>                 mtdoops_write(cxt, 1);
>         else
> -               schedule_work(&cxt->work_write);
> +               mtdoops_write(cxt, 0);
>  }

I just refreshed my memory a bit. I'd guess your mtd driver doesn't have
a panic_write function which is highly desirable for this kind of use.

How about some code like this?:

	if (mtd->panic_write && in_interrupt())
		/* Interrupt context, we're going to panic so try and log */
		mtdoops_write(cxt, 1);
	else if (in_interrupt())
		/* Interrupt context but with no panic write function */
                /* We're going to crash anyway so we may as well try and log */
		mtdoops_write(cxt, 0);
	else
		schedule_work(&cxt->work_write);

Cheers,

Richard




More information about the linux-mtd mailing list