From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Phil Elwell <phil@raspberrypi.org>, Jiri Slaby <jslaby@suse.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Alexander Graf <agraf@suse.de>,
Stefan Wahren <stefan.wahren@i2se.com>,
Mian Yousaf Kaukab <yousaf.kaukab@suse.com>,
Matthias Brugger <mbrugger@suse.com>,
Michael Allwright <allsey87@gmail.com>,
Jakub Kicinski <kubakici@wp.pl>,
Xue Liu <liuxuenetmail@gmail.com>
Subject: Re: [PATCH 1/2] sc16is7xx: Fix for multi-channel stall
Date: Tue, 2 Oct 2018 13:36:53 -0700 [thread overview]
Message-ID: <20181002203653.GA2397@kroah.com> (raw)
In-Reply-To: <6028e8e5-f8a6-fbe0-8d2a-b6bb3c91aa14@suse.de>
On Sat, Sep 29, 2018 at 04:04:48PM +0200, Andreas Färber wrote:
> Hi Phil and Greg,
>
> Am 12.09.18 um 16:31 schrieb Phil Elwell:
> > The SC16IS752 is a dual-channel device. The two channels are largely
> > independent, but the IRQ signals are wired together as an open-drain,
> > active low signal which will be driven low while either of the
> > channels requires attention, which can be for significant periods of
> > time until operations complete and the interrupt can be acknowledged.
> > In that respect it is should be treated as a true level-sensitive IRQ.
> >
> > The kernel, however, needs to be able to exit interrupt context in
> > order to use I2C or SPI to access the device registers (which may
> > involve sleeping). Therefore the interrupt needs to be masked out or
> > paused in some way.
> >
> > The usual way to manage sleeping from within an interrupt handler
> > is to use a threaded interrupt handler - a regular interrupt routine
> > does the minimum amount of work needed to triage the interrupt before
> > waking the interrupt service thread. If the threaded IRQ is marked as
> > IRQF_ONESHOT the kernel will automatically mask out the interrupt
> > until the thread runs to completion. The sc16is7xx driver used to
> > use a threaded IRQ, but a patch switched to using a kthread_worker
> > in order to set realtime priorities on the handler thread and for
> > other optimisations. The end result is non-threaded IRQ that
> > schedules some work then returns IRQ_HANDLED, making the kernel
> > think that all IRQ processing has completed.
> >
> > The work-around to prevent a constant stream of interrupts is to
> > mark the interrupt as edge-sensitive rather than level-sensitive,
> > but interpreting an active-low source as a falling-edge source
> > requires care to prevent a total cessation of interrupts. Whereas
> > an edge-triggering source will generate a new edge for every interrupt
> > condition a level-triggering source will keep the signal at the
> > interrupting level until it no longer requires attention; in other
> > words, the host won't see another edge until all interrupt conditions
> > are cleared. It is therefore vital that the interrupt handler does not
> > exit with an outstanding interrupt condition, otherwise the kernel
> > will not receive another interrupt unless some other operation causes
> > the interrupt state on the device to be cleared.
> >
> > The existing sc16is7xx driver has a very simple interrupt "thread"
> > (kthread_work job) that processes interrupts on each channel in turn
> > until there are no more. If both channels are active and the first
> > channel starts interrupting while the handler for the second channel
> > is running then it will not be detected and an IRQ stall ensues. This
> > could be handled easily if there was a shared IRQ status register, or
> > a convenient way to determine if the IRQ had been deasserted for any
> > length of time, but both appear to be lacking.
> >
> > Avoid this problem (or at least make it much less likely to happen)
> > by reducing the granularity of per-channel interrupt processing
> > to one condition per iteration, only exiting the overall loop when
> > both channels are no longer interrupting.
> >
> > Signed-off-by: Phil Elwell <phil@raspberrypi.org>
> > ---
> > drivers/tty/serial/sc16is7xx.c | 19 +++++++++++++------
> > 1 file changed, 13 insertions(+), 6 deletions(-)
>
> These two patches seem to be applied in linux-next tree, but are lacking
> a Fixes: header for backporting to affected stable trees.
>
> openSUSE Tumbleweed's 4.18 appears to be affected, and I didn't see it
> in linux.git for upcoming 4.19 either.
>
> Can the commit message still be updated to get this fixed everywhere?
I can't change the tree, sorry, I can not rebase.
If you want these applied to the stable tree, please email
stable@vger.kernel.org when they hit Linus's tree with the git commit
ids and I will be glad to queue them up then.
thanks,
greg k-h
next prev parent reply other threads:[~2018-10-02 20:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 14:31 [PATCH 0/2] sc16is7xx interrupt fixes Phil Elwell
2018-09-12 14:31 ` [PATCH 1/2] sc16is7xx: Fix for multi-channel stall Phil Elwell
2018-09-18 13:02 ` Greg Kroah-Hartman
2018-09-18 13:13 ` Phil Elwell
2018-09-18 13:26 ` Greg Kroah-Hartman
2018-09-18 13:37 ` Rogier Wolff
2018-09-29 14:04 ` Andreas Färber
2018-10-02 20:36 ` Greg Kroah-Hartman [this message]
2018-09-12 14:31 ` [PATCH 2/2] sc16is7xx: Fix for "Unexpected interrupt: 8" Phil Elwell
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=20181002203653.GA2397@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=allsey87@gmail.com \
--cc=jslaby@suse.com \
--cc=kubakici@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=liuxuenetmail@gmail.com \
--cc=mbrugger@suse.com \
--cc=phil@raspberrypi.org \
--cc=stefan.wahren@i2se.com \
--cc=yousaf.kaukab@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox