In ack_apic_level(), when there is pending affinity setting for current irq,
ioapic_irqd_mask()/ioapic_irqd_unmask() will try to mask the irq and do the
irq affinity setting.

But at this time, it is possibility that the irq has been masked, in this case,
we should not unmask it directly in ioapic_irqd_unmask().

One real case is one threaded interrupt with ONE_SHOT, the irq has been masked 
in
handle_fasteoi_irq().

Signed-off-by: liu chuansheng <chuansheng....@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index b739d39..5c0fe25 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2429,7 +2429,8 @@ static inline bool ioapic_irqd_mask(struct irq_data 
*data, struct irq_cfg *cfg)
 {
        /* If we are moving the irq we need to mask it */
        if (unlikely(irqd_is_setaffinity_pending(data))) {
-               mask_ioapic(cfg);
+               if (!irqd_irq_masked(data))
+                       mask_ioapic(cfg);
                return true;
        }
        return false;
@@ -2467,7 +2468,13 @@ 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);
+               /*
+                * For the threaded interrupt with ONE_SHOT flag,
+                * the irq has been masked in handle_fasteoi_irq().
+                * We should be careful not to unmask it here.
+                */
+               if (!irqd_irq_masked(data))
+                       unmask_ioapic(cfg);
        }
 }
 #else
-- 
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to