linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT
       [not found] <20160218084634.017c3ab4@laptop>
@ 2016-02-18 17:26 ` Josh Cartwright
  2016-03-08 12:43   ` Sean Nyekjær
  2016-09-09 13:14   ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 5+ messages in thread
From: Josh Cartwright @ 2016-02-18 17:26 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-serial, linux-rt-users, Sean Nyekjaer, linux-kernel, stable

The use of IRQF_ONESHOT when registering an interrupt handler with
request_irq() is non-sensical.

Not only that, it also prevents the handler from being threaded when it
otherwise should be w/ IRQ_FORCED_THREADING is enabled.  This causes the
following deadlock observed by Sean Nyekjaer on -rt:

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[..]
   rt_spin_lock_slowlock from (queue_kthread_work+0x18/0x74)
   queue_kthread_work) from (sc16is7xx_irq+0x10/0x18 [sc16is7xx])
   sc16is7xx_irq [sc16is7xx]) from (handle_irq_event_percpu+0x70/0x158)
   handle_irq_event_percpu) from (handle_irq_event+0x68/0xa8)
   handle_irq_event) from (handle_level_irq+0x10c/0x184)
   handle_level_irq) from (generic_handle_irq+0x2c/0x3c)
   generic_handle_irq) from (mxc_gpio_irq_handler+0x3c/0x108)
   mxc_gpio_irq_handler) from (mx3_gpio_irq_handler+0x80/0xcc)
   mx3_gpio_irq_handler) from (generic_handle_irq+0x2c/0x3c)
   generic_handle_irq) from (__handle_domain_irq+0x7c/0xe8)
   __handle_domain_irq) from (gic_handle_irq+0x24/0x5c)
   gic_handle_irq) from (__irq_svc+0x40/0x88)
   (__irq_svc) from (rt_spin_unlock+0x1c/0x68)
   (rt_spin_unlock) from (kthread_worker_fn+0x104/0x17c)
   (kthread_worker_fn) from (kthread+0xd0/0xe8)
   (kthread) from (ret_from_fork+0x14/0x2c)

Reported-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Fixes: 9e6f4ca3e567 ("sc16is7xx: use kthread_worker for tx_work and irq")
Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Josh Cartwright <joshc@ni.com>
---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index e78fa99..1bb5c0e 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1257,7 +1257,7 @@ static int sc16is7xx_probe(struct device *dev,
 
 	/* Setup interrupt */
 	ret = devm_request_irq(dev, irq, sc16is7xx_irq,
-			       IRQF_ONESHOT | flags, dev_name(dev), s);
+			       flags, dev_name(dev), s);
 	if (!ret)
 		return 0;
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT
  2016-02-18 17:26 ` [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT Josh Cartwright
@ 2016-03-08 12:43   ` Sean Nyekjær
  2016-09-09 13:14   ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 5+ messages in thread
From: Sean Nyekjær @ 2016-03-08 12:43 UTC (permalink / raw)
  To: Josh Cartwright, Jakub Kicinski
  Cc: linux-serial, linux-rt-users, linux-kernel, stable



On 2016-02-18 18:26, Josh Cartwright wrote:
> The use of IRQF_ONESHOT when registering an interrupt handler with
> request_irq() is non-sensical.
>
> Not only that, it also prevents the handler from being threaded when it
> otherwise should be w/ IRQ_FORCED_THREADING is enabled.  This causes the
> following deadlock observed by Sean Nyekjaer on -rt:
>
> Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> [..]
>     rt_spin_lock_slowlock from (queue_kthread_work+0x18/0x74)
>     queue_kthread_work) from (sc16is7xx_irq+0x10/0x18 [sc16is7xx])
>     sc16is7xx_irq [sc16is7xx]) from (handle_irq_event_percpu+0x70/0x158)
>     handle_irq_event_percpu) from (handle_irq_event+0x68/0xa8)
>     handle_irq_event) from (handle_level_irq+0x10c/0x184)
>     handle_level_irq) from (generic_handle_irq+0x2c/0x3c)
>     generic_handle_irq) from (mxc_gpio_irq_handler+0x3c/0x108)
>     mxc_gpio_irq_handler) from (mx3_gpio_irq_handler+0x80/0xcc)
>     mx3_gpio_irq_handler) from (generic_handle_irq+0x2c/0x3c)
>     generic_handle_irq) from (__handle_domain_irq+0x7c/0xe8)
>     __handle_domain_irq) from (gic_handle_irq+0x24/0x5c)
>     gic_handle_irq) from (__irq_svc+0x40/0x88)
>     (__irq_svc) from (rt_spin_unlock+0x1c/0x68)
>     (rt_spin_unlock) from (kthread_worker_fn+0x104/0x17c)
>     (kthread_worker_fn) from (kthread+0xd0/0xe8)
>     (kthread) from (ret_from_fork+0x14/0x2c)
>
> Reported-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
> Fixes: 9e6f4ca3e567 ("sc16is7xx: use kthread_worker for tx_work and irq")
> Cc: stable@vger.kernel.org # v4.1+
> Signed-off-by: Josh Cartwright <joshc@ni.com>
> ---
>   drivers/tty/serial/sc16is7xx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index e78fa99..1bb5c0e 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1257,7 +1257,7 @@ static int sc16is7xx_probe(struct device *dev,
>   
>   	/* Setup interrupt */
>   	ret = devm_request_irq(dev, irq, sc16is7xx_irq,
> -			       IRQF_ONESHOT | flags, dev_name(dev), s);
> +			       flags, dev_name(dev), s);
>   	if (!ret)
>   		return 0;
>   
Is PATCH this dropped?
It clearly fixes the irq when running with RT patches :-)

/Sean

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT
  2016-02-18 17:26 ` [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT Josh Cartwright
  2016-03-08 12:43   ` Sean Nyekjær
@ 2016-09-09 13:14   ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-09-09 13:14 UTC (permalink / raw)
  To: Josh Cartwright
  Cc: Jakub Kicinski, linux-serial, linux-rt-users, Sean Nyekjaer,
	linux-kernel

On 2016-02-18 11:26:12 [-0600], Josh Cartwright wrote:
> The use of IRQF_ONESHOT when registering an interrupt handler with
> request_irq() is non-sensical.
> 
> Not only that, it also prevents the handler from being threaded when it
> otherwise should be w/ IRQ_FORCED_THREADING is enabled.  This causes the
> following deadlock observed by Sean Nyekjaer on -rt:

So we this patch 
  http://lkml.iu.edu/hypermail/linux/kernel/1602.2/02637.html

sitting in -RT. Then someone posted
  http://www.spinics.net/lists/linux-rt-users/msg14975.html
which depends on it.
Before I was are of the first patch, I posted
  http://www.spinics.net/lists/linux-rt-users/msg14666.html

and nobody seems to care if anything of this gets merged upstream
where it belongs. Could some please carry this to Greg upstream?

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sc16is7xx: Drop bogus use of IRQF_ONESHOT
  2016-10-03 15:14 [PATCH] sc16is7xx: Drop " Julia Cartwright
@ 2016-10-13  0:48 ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2016-10-13  0:48 UTC (permalink / raw)
  To: Julia Cartwright
  Cc: Greg Kroah-Hartman, linux-kernel, Sean Nyekjaer, Josh Cartwright,
	linux-rt-users, stable, linux-serial, Sebastian Andrzej Siewior

On Mon, 3 Oct 2016 10:14:32 -0500, Julia Cartwright wrote:
> The use of IRQF_ONESHOT when registering an interrupt handler with
> request_irq() is non-sensical.
> ...

Disabling the irq when kthread is pending as mentioned here:

http://www.spinics.net/lists/linux-rt-users/msg14673.html

could be beneficial but this is definitely a step in the right
direction!

Acked-by: Jakub Kicinski <kubakici@wp.pl>

Thanks a lot Julia!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] sc16is7xx: Drop bogus use of IRQF_ONESHOT
@ 2016-10-03 15:14 Julia Cartwright
  2016-10-13  0:48 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Cartwright @ 2016-10-03 15:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sean Nyekjaer, Josh Cartwright, linux-rt-users,
	Jakub Kicinski, stable, linux-serial, Sebastian Andrzej Siewior

The use of IRQF_ONESHOT when registering an interrupt handler with
request_irq() is non-sensical.

Not only that, it also prevents the handler from being threaded when it
otherwise should be w/ IRQ_FORCED_THREADING is enabled.  This causes the
following deadlock observed by Sean Nyekjaer on -rt:

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[..]
   rt_spin_lock_slowlock from queue_kthread_work
   queue_kthread_work from sc16is7xx_irq
   sc16is7xx_irq [sc16is7xx] from handle_irq_event_percpu
   handle_irq_event_percpu from handle_irq_event
   handle_irq_event from handle_level_irq
   handle_level_irq from generic_handle_irq
   generic_handle_irq from mxc_gpio_irq_handler
   mxc_gpio_irq_handler from mx3_gpio_irq_handler
   mx3_gpio_irq_handler from generic_handle_irq
   generic_handle_irq from __handle_domain_irq
   __handle_domain_irq from gic_handle_irq
   gic_handle_irq from __irq_svc
   __irq_svc from rt_spin_unlock
   rt_spin_unlock from kthread_worker_fn
   kthread_worker_fn from kthread
   kthread from ret_from_fork

Fixes: 9e6f4ca3e567 ("sc16is7xx: use kthread_worker for tx_work and irq")
Reported-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Josh Cartwright <joshc@ni.com>
Cc: linux-rt-users@vger.kernel.org
Cc: Jakub Kicinski <moorray3@wp.pl>
Cc: stable@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Julia Cartwright <julia@ni.com>
---
This patch has been in -rt for a little while, but it isn't -rt specific.

See relevant bug report thread which starts here:

  http://www.spinics.net/lists/linux-rt-users/msg14620.html

 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index a9d94f7..96a374d 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1260,7 +1260,7 @@ static int sc16is7xx_probe(struct device *dev,
 
 	/* Setup interrupt */
 	ret = devm_request_irq(dev, irq, sc16is7xx_irq,
-			       IRQF_ONESHOT | flags, dev_name(dev), s);
+			       flags, dev_name(dev), s);
 	if (!ret)
 		return 0;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-13  1:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20160218084634.017c3ab4@laptop>
2016-02-18 17:26 ` [PATCH] sc16is7xx: drop bogus use of IRQF_ONESHOT Josh Cartwright
2016-03-08 12:43   ` Sean Nyekjær
2016-09-09 13:14   ` Sebastian Andrzej Siewior
2016-10-03 15:14 [PATCH] sc16is7xx: Drop " Julia Cartwright
2016-10-13  0:48 ` Jakub Kicinski

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).