linux/arch/x86/kernel/apic
Vitaly Kuznetsov c0ff971ef9 x86/ioapic: Disable interrupts when re-routing legacy IRQs
A sporadic hang with consequent crash is observed when booting Hyper-V Gen1
guests:

 Call Trace:
  <IRQ>
  [<ffffffff810ab68d>] ? trace_hardirqs_off+0xd/0x10
  [<ffffffff8107b616>] queue_work_on+0x46/0x90
  [<ffffffff81365696>] ? add_interrupt_randomness+0x176/0x1d0
  ...
  <EOI>
  [<ffffffff81471ddb>] ? _raw_spin_unlock_irqrestore+0x3b/0x60
  [<ffffffff810c295e>] __irq_put_desc_unlock+0x1e/0x40
  [<ffffffff810c5c35>] irq_modify_status+0xb5/0xd0
  [<ffffffff8104adbb>] mp_register_handler+0x4b/0x70
  [<ffffffff8104c55a>] mp_irqdomain_alloc+0x1ea/0x2a0
  [<ffffffff810c7f10>] irq_domain_alloc_irqs_recursive+0x40/0xa0
  [<ffffffff810c860c>] __irq_domain_alloc_irqs+0x13c/0x2b0
  [<ffffffff8104b070>] alloc_isa_irq_from_domain.isra.1+0xc0/0xe0
  [<ffffffff8104bfa5>] mp_map_pin_to_irq+0x165/0x2d0
  [<ffffffff8104c157>] pin_2_irq+0x47/0x80
  [<ffffffff81744253>] setup_IO_APIC+0xfe/0x802
  ...
  [<ffffffff814631c0>] ? rest_init+0x140/0x140

The issue is easily reproducible with a simple instrumentation: if
mdelay(10) is put between mp_setup_entry() and mp_register_handler() calls
in mp_irqdomain_alloc() Hyper-V guest always fails to boot when re-routing
IRQ0. The issue seems to be caused by the fact that we don't disable
interrupts while doing IOPIC programming for legacy IRQs and IRQ0 actually
happens. 

Protect the setup sequence against concurrent interrupts.

[ tglx: Make the protection unconditional and not only for legacy
  	interrupts ]

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Link: http://lkml.kernel.org/r/1444930943-19336-1-git-send-email-vkuznets@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-10-16 16:31:24 +02:00
..
apic_flat_64.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
apic_noop.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
apic_numachip.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
apic.c x86/apic: Serialize LVTT and TSC_DEADLINE writes 2015-09-14 18:29:59 +02:00
bigsmp_32.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
htirq.c x86: Constify irqdomain ops 2015-05-05 11:14:48 +02:00
hw_nmi.c nmi: x86: convert to generic nmi handler 2015-07-17 12:23:30 +01:00
io_apic.c x86/ioapic: Disable interrupts when re-routing legacy IRQs 2015-10-16 16:31:24 +02:00
ipi.c x86: Delete non-required instances of include <linux/init.h> 2014-01-06 21:25:18 -08:00
Makefile x86, irq: Move HT IRQ related code from io_apic.c into htirq.c 2014-12-16 14:08:17 +01:00
msi.c x86/irq: Use accessor irq_data_get_irq_handler_data() 2015-07-13 21:22:46 +02:00
probe_32.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
probe_64.c x86/platform: Introduce APIC post-initialization callback 2012-06-06 09:06:19 +02:00
vector.c genirq: Move field 'affinity' from irq_data into irq_common_data 2015-09-16 15:46:49 +02:00
x2apic_cluster.c Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 09:33:26 -07:00
x2apic_phys.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00
x2apic_uv_x.c x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted 2015-08-17 10:42:28 +02:00