linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs
@ 2020-04-08 19:15 Grygorii Strashko
  2020-04-09  5:59 ` Lokesh Vutla
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Grygorii Strashko @ 2020-04-08 19:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Lokesh Vutla
  Cc: Peter Ujfalusi, Sekhar Nori, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel, Grygorii Strashko

The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
(masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
status, which provides raw status value.
This causes hard IRQ handlers to be called or threaded handlers to be
scheduled many times even if corresponding INTA IRQ is masked.
Above, first of all, affects the LEVEL interrupts processing and causes
unexpected behavior up the system stack or crash.

Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
provides masked INTA IRQs status.

Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/irqchip/irq-ti-sci-inta.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
index 8f6e6b08eadf..7e3ebf6ed2cd 100644
--- a/drivers/irqchip/irq-ti-sci-inta.c
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -37,6 +37,7 @@
 #define VINT_ENABLE_SET_OFFSET	0x0
 #define VINT_ENABLE_CLR_OFFSET	0x8
 #define VINT_STATUS_OFFSET	0x18
+#define VINT_STATUS_MASKED_OFFSET	0x20
 
 /**
  * struct ti_sci_inta_event_desc - Description of an event coming to
@@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
 	chained_irq_enter(irq_desc_get_chip(desc), desc);
 
 	val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
-			    VINT_STATUS_OFFSET);
+			    VINT_STATUS_MASKED_OFFSET);
 
 	for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
 		virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);
-- 
2.17.1


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

* Re: [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs
  2020-04-08 19:15 [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs Grygorii Strashko
@ 2020-04-09  5:59 ` Lokesh Vutla
  2020-04-09  9:31 ` Marc Zyngier
  2020-04-17  9:56 ` [tip: irq/urgent] irqchip/ti-sci-inta: Fix " tip-bot2 for Grygorii Strashko
  2 siblings, 0 replies; 6+ messages in thread
From: Lokesh Vutla @ 2020-04-09  5:59 UTC (permalink / raw)
  To: Grygorii Strashko, Nishanth Menon, Tero Kristo,
	Santosh Shilimkar, Thomas Gleixner, Jason Cooper, Marc Zyngier
  Cc: Peter Ujfalusi, Sekhar Nori, linux-kernel, Vignesh Raghavendra,
	linux-arm-kernel



On 09/04/20 12:45 AM, Grygorii Strashko wrote:
> The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
> (masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
> status, which provides raw status value.
> This causes hard IRQ handlers to be called or threaded handlers to be
> scheduled many times even if corresponding INTA IRQ is masked.
> Above, first of all, affects the LEVEL interrupts processing and causes
> unexpected behavior up the system stack or crash.
> 
> Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
> provides masked INTA IRQs status.
> 
> Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh


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

* Re: [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs
  2020-04-08 19:15 [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs Grygorii Strashko
  2020-04-09  5:59 ` Lokesh Vutla
@ 2020-04-09  9:31 ` Marc Zyngier
  2020-04-09 11:11   ` Grygorii Strashko
  2020-04-17  9:56 ` [tip: irq/urgent] irqchip/ti-sci-inta: Fix " tip-bot2 for Grygorii Strashko
  2 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2020-04-09  9:31 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Thomas Gleixner,
	Jason Cooper, Lokesh Vutla, Peter Ujfalusi, Sekhar Nori,
	linux-kernel, Vignesh Raghavendra, linux-arm-kernel

On Wed, 8 Apr 2020 22:15:32 +0300
Grygorii Strashko <grygorii.strashko@ti.com> wrote:

> The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
> (masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
> status, which provides raw status value.
> This causes hard IRQ handlers to be called or threaded handlers to be
> scheduled many times even if corresponding INTA IRQ is masked.
> Above, first of all, affects the LEVEL interrupts processing and causes
> unexpected behavior up the system stack or crash.
> 
> Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
> provides masked INTA IRQs status.
> 
> Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Given the failure mode, doesn't this deserve a Cc stable?

> ---
>  drivers/irqchip/irq-ti-sci-inta.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
> index 8f6e6b08eadf..7e3ebf6ed2cd 100644
> --- a/drivers/irqchip/irq-ti-sci-inta.c
> +++ b/drivers/irqchip/irq-ti-sci-inta.c
> @@ -37,6 +37,7 @@
>  #define VINT_ENABLE_SET_OFFSET	0x0
>  #define VINT_ENABLE_CLR_OFFSET	0x8
>  #define VINT_STATUS_OFFSET	0x18
> +#define VINT_STATUS_MASKED_OFFSET	0x20
>  
>  /**
>   * struct ti_sci_inta_event_desc - Description of an event coming to
> @@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
>  	chained_irq_enter(irq_desc_get_chip(desc), desc);
>  
>  	val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
> -			    VINT_STATUS_OFFSET);
> +			    VINT_STATUS_MASKED_OFFSET);
>  
>  	for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
>  		virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);


Otherwise queued for post -rc1.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs
  2020-04-09  9:31 ` Marc Zyngier
@ 2020-04-09 11:11   ` Grygorii Strashko
  2020-04-09 11:17     ` Marc Zyngier
  0 siblings, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2020-04-09 11:11 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Nishanth Menon, Peter Ujfalusi, Jason Cooper, Lokesh Vutla,
	Sekhar Nori, linux-kernel, Tero Kristo, Santosh Shilimkar,
	Thomas Gleixner, linux-arm-kernel, Vignesh Raghavendra



On 09/04/2020 12:31, Marc Zyngier wrote:
> On Wed, 8 Apr 2020 22:15:32 +0300
> Grygorii Strashko <grygorii.strashko@ti.com> wrote:
> 
>> The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
>> (masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
>> status, which provides raw status value.
>> This causes hard IRQ handlers to be called or threaded handlers to be
>> scheduled many times even if corresponding INTA IRQ is masked.
>> Above, first of all, affects the LEVEL interrupts processing and causes
>> unexpected behavior up the system stack or crash.
>>
>> Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
>> provides masked INTA IRQs status.
>>
>> Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> 
> Given the failure mode, doesn't this deserve a Cc stable?

Sorry, was not sure how it works here.
"Fixes" tag now is usually enough to get included in stable.
Any way, I'll track it and if not included will re-send for stable.

> 
>> ---
>>   drivers/irqchip/irq-ti-sci-inta.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
>> index 8f6e6b08eadf..7e3ebf6ed2cd 100644
>> --- a/drivers/irqchip/irq-ti-sci-inta.c
>> +++ b/drivers/irqchip/irq-ti-sci-inta.c
>> @@ -37,6 +37,7 @@
>>   #define VINT_ENABLE_SET_OFFSET	0x0
>>   #define VINT_ENABLE_CLR_OFFSET	0x8
>>   #define VINT_STATUS_OFFSET	0x18
>> +#define VINT_STATUS_MASKED_OFFSET	0x20
>>   
>>   /**
>>    * struct ti_sci_inta_event_desc - Description of an event coming to
>> @@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
>>   	chained_irq_enter(irq_desc_get_chip(desc), desc);
>>   
>>   	val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
>> -			    VINT_STATUS_OFFSET);
>> +			    VINT_STATUS_MASKED_OFFSET);
>>   
>>   	for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
>>   		virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);
> 
> 
> Otherwise queued for post -rc1.

Thanks.

-- 
Best regards,
grygorii

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

* Re: [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs
  2020-04-09 11:11   ` Grygorii Strashko
@ 2020-04-09 11:17     ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2020-04-09 11:17 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Nishanth Menon, Peter Ujfalusi, Jason Cooper, Lokesh Vutla,
	Sekhar Nori, linux-kernel, Tero Kristo, Santosh Shilimkar,
	Thomas Gleixner, linux-arm-kernel, Vignesh Raghavendra

On Thu, 9 Apr 2020 14:11:12 +0300
Grygorii Strashko <grygorii.strashko@ti.com> wrote:

> On 09/04/2020 12:31, Marc Zyngier wrote:
> > On Wed, 8 Apr 2020 22:15:32 +0300
> > Grygorii Strashko <grygorii.strashko@ti.com> wrote:
> >   
> >> The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
> >> (masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
> >> status, which provides raw status value.
> >> This causes hard IRQ handlers to be called or threaded handlers to be
> >> scheduled many times even if corresponding INTA IRQ is masked.
> >> Above, first of all, affects the LEVEL interrupts processing and causes
> >> unexpected behavior up the system stack or crash.
> >>
> >> Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
> >> provides masked INTA IRQs status.
> >>
> >> Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
> >> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>  
> > 
> > Given the failure mode, doesn't this deserve a Cc stable?  
> 
> Sorry, was not sure how it works here.
> "Fixes" tag now is usually enough to get included in stable.
> Any way, I'll track it and if not included will re-send for stable.

Last time I asked, Greg was adamant that a Cc: stable was needed to
guarantee a backport. In some cases, the patch is picked up anyway, but
it doesn't hurt to have the stable tag if you think it should be
backported.

Anyway, I've now added such tag.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* [tip: irq/urgent] irqchip/ti-sci-inta: Fix processing of masked irqs
  2020-04-08 19:15 [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs Grygorii Strashko
  2020-04-09  5:59 ` Lokesh Vutla
  2020-04-09  9:31 ` Marc Zyngier
@ 2020-04-17  9:56 ` tip-bot2 for Grygorii Strashko
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Grygorii Strashko @ 2020-04-17  9:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Grygorii Strashko, Marc Zyngier, Lokesh Vutla, stable, x86, LKML

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     3688b0db5c331f4ec3fa5eb9f670a4b04f530700
Gitweb:        https://git.kernel.org/tip/3688b0db5c331f4ec3fa5eb9f670a4b04f530700
Author:        Grygorii Strashko <grygorii.strashko@ti.com>
AuthorDate:    Wed, 08 Apr 2020 22:15:32 +03:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Fri, 17 Apr 2020 08:59:28 +01:00

irqchip/ti-sci-inta: Fix processing of masked irqs

The ti_sci_inta_irq_handler() does not take into account INTA IRQs state
(masked/unmasked) as it uses INTA_STATUS_CLEAR_j register to get INTA IRQs
status, which provides raw status value.
This causes hard IRQ handlers to be called or threaded handlers to be
scheduled many times even if corresponding INTA IRQ is masked.
Above, first of all, affects the LEVEL interrupts processing and causes
unexpected behavior up the system stack or crash.

Fix it by using the Interrupt Masked Status INTA_STATUSM_j register which
provides masked INTA IRQs status.

Fixes: 9f1463b86c13 ("irqchip/ti-sci-inta: Add support for Interrupt Aggregator driver")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20200408191532.31252-1-grygorii.strashko@ti.com
Cc: stable@vger.kernel.org
---
 drivers/irqchip/irq-ti-sci-inta.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
index 8f6e6b0..7e3ebf6 100644
--- a/drivers/irqchip/irq-ti-sci-inta.c
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -37,6 +37,7 @@
 #define VINT_ENABLE_SET_OFFSET	0x0
 #define VINT_ENABLE_CLR_OFFSET	0x8
 #define VINT_STATUS_OFFSET	0x18
+#define VINT_STATUS_MASKED_OFFSET	0x20
 
 /**
  * struct ti_sci_inta_event_desc - Description of an event coming to
@@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
 	chained_irq_enter(irq_desc_get_chip(desc), desc);
 
 	val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
-			    VINT_STATUS_OFFSET);
+			    VINT_STATUS_MASKED_OFFSET);
 
 	for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
 		virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);

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

end of thread, other threads:[~2020-04-17  9:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 19:15 [PATCH] irqchip/ti-sci-inta: fix processing of masked irqs Grygorii Strashko
2020-04-09  5:59 ` Lokesh Vutla
2020-04-09  9:31 ` Marc Zyngier
2020-04-09 11:11   ` Grygorii Strashko
2020-04-09 11:17     ` Marc Zyngier
2020-04-17  9:56 ` [tip: irq/urgent] irqchip/ti-sci-inta: Fix " tip-bot2 for Grygorii Strashko

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