All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Kurt Kanzenbach <kurt@linutronix.de>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Raul Rangel <rrangel@google.com>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"S, Shirish" <Shirish.S@amd.com>,
	Peter Zijlstra <peterz@infradead.org>,
	John Ogness <john.ogness@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: UART/TTY console deadlock
Date: Wed, 8 Jul 2020 11:52:15 +0200	[thread overview]
Message-ID: <20200708095215.GB4751@alley> (raw)
In-Reply-To: <20200708080712.GC571@jagdpanzerIV.localdomain>

On Wed 2020-07-08 17:07:12, Sergey Senozhatsky wrote:
> On (20/07/08 09:40), Kurt Kanzenbach wrote:
> > I'm not sure how this patch will help with the situation. Because at the
> > point of that THRE test the irq handler isn't registered. It's
> > registered a few lines below (up->ops->setup_irq()) meaning the irq line
> > has to be disabled if shared. Otherwise the kernel might detect a
> > spurious irq and disables it. That's at least my understanding of the
> > problem (see commit message from 54e53b2e8081 ("tty: serial: 8250: pass
> > IRQ shared flag to UART ports")).
> 
> So the only remaining approach then is to move
> disable_irq_nosync()/enable_irq() out of port->lock
> scope.

The ultimate solution is the offload of printk console handling to
kthreads. I know that it takes ages to get it in. But it will
also take ages to go around all the cyclic dependencies.

People tend to use printk() anywhere. And any lock taken by
printk() is prone to cause these problems.

We have tried to go around this in the scheduler code by
printk_deferred() and it was never-ending story. I believe
that the port->lock related cycles are another never-ending
story. And attempts to shuffle locks are always complicated
and error-prone. They require deep understanding of the affected
code paths. The approach with printk_deferred() has been pretty
safe at least.

Another approach might be to teach lockdep to remove lock chains
that were taken during the system initialization and will never
happen again. Or something like this.

I still believe that this is a false positive. Console that is being
initialized can't be used by printk() at the same moment. Locks taken
only when the console is being initialized can't cause deadlocks
when the fully initialized console is registered later.

Best Regards,
Petr

  reply	other threads:[~2020-07-08  9:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 17:30 UART/TTY console deadlock Raul Rangel
2020-06-22 17:37 ` Andy Shevchenko
2020-06-30  3:58   ` Sergey Senozhatsky
2020-06-30 10:21     ` Petr Mladek
2020-06-30 10:55       ` Sergey Senozhatsky
2020-06-30 11:40         ` Andy Shevchenko
2020-06-30 12:22         ` Petr Mladek
2020-06-30 13:05           ` Sergey Senozhatsky
2020-06-30 18:02             ` Tony Lindgren
2020-07-01  6:44               ` S, Shirish
2020-07-02  3:48                 ` S, Shirish
2020-07-02  6:11                   ` Greg Kroah-Hartman
2020-07-02  6:14                     ` S, Shirish
2020-07-02  6:34                       ` Sergey Senozhatsky
2020-07-02  7:11                       ` Greg Kroah-Hartman
2020-07-02  5:12               ` Sergey Senozhatsky
2020-07-02  5:40                 ` Sergey Senozhatsky
2020-07-02  8:20                   ` Andy Shevchenko
2020-07-03 10:53                     ` Sergey Senozhatsky
2020-07-04 11:37                       ` Andy Shevchenko
2020-07-02 16:05                 ` Tony Lindgren
2020-07-03 10:32                   ` Sergey Senozhatsky
2020-07-04 11:35                     ` Andy Shevchenko
2020-07-04 11:59                       ` Andy Shevchenko
2020-07-06 11:31                       ` Kurt Kanzenbach
2020-07-06 14:43                         ` Sergey Senozhatsky
2020-07-08  7:40                           ` Kurt Kanzenbach
2020-07-08  8:07                             ` Sergey Senozhatsky
2020-07-08  9:52                               ` Petr Mladek [this message]
2020-07-09 13:22                                 ` Sergey Senozhatsky
2020-07-14 16:16                                   ` Raul Rangel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200708095215.GB4751@alley \
    --to=pmladek@suse.com \
    --cc=Shirish.S@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rrangel@google.com \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.