Re: printk meeting at LPC

From: John Ogness
Date: Wed Sep 18 2019 - 03:42:55 EST


On 2019-09-18, Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx> wrote:
>> For instance, tty/sysrq must be able to switch printk emergency
>> on/off.
>
> How did we come up to that _sync() printk() emergency mode (when we
> make sure that there is no active printing kthread)? We had a number
> of cases (complaints) of lost kernel messages. There are scenarios in
> which we cannot offload to async preemptible printing kthread, because
> current control path is, for instance, going to reboot the kernel. In
> sync printk() mode we have some sort (!) of guarantees that when we do
>
> pr_emerg("Restarting system\n");
> kmsg_dump(KMSG_DUMP_RESTART);
> machine_restart(cmd);
>
> pr_emerg("Restarting system\n") is going to flush logbuf before the
> system will machine_restart().

Yes, this was why I asked Daniel how the bsod stuff will be
implemented. We don't want a bsod just because we are
restarting. Perhaps write_atomic() should also have a "reason" argument
like kmsg_dump does. I will keep in touch with Daniel to make sure we
are sync on this.

> It's going to be a bit harder when we have per-console kthread.

Each console has its own iterator. This iterators will need to advance,
regardless if the message was printed via write() or write_atomic().

John Ogness