aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2012-03-20 10:19:36 -0400
committerIngo Molnar <mingo@kernel.org>2012-03-23 08:47:25 -0400
commit4da7072ad6831a35a11341097ce477e18651bedd (patch)
tree5fc5b77adec0691174a20453884d8130a2d93335 /arch/x86
parentb7157acf429e6aef690646ba964b9ebd25049ec2 (diff)
x86/io_apic: Move and reenable irq only when CONFIG_GENERIC_PENDING_IRQ=y
This patch removes dead code from certain .config variations. When CONFIG_GENERIC_PENDING_IRQ=n irq move and reenable code is never get executed, nor do_unmask_irq variable updates its init value. Move the code under CONFIG_GENERIC_PENDING_IRQ macro. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Link: http://lkml.kernel.org/r/20120320141935.GA24806@dhcp-26-207.brq.redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/apic/io_apic.c101
1 files changed, 61 insertions, 40 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 6d10a66fc5a9..2c428c5d7ca3 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2512,21 +2512,73 @@ static void ack_apic_edge(struct irq_data *data)
2512 2512
2513atomic_t irq_mis_count; 2513atomic_t irq_mis_count;
2514 2514
2515static void ack_apic_level(struct irq_data *data)
2516{
2517 struct irq_cfg *cfg = data->chip_data;
2518 int i, do_unmask_irq = 0, irq = data->irq;
2519 unsigned long v;
2520
2521 irq_complete_move(cfg);
2522#ifdef CONFIG_GENERIC_PENDING_IRQ 2515#ifdef CONFIG_GENERIC_PENDING_IRQ
2516static inline bool ioapic_irqd_mask(struct irq_data *data, struct irq_cfg *cfg)
2517{
2523 /* If we are moving the irq we need to mask it */ 2518 /* If we are moving the irq we need to mask it */
2524 if (unlikely(irqd_is_setaffinity_pending(data))) { 2519 if (unlikely(irqd_is_setaffinity_pending(data))) {
2525 do_unmask_irq = 1;
2526 mask_ioapic(cfg); 2520 mask_ioapic(cfg);
2521 return true;
2527 } 2522 }
2523 return false;
2524}
2525
2526static inline void ioapic_irqd_unmask(struct irq_data *data,
2527 struct irq_cfg *cfg, bool masked)
2528{
2529 if (unlikely(masked)) {
2530 /* Only migrate the irq if the ack has been received.
2531 *
2532 * On rare occasions the broadcast level triggered ack gets
2533 * delayed going to ioapics, and if we reprogram the
2534 * vector while Remote IRR is still set the irq will never
2535 * fire again.
2536 *
2537 * To prevent this scenario we read the Remote IRR bit
2538 * of the ioapic. This has two effects.
2539 * - On any sane system the read of the ioapic will
2540 * flush writes (and acks) going to the ioapic from
2541 * this cpu.
2542 * - We get to see if the ACK has actually been delivered.
2543 *
2544 * Based on failed experiments of reprogramming the
2545 * ioapic entry from outside of irq context starting
2546 * with masking the ioapic entry and then polling until
2547 * Remote IRR was clear before reprogramming the
2548 * ioapic I don't trust the Remote IRR bit to be
2549 * completey accurate.
2550 *
2551 * However there appears to be no other way to plug
2552 * this race, so if the Remote IRR bit is not
2553 * accurate and is causing problems then it is a hardware bug
2554 * and you can go talk to the chipset vendor about it.
2555 */
2556 if (!io_apic_level_ack_pending(cfg))
2557 irq_move_masked_irq(data);
2558 unmask_ioapic(cfg);
2559 }
2560}
2561#else
2562static inline bool ioapic_irqd_mask(struct irq_data *data, struct irq_cfg *cfg)
2563{
2564 return false;
2565}
2566static inline void ioapic_irqd_unmask(struct irq_data *data,
2567 struct irq_cfg *cfg, bool masked)
2568{
2569}
2528#endif 2570#endif
2529 2571
2572static void ack_apic_level(struct irq_data *data)
2573{
2574 struct irq_cfg *cfg = data->chip_data;
2575 int i, irq = data->irq;
2576 unsigned long v;
2577 bool masked;
2578
2579 irq_complete_move(cfg);
2580 masked = ioapic_irqd_mask(data, cfg);
2581
2530 /* 2582 /*
2531 * It appears there is an erratum which affects at least version 0x11 2583 * It appears there is an erratum which affects at least version 0x11
2532 * of I/O APIC (that's the 82093AA and cores integrated into various 2584 * of I/O APIC (that's the 82093AA and cores integrated into various
@@ -2581,38 +2633,7 @@ static void ack_apic_level(struct irq_data *data)
2581 eoi_ioapic_irq(irq, cfg); 2633 eoi_ioapic_irq(irq, cfg);
2582 } 2634 }
2583 2635
2584 /* Now we can move and renable the irq */ 2636 ioapic_irqd_unmask(data, cfg, masked);
2585 if (unlikely(do_unmask_irq)) {
2586 /* Only migrate the irq if the ack has been received.
2587 *
2588 * On rare occasions the broadcast level triggered ack gets
2589 * delayed going to ioapics, and if we reprogram the
2590 * vector while Remote IRR is still set the irq will never
2591 * fire again.
2592 *
2593 * To prevent this scenario we read the Remote IRR bit
2594 * of the ioapic. This has two effects.
2595 * - On any sane system the read of the ioapic will
2596 * flush writes (and acks) going to the ioapic from
2597 * this cpu.
2598 * - We get to see if the ACK has actually been delivered.
2599 *
2600 * Based on failed experiments of reprogramming the
2601 * ioapic entry from outside of irq context starting
2602 * with masking the ioapic entry and then polling until
2603 * Remote IRR was clear before reprogramming the
2604 * ioapic I don't trust the Remote IRR bit to be
2605 * completey accurate.
2606 *
2607 * However there appears to be no other way to plug
2608 * this race, so if the Remote IRR bit is not
2609 * accurate and is causing problems then it is a hardware bug
2610 * and you can go talk to the chipset vendor about it.
2611 */
2612 if (!io_apic_level_ack_pending(cfg))
2613 irq_move_masked_irq(data);
2614 unmask_ioapic(cfg);
2615 }
2616} 2637}
2617 2638
2618#ifdef CONFIG_IRQ_REMAP 2639#ifdef CONFIG_IRQ_REMAP