Re: [RFC PATCH v1 19/25] printk: introduce emergency messages

From: Sergey Senozhatsky
Date: Mon Mar 11 2019 - 22:51:40 EST


On (03/11/19 13:04), John Ogness wrote:
> > Great catch!
>
> Yes, thanks!
>
> > I think that it is doable to guard the list using RCU.
>
> I think it would be enough to take the prb_cpulock when modifying the
> console linked list. That will keep printk_emergency() out until the
> list has been updated. (registering/unregistering consoles is not
> something that happens often.)

console_sem can be a bit more than just registering/unregistering.
Especially when it comes to VT, fbcon and ioctls.

$ git grep console_lock drivers/tty/ | wc -l
82

$ git grep console_lock drivers/video/fbdev/ | wc -l
80

-ss