Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1593503 > unrolled thread

[PATCH] genirq: Fix handling of nested shared IRQs

Started byCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
First post2017-03-06 17:10 +0100
Last post2017-03-07 10:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] genirq: Fix handling of nested shared IRQs Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-03-06 17:10 +0100
    Re: [PATCH] genirq: Fix handling of nested shared IRQs Thomas Gleixner <tglx@linutronix.de> - 2017-03-06 19:50 +0100
      Re: [PATCH] genirq: Fix handling of nested shared IRQs Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2017-03-07 10:30 +0100

#1593503 — [PATCH] genirq: Fix handling of nested shared IRQs

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-03-06 17:10 +0100
Subject[PATCH] genirq: Fix handling of nested shared IRQs
Message-ID<ti3mX-2d9-53@gated-at.bofh.it>
When an IRQ is nested the nested handler is called directly from within the
threaded handler of the parent IRQ, however, the code in handle_nested_irq
only calls a single handler. This means when a shared IRQ is nested only
the first of the shared IRQ handlers will be run. This patch adds a loop
to move through and process all the handlers associated with the IRQ in
handle_nested_irq.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 kernel/irq/chip.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index be3c34e..c6c7f11 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -348,9 +348,12 @@ void handle_nested_irq(unsigned int irq)
 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
 
-	action_ret = action->thread_fn(action->irq, action->dev_id);
-	if (!noirqdebug)
-		note_interrupt(desc, action_ret);
+	do {
+		action_ret = action->thread_fn(action->irq, action->dev_id);
+		if (!noirqdebug)
+			note_interrupt(desc, action_ret);
+		action = action->next;
+	} while (action);
 
 	raw_spin_lock_irq(&desc->lock);
 	irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
-- 
2.1.4

[toc] | [next] | [standalone]


#1593587

FromThomas Gleixner <tglx@linutronix.de>
Date2017-03-06 19:50 +0100
Message-ID<ti5RM-3Nc-29@gated-at.bofh.it>
In reply to#1593503
On Mon, 6 Mar 2017, Charles Keepax wrote:

> When an IRQ is nested the nested handler is called directly from within the
> threaded handler of the parent IRQ, however, the code in handle_nested_irq
> only calls a single handler. This means when a shared IRQ is nested only
> the first of the shared IRQ handlers will be run. This patch adds a loop
> to move through and process all the handlers associated with the IRQ in
> handle_nested_irq.

That was never meant to deal with nested shaed interrupts, so the $subject
is misleading. This is not a fix, it's a functional extension.

Aside of that, please structure the changelog in paragraphs instead of one
big lump.

 1) Context
 2) Problem
 3) Solution

See also Documentation/process/submitting-patches.rst and please search
there for "This patch" .....

> @@ -348,9 +348,12 @@ void handle_nested_irq(unsigned int irq)
>  	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
>  	raw_spin_unlock_irq(&desc->lock);
>  
> -	action_ret = action->thread_fn(action->irq, action->dev_id);
> -	if (!noirqdebug)
> -		note_interrupt(desc, action_ret);
> +	do {

  	for_each_action_of_desc() please

> +		action_ret = action->thread_fn(action->irq, action->dev_id);
> +		if (!noirqdebug)
> +			note_interrupt(desc, action_ret);

That's wrong. See __handle_irq_event_percpu() for the correct handling of
shared interrupts vs. note_interrupt() 

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1594038

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2017-03-07 10:30 +0100
Message-ID<tijBo-5s7-15@gated-at.bofh.it>
In reply to#1593587
On Mon, Mar 06, 2017 at 07:05:39PM +0100, Thomas Gleixner wrote:
> On Mon, 6 Mar 2017, Charles Keepax wrote:
> 
> > When an IRQ is nested the nested handler is called directly from within the
> > threaded handler of the parent IRQ, however, the code in handle_nested_irq
> > only calls a single handler. This means when a shared IRQ is nested only
> > the first of the shared IRQ handlers will be run. This patch adds a loop
> > to move through and process all the handlers associated with the IRQ in
> > handle_nested_irq.
> 
> That was never meant to deal with nested shaed interrupts, so the $subject
> is misleading. This is not a fix, it's a functional extension.
> 
> Aside of that, please structure the changelog in paragraphs instead of one
> big lump.
> 
>  1) Context
>  2) Problem
>  3) Solution
> 
> See also Documentation/process/submitting-patches.rst and please search
> there for "This patch" .....
> 
> > @@ -348,9 +348,12 @@ void handle_nested_irq(unsigned int irq)
> >  	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
> >  	raw_spin_unlock_irq(&desc->lock);
> >  
> > -	action_ret = action->thread_fn(action->irq, action->dev_id);
> > -	if (!noirqdebug)
> > -		note_interrupt(desc, action_ret);
> > +	do {
> 
>   	for_each_action_of_desc() please
> 
> > +		action_ret = action->thread_fn(action->irq, action->dev_id);
> > +		if (!noirqdebug)
> > +			note_interrupt(desc, action_ret);
> 
> That's wrong. See __handle_irq_event_percpu() for the correct handling of
> shared interrupts vs. note_interrupt() 
> 

Thanks for the pointers, I will look at those and respin the
patch.

Thanks,
Charles

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web