Re: [PATCH] panic.c: export panic_on_oops

Ingo Molnar
2009-10-12T15:23:51Z

* Simon Kagstrom <simon.kagstrom@netinsight.net> wrote:

> With my patch it instead works like this:
>
> - mtdoops_console_write continuously writes messages to the buffer, but
> never calls mtdoops_console_sync() itself.
>
> - mtdoops_console_sync (i.e., the ->unblank() callback) will schedule
> work if oops_in_progress is set.
>
> - if we have a panic, it will call mtdoops_write directly (if
> mtd->panic_write is set, otherwise we are out of luck). This is also
> the code path on oopses in interrupt context.
>
> So the workqueue only gets used on unblank() from oopses. I think the
> second implementation is simpler, but it also changes the behavior of
> mtdoops a bit to include messages before the oops/panic as well.

The main printk principle is simplicity:

- The simpler the printk codepath, the higher the chances that we still
are within the window of opportunity to get anything out to the user.

- Furthermore, the simpler the printk codepath, the larger the window of
opportunity is to begin with: we rely on less external state, so we
have a smaller surface of interaction that might break printk.

In that sense, i think your modified workqueue use is less wrong than
what is in current mainline, but i'm afraid it's still wrong.

Why use a workqueue on unblank()? Why use a workqueue _at all_? (If we
piggyback to any kernel thread we could as well piggyback to syslog
itself - and we all know how often syslog fails at capturing oopses.)

The mtdoops console driver only seems to act if there's an emergency -
and in emergencies we really _never_ want to do complex things like
using a workqueue thread.

( Sidenote: i proffer that we dont want to use a workqueue in the
'regular' printk case either - but that seems to be irrelevant here as
mtdoops does not seem to save / care about regular non-emergency
printks. )

Ingo