Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Sergey Senozhatsky
On (10/25/18 11:06), Petr Mladek wrote: > > IMHO, the custom s390 implementation can get removed. > The generic code should do the same job these days. > Yep. > > And console_unblank() is not guaranteed to print anything (unlike > > console_flush_on_panic(), but oops is not panic() yet, so we

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Sergey Senozhatsky
On (10/25/18 11:06), Petr Mladek wrote: > > IMHO, the custom s390 implementation can get removed. > The generic code should do the same job these days. > Yep. > > And console_unblank() is not guaranteed to print anything (unlike > > console_flush_on_panic(), but oops is not panic() yet, so we

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 21:12:30, Sergey Senozhatsky wrote: > On (10/23/18 21:04), Sergey Senozhatsky wrote: > > > > Seems that s390 is the only arch which defines its own bust_spinlocks(). > > Not sure why... Just to play games with console_loglevel? > > > > --- > > > > void bust_spinlocks(int yes)

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 21:12:30, Sergey Senozhatsky wrote: > On (10/23/18 21:04), Sergey Senozhatsky wrote: > > > > Seems that s390 is the only arch which defines its own bust_spinlocks(). > > Not sure why... Just to play games with console_loglevel? > > > > --- > > > > void bust_spinlocks(int yes)

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Sergey Senozhatsky
On (10/25/18 10:29), Petr Mladek wrote: > > Yes, klogd is not a big deal. I just think that the bust_spinlocks() > ping-pong would just confuse the code. I agree; that's why I put some comments there. > It might be better to keep the spinlocks busted and make sure that we do > not cause

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Sergey Senozhatsky
On (10/25/18 10:29), Petr Mladek wrote: > > Yes, klogd is not a big deal. I just think that the bust_spinlocks() > ping-pong would just confuse the code. I agree; that's why I put some comments there. > It might be better to keep the spinlocks busted and make sure that we do > not cause

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 20:54:33, Sergey Senozhatsky wrote: > On (10/23/18 13:07), Petr Mladek wrote: > > Though this looks a bit weird. > > > > I have just realized that console_unblank() is called by > > bust_spinlocks(0) and does basically the same as > > console_flush_on_panic(). Also it does not

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-25 Thread Petr Mladek
On Tue 2018-10-23 20:54:33, Sergey Senozhatsky wrote: > On (10/23/18 13:07), Petr Mladek wrote: > > Though this looks a bit weird. > > > > I have just realized that console_unblank() is called by > > bust_spinlocks(0) and does basically the same as > > console_flush_on_panic(). Also it does not

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 21:04), Sergey Senozhatsky wrote: > > Seems that s390 is the only arch which defines its own bust_spinlocks(). > Not sure why... Just to play games with console_loglevel? > > --- > > void bust_spinlocks(int yes) > { > if (yes) { > oops_in_progress = 1; > }

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 21:04), Sergey Senozhatsky wrote: > > Seems that s390 is the only arch which defines its own bust_spinlocks(). > Not sure why... Just to play games with console_loglevel? > > --- > > void bust_spinlocks(int yes) > { > if (yes) { > oops_in_progress = 1; > }

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 20:54), Sergey Senozhatsky wrote: > So I did look at what lib/bust_spinlocks.c does; and I agree that waking > up klogd makes little sense, on the other hand it just sets per-cpu > pending bit, so not a big deal. console_unlock() should do there the > same thing as

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 20:54), Sergey Senozhatsky wrote: > So I did look at what lib/bust_spinlocks.c does; and I agree that waking > up klogd makes little sense, on the other hand it just sets per-cpu > pending bit, so not a big deal. console_unlock() should do there the > same thing as

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 13:07), Petr Mladek wrote: > Though this looks a bit weird. > > I have just realized that console_unblank() is called by > bust_spinlocks(0) and does basically the same as > console_flush_on_panic(). Also it does not make much > sense wake_up_klogd() there. Finally, it seems to be >

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Sergey Senozhatsky
On (10/23/18 13:07), Petr Mladek wrote: > Though this looks a bit weird. > > I have just realized that console_unblank() is called by > bust_spinlocks(0) and does basically the same as > console_flush_on_panic(). Also it does not make much > sense wake_up_klogd() there. Finally, it seems to be >

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Petr Mladek
On Tue 2018-10-16 14:04:25, Sergey Senozhatsky wrote: > >From printk()/serial console point of view panic() is special, because > it may force CPU to re-enter printk() or/and serial console driver. > Therefore, some of serial consoles drivers are re-entrant. E.g. 8250: > >

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-23 Thread Petr Mladek
On Tue 2018-10-16 14:04:25, Sergey Senozhatsky wrote: > >From printk()/serial console point of view panic() is special, because > it may force CPU to re-enter printk() or/and serial console driver. > Therefore, some of serial consoles drivers are re-entrant. E.g. 8250: > >

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-16 Thread Sergey Senozhatsky
On (10/16/18 14:04), Sergey Senozhatsky wrote: > > Fix this by setting oops_in_progress before console_flush_on_panic(), > so re-entrant console drivers will trylock the port->lock instead of > spinning on it forever. > Just a small note: Regardless of what's going to happen to the series,

Re: [RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-16 Thread Sergey Senozhatsky
On (10/16/18 14:04), Sergey Senozhatsky wrote: > > Fix this by setting oops_in_progress before console_flush_on_panic(), > so re-entrant console drivers will trylock the port->lock instead of > spinning on it forever. > Just a small note: Regardless of what's going to happen to the series,

[RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-15 Thread Sergey Senozhatsky
>From printk()/serial console point of view panic() is special, because it may force CPU to re-enter printk() or/and serial console driver. Therefore, some of serial consoles drivers are re-entrant. E.g. 8250: serial8250_console_write() { if (port->sysrq) locked = 0;

[RFC][PATCHv2 1/4] panic: avoid deadlocks in re-entrant console drivers

2018-10-15 Thread Sergey Senozhatsky
>From printk()/serial console point of view panic() is special, because it may force CPU to re-enter printk() or/and serial console driver. Therefore, some of serial consoles drivers are re-entrant. E.g. 8250: serial8250_console_write() { if (port->sysrq) locked = 0;