[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180620042847.GH650@jagdpanzerIV>
Date: Wed, 20 Jun 2018 13:28:47 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Petr Mladek <pmladek@...e.com>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
Steven Rostedt <rostedt@...dmis.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-serial <linux-serial@...r.kernel.org>,
SergeySenozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC][PATCH 0/6] Use printk_safe context for TTY and UART port
locks
On (06/20/18 12:38), Linus Torvalds wrote:
> On Wed, Jun 20, 2018 at 11:50 AM Sergey Senozhatsky
> <sergey.senozhatsky.work@...il.com> wrote:
> >
> > It's not UART on its own that immediately calls into printk(), that would
> > be trivial to fix, it's all those subsystems that serial console driver
> > can call into.
>
> We already have the whole PRINTK_SAFE_CONTEXT_MASK model that only
> adds it to a secondary buffer if you get recursion. Why isn't that
> triggering? That's the whole point of it.
This is exactly what I'm doing in my patch set.
PRINTK_SAFE_CONTEXT_MASK so far worked *one* way only: when we start
from printk.c
IOW:
printk -> printk_safe_mask -> vsprinf -> printk
But we also can have printk-related deadlocks the *other* way
around. For instance:
uart -> printk -> uart
printk_safe_mask is not triggering there because we don't use
printk_safe in uart / tty yet. And this is what I do in my
patch set - extend printk_safe usage.
The patch set does not add any _new_ locks or locking rules.
It just replaces the existing
spin_lock(a)
with
prinkt_safe_enter();
spin_lock(a)
and
spin_unlock(a)
with
spin_unlock(a)
printk_safe_exit();
and that's it.
So now we use printk_safe mechanism to avoid another bunch of
deadlock scenarious: which don't start from printk, but from
parts of the kernel which printk eventually calls.
-ss
Powered by blists - more mailing lists