linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	dillon.minfei@gmail.com, Erwan Le Ray <erwan.leray@foss.st.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Gerald Baeza <gerald.baeza@st.com>
Subject: Re: [PATCH 2/3] serial: stm32: fix threaded interrupt handling
Date: Fri, 16 Apr 2021 16:19:18 +0200	[thread overview]
Message-ID: <YHmc5jkAXC95HVIp@hovoldconsulting.com> (raw)
In-Reply-To: <20210416140557.25177-3-johan@kernel.org>

On Fri, Apr 16, 2021 at 04:05:56PM +0200, Johan Hovold wrote:
> When DMA is enabled the receive handler runs in a threaded handler, but
> the primary handler up until very recently neither disabled interrupts

Scratch the "up until very recently" bit here since the driver still
doesn't disable interrupt in the device (it just disables all interrupts
in the threaded handler). The rest stands as is.

> in the device or used IRQF_ONESHOT. This would lead to a deadlock if an
> interrupt comes in while the threaded receive handler is running under
> the port lock.
> 
> Commit ad7676812437 ("serial: stm32: fix a deadlock condition with
> wakeup event") claimed to fix an unrelated deadlock, but unfortunately
> also disabled interrupts in the threaded handler. While this prevents
> the deadlock mentioned in the previous paragraph it also defeats the
> purpose of using a threaded handler in the first place.
> 
> Fix this by making the interrupt one-shot and not disabling interrupts
> in the threaded handler.
> 
> Note that (receive) DMA must not be used for a console port as the
> threaded handler could be interrupted while holding the port lock,
> something which could lead to a deadlock in case an interrupt handler
> ends up calling printk.

Johan

  reply	other threads:[~2021-04-16 14:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16 14:05 [PATCH 0/3] serial: sysrq cleanup and stm32 fixes Johan Hovold
2021-04-16 14:05 ` [PATCH 1/3] serial: do not restore interrupt state in sysrq helper Johan Hovold
2021-04-16 14:05 ` [PATCH 2/3] serial: stm32: fix threaded interrupt handling Johan Hovold
2021-04-16 14:19   ` Johan Hovold [this message]
     [not found]   ` <CAL9mu0KwgOFQfa8ft4rB6+F=KLd1gZLYDvwpAW72zPAFntehVw@mail.gmail.com>
2021-04-16 14:46     ` Johan Hovold
2021-04-22  9:34   ` Valentin CARON - foss
2021-04-16 14:05 ` [PATCH 3/3] serial: stm32: defer sysrq processing Johan Hovold
2021-04-22  9:36   ` Valentin CARON - foss

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=YHmc5jkAXC95HVIp@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexandre.torgue@st.com \
    --cc=dillon.minfei@gmail.com \
    --cc=erwan.leray@foss.st.com \
    --cc=gerald.baeza@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).