2012-11-14 07:51:20

by Liu, Chuansheng

[permalink] [raw]
Subject: [PATCH] x86/irq,io_apic: Fix wrong unmask_ioapic calling when the irq is masked


There is one typical case will cause this issue, that is:
One io-apic interrupt with ONE_SHOT and threaded, when interrupt is coming:
handle_fasteoi_irq()
--> mask_irq(desc)
...
desc->irq_data.chip->irq_eoi(&desc->irq_data)[ack_apic_level]
--> ioapic_irqd_mask()
...
ioapic_irqd_unmask()

After that, the irq will be in unmasked state.

It will break the ONE_SHOT and threaded irq, and brings some unwanted issues.
Here adding the irqd_irq_masked() condition to know if unmasking action is
needed.

Signed-off-by: liu chuansheng <[email protected]>
---
arch/x86/kernel/apic/io_apic.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 1817fa9..d963e76 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2479,7 +2479,8 @@ static inline void ioapic_irqd_unmask(struct irq_data *data,
*/
if (!io_apic_level_ack_pending(cfg))
irq_move_masked_irq(data);
- unmask_ioapic(cfg);
+ if (!irqd_irq_masked(data))
+ unmask_ioapic(cfg);
}
}
#else
--
1.7.0.4



2012-11-16 00:36:32

by Liu, Chuansheng

[permalink] [raw]
Subject: RE: [PATCH] x86/irq,io_apic: Fix wrong unmask_ioapic calling when the irq is masked

Hi Thomas and Ingo,

Could you have a look for this patch? It fix the wrong unmask action.
Thanks.

> -----Original Message-----
> From: Liu, Chuansheng
> Sent: Thursday, November 15, 2012 12:53 AM
> To: [email protected]; [email protected]
> Cc: [email protected]; [email protected]; Liu, Chuansheng
> Subject: [PATCH] x86/irq,io_apic: Fix wrong unmask_ioapic calling when the irq
> is masked
>
>
> There is one typical case will cause this issue, that is:
> One io-apic interrupt with ONE_SHOT and threaded, when interrupt is coming:
> handle_fasteoi_irq()
> --> mask_irq(desc)
> ...
> desc->irq_data.chip->irq_eoi(&desc->irq_data)[ack_apic_level]
> --> ioapic_irqd_mask()
> ...
> ioapic_irqd_unmask()
>
> After that, the irq will be in unmasked state.
>
> It will break the ONE_SHOT and threaded irq, and brings some unwanted
> issues.
> Here adding the irqd_irq_masked() condition to know if unmasking action is
> needed.
>
> Signed-off-by: liu chuansheng <[email protected]>
> ---
> arch/x86/kernel/apic/io_apic.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
> index 1817fa9..d963e76 100644
> --- a/arch/x86/kernel/apic/io_apic.c
> +++ b/arch/x86/kernel/apic/io_apic.c
> @@ -2479,7 +2479,8 @@ static inline void ioapic_irqd_unmask(struct irq_data
> *data,
> */
> if (!io_apic_level_ack_pending(cfg))
> irq_move_masked_irq(data);
> - unmask_ioapic(cfg);
> + if (!irqd_irq_masked(data))
> + unmask_ioapic(cfg);
> }
> }
> #else
> --
> 1.7.0.4
>
>

????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?