All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] genirq: bug on inconstent flags and flow handler
@ 2014-07-23 18:45 Florian Fainelli
  2014-07-23 18:49 ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-07-23 18:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, jason, Florian Fainelli

It is currently possible for a generic irq chip driver to set IRQ_LEVEL
and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
such a case does not make sense, and will actually prevent e.g: the
software resend logic from kicking, and potential other problems too.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- replaced WARN_ON() with BUG_ON() since we really don't want to continue
  as suggested by Jason Cooper

 kernel/irq/chip.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index a2b28a2fd7b1..17a66b56cd96 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -749,8 +749,13 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
 		irqd_set(&desc->irq_data, IRQD_PER_CPU);
 	if (irq_settings_can_move_pcntxt(desc))
 		irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
-	if (irq_settings_is_level(desc))
+	if (irq_settings_is_level(desc)) {
+		/* Setting IRQD_LEVEL does not make sense on non-level
+		 * sensitive interrupts
+		 */
+		BUG_ON(desc->handle_irq != handle_level_irq);
 		irqd_set(&desc->irq_data, IRQD_LEVEL);
+	}
 
 	irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
 
-- 
1.9.1


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

* Re: [PATCH v2] genirq: bug on inconstent flags and flow handler
  2014-07-23 18:45 [PATCH v2] genirq: bug on inconstent flags and flow handler Florian Fainelli
@ 2014-07-23 18:49 ` Thomas Gleixner
  2014-07-23 19:14   ` Florian Fainelli
  2014-07-23 23:12   ` Jason Cooper
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Gleixner @ 2014-07-23 18:49 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-kernel, jason

On Wed, 23 Jul 2014, Florian Fainelli wrote:

> It is currently possible for a generic irq chip driver to set IRQ_LEVEL
> and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
> such a case does not make sense, and will actually prevent e.g: the
> software resend logic from kicking, and potential other problems too.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Changes in v2:
> - replaced WARN_ON() with BUG_ON() since we really don't want to continue
>   as suggested by Jason Cooper

I disagree here. It's not a reason take the machine down. Its good
enough to WARN. That keeps the machine alive and lets us debug that
stuff.

Lemme find V1 ....

 
>  kernel/irq/chip.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index a2b28a2fd7b1..17a66b56cd96 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -749,8 +749,13 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>  		irqd_set(&desc->irq_data, IRQD_PER_CPU);
>  	if (irq_settings_can_move_pcntxt(desc))
>  		irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
> -	if (irq_settings_is_level(desc))
> +	if (irq_settings_is_level(desc)) {
> +		/* Setting IRQD_LEVEL does not make sense on non-level
> +		 * sensitive interrupts
> +		 */
> +		BUG_ON(desc->handle_irq != handle_level_irq);
>  		irqd_set(&desc->irq_data, IRQD_LEVEL);
> +	}
>  
>  	irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
>  
> -- 
> 1.9.1
> 
> 

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

* Re: [PATCH v2] genirq: bug on inconstent flags and flow handler
  2014-07-23 18:49 ` Thomas Gleixner
@ 2014-07-23 19:14   ` Florian Fainelli
  2014-08-26 23:54     ` Florian Fainelli
  2014-07-23 23:12   ` Jason Cooper
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-07-23 19:14 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Jason Cooper

2014-07-23 11:49 GMT-07:00 Thomas Gleixner <tglx@linutronix.de>:
> On Wed, 23 Jul 2014, Florian Fainelli wrote:
>
>> It is currently possible for a generic irq chip driver to set IRQ_LEVEL
>> and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
>> such a case does not make sense, and will actually prevent e.g: the
>> software resend logic from kicking, and potential other problems too.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> Changes in v2:
>> - replaced WARN_ON() with BUG_ON() since we really don't want to continue
>>   as suggested by Jason Cooper
>
> I disagree here. It's not a reason take the machine down. Its good
> enough to WARN. That keeps the machine alive and lets us debug that
> stuff.

Works for me!

>
> Lemme find V1 ....

Here it is: https://lkml.org/lkml/2014/7/1/468

>
>
>>  kernel/irq/chip.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
>> index a2b28a2fd7b1..17a66b56cd96 100644
>> --- a/kernel/irq/chip.c
>> +++ b/kernel/irq/chip.c
>> @@ -749,8 +749,13 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>>               irqd_set(&desc->irq_data, IRQD_PER_CPU);
>>       if (irq_settings_can_move_pcntxt(desc))
>>               irqd_set(&desc->irq_data, IRQD_MOVE_PCNTXT);
>> -     if (irq_settings_is_level(desc))
>> +     if (irq_settings_is_level(desc)) {
>> +             /* Setting IRQD_LEVEL does not make sense on non-level
>> +              * sensitive interrupts
>> +              */
>> +             BUG_ON(desc->handle_irq != handle_level_irq);
>>               irqd_set(&desc->irq_data, IRQD_LEVEL);
>> +     }
>>
>>       irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
>>
>> --
>> 1.9.1
>>
>>



-- 
Florian

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

* Re: [PATCH v2] genirq: bug on inconstent flags and flow handler
  2014-07-23 18:49 ` Thomas Gleixner
  2014-07-23 19:14   ` Florian Fainelli
@ 2014-07-23 23:12   ` Jason Cooper
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Cooper @ 2014-07-23 23:12 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Florian Fainelli, linux-kernel

On Wed, Jul 23, 2014 at 08:49:46PM +0200, Thomas Gleixner wrote:
> On Wed, 23 Jul 2014, Florian Fainelli wrote:
> 
> > It is currently possible for a generic irq chip driver to set IRQ_LEVEL
> > and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
> > such a case does not make sense, and will actually prevent e.g: the
> > software resend logic from kicking, and potential other problems too.
> > 
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
> > Changes in v2:
> > - replaced WARN_ON() with BUG_ON() since we really don't want to continue
> >   as suggested by Jason Cooper
> 
> I disagree here. It's not a reason take the machine down. Its good
> enough to WARN. That keeps the machine alive and lets us debug that
> stuff.

Sure, I have no strong opinion either way.  On irc I mentioned that this
condition would most likely only arise when porting to a new SoC, so a
kernel developer that will know what to do.

I know for me personally, I need to be stopped mid-track and forced to
pay attention to something like this.  Otherwise, I'll forget and debug
for hours... :-)

thx,

Jason.

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

* Re: [PATCH v2] genirq: bug on inconstent flags and flow handler
  2014-07-23 19:14   ` Florian Fainelli
@ 2014-08-26 23:54     ` Florian Fainelli
  2014-08-27  7:49       ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-08-26 23:54 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Jason Cooper

On 07/23/2014 12:14 PM, Florian Fainelli wrote:
> 2014-07-23 11:49 GMT-07:00 Thomas Gleixner <tglx@linutronix.de>:
>> On Wed, 23 Jul 2014, Florian Fainelli wrote:
>>
>>> It is currently possible for a generic irq chip driver to set IRQ_LEVEL
>>> and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
>>> such a case does not make sense, and will actually prevent e.g: the
>>> software resend logic from kicking, and potential other problems too.
>>>
>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>> ---
>>> Changes in v2:
>>> - replaced WARN_ON() with BUG_ON() since we really don't want to continue
>>>   as suggested by Jason Cooper
>>
>> I disagree here. It's not a reason take the machine down. Its good
>> enough to WARN. That keeps the machine alive and lets us debug that
>> stuff.
> 
> Works for me!
> 
>>
>> Lemme find V1 ....
> 
> Here it is: https://lkml.org/lkml/2014/7/1/468

Thomas, do you want me to resubmit that change so you get a clean
submission in your inbox? Thanks
--
Florian

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

* Re: [PATCH v2] genirq: bug on inconstent flags and flow handler
  2014-08-26 23:54     ` Florian Fainelli
@ 2014-08-27  7:49       ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2014-08-27  7:49 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-kernel, Jason Cooper

On Tue, 26 Aug 2014, Florian Fainelli wrote:

> On 07/23/2014 12:14 PM, Florian Fainelli wrote:
> > 2014-07-23 11:49 GMT-07:00 Thomas Gleixner <tglx@linutronix.de>:
> >> On Wed, 23 Jul 2014, Florian Fainelli wrote:
> >>
> >>> It is currently possible for a generic irq chip driver to set IRQ_LEVEL
> >>> and have its irq flow handler be handle_edge_irq. Setting IRQ_LEVEL in
> >>> such a case does not make sense, and will actually prevent e.g: the
> >>> software resend logic from kicking, and potential other problems too.
> >>>
> >>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >>> ---
> >>> Changes in v2:
> >>> - replaced WARN_ON() with BUG_ON() since we really don't want to continue
> >>>   as suggested by Jason Cooper
> >>
> >> I disagree here. It's not a reason take the machine down. Its good
> >> enough to WARN. That keeps the machine alive and lets us debug that
> >> stuff.
> > 
> > Works for me!
> > 
> >>
> >> Lemme find V1 ....
> > 
> > Here it is: https://lkml.org/lkml/2014/7/1/468
> 
> Thomas, do you want me to resubmit that change so you get a clean
> submission in your inbox? Thanks

Yes please

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

end of thread, other threads:[~2014-08-27  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 18:45 [PATCH v2] genirq: bug on inconstent flags and flow handler Florian Fainelli
2014-07-23 18:49 ` Thomas Gleixner
2014-07-23 19:14   ` Florian Fainelli
2014-08-26 23:54     ` Florian Fainelli
2014-08-27  7:49       ` Thomas Gleixner
2014-07-23 23:12   ` Jason Cooper

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.