Re: [PATCH 2/4] printk: disable optimistic spin during panic

From: John Ogness
Date: Thu Jan 27 2022 - 04:09:11 EST


On 2022-01-27, Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:
> Right. So I also thought about placing panic_in_progress() somewhere in
> console_trylock() and make it fail for anything that is not a panic
> CPU.

I think this is a good idea and console_trylock() is the correct place
for that.

> Back in the days we also had this idea of "detaching" non-panic CPUs from
> printk() by overwriting their printk function pointers.

We need to keep in mind that printk() is no longer the problem. The
records are stored locklessly. The problem is the
console_trylock()/console_unlock() within vprintk_emit(). IMHO adding a
panic check in console_trylock() should solve that race sufficiently.

John