Ronny Hegewald
2010-Sep-29 01:49 UTC
[Xen-devel] [PATCH][PVOPS] preserve chip_data when initializing irq in xen_allocate_pirq
When running latest xen/stable-2.6.31.x as dom0 it crashes during boot with a stacktrace that looks like this. do_page_fault add_pin_to_irq_node setup_IO_APIC_irq_extra sysfs_create_group acpi_ev_sci_xrupt_handler acpi_sci_to_irq acpi_os_install_interrupt_handler acpi_ev_install_sci_handler acpi_enable_subsystem acpi_init pci_slot_init acpi_init do_one_initcall kernel_init This only happens when the kernel is configured with CONFIG_SPARSE_IRQ=n. This crash appeared since the upstream patch x86: Fix SCI on IOAPIC != 0 (http://git.kernel.org/?p=linux/kernel/git/jeremy/xen.git;a=commitdiff;h=d539e5576605d048e6aeb21cbe3a8e71dc5eea81) from the stable 2.6.31.13 series. The crash happens in add_pin_to_irq_node because irq_cfg, that is taken from irq_desc.chip_data, is null. In xen/stable-2.6.32.x this doesnt happen currently, because of the removement of the xen apic-code. This has the effect that the call to mp_find_ioapic in setup_IO_APIC_irq_extra returns -1 and the function aborts before the code is reached where the crash happens. The root-problem is that in xen_allocate_pirq the chip_data is cleared by the call to dynamic_irq_init. The attached patch fixes this by reinserting chip_data after the call to dynamic_irq_init. For 2.6.32 the code can be simplified so i attached a separate patch for xen/stable-2.6.32.x ========== patch for xen/stable-2.6.31.x Preserve irq_desc.chip_data when calling dynamic_irq_init, as its needed later in setup_IO_APIC_irq_extra. Signed-off-by: Ronny.Hegewald@online.de --- drivers/xen/events.c.org 2010-09-20 21:07:49.000000000 +0000 +++ drivers/xen/events.c 2010-09-29 01:11:20.000000000 +0000 @@ -559,6 +559,8 @@ int xen_allocate_pirq(unsigned gsi, int { int irq; struct physdev_irq irq_op; + struct irq_desc* desc; + void* chip_data; spin_lock(&irq_mapping_update_lock); @@ -573,8 +575,10 @@ int xen_allocate_pirq(unsigned gsi, int * we are using the !xen_initial_domain() to drop in the function.*/ if (identity_mapped_irq(gsi) || !xen_initial_domain()) { irq = gsi; - irq_to_desc_alloc_node(irq, 0); + desc = irq_to_desc_alloc_node(irq, 0); + chip_data = desc->chip_data; dynamic_irq_init(irq); + desc->chip_data = chip_data; } else irq = find_unbound_irq(); ========== patch for xen/stable-2.6.32.x Preserve irq_desc.chip_data when calling dynamic_irq_init, as its needed later in setup_IO_APIC_irq_extra. Signed-off-by: Ronny.Hegewald@online.de --- drivers/xen/events.c.org 2010-09-28 23:45:41.000000000 +0000 +++ drivers/xen/events.c 2010-09-28 23:46:11.000000000 +0000 @@ -602,7 +602,7 @@ if (identity_mapped_irq(gsi) || !xen_initial_domain()) { irq = gsi; irq_to_desc_alloc_node(irq, 0); - dynamic_irq_init(irq); + dynamic_irq_init_keep_chip_data(irq); } else irq = find_unbound_irq(); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Sep-29 09:41 UTC
Re: [Xen-devel] [PATCH][PVOPS] preserve chip_data when initializing irq in xen_allocate_pirq
On Wed, 2010-09-29 at 02:49 +0100, Ronny Hegewald wrote:> > The root-problem is that in xen_allocate_pirq the chip_data is cleared > by the call to dynamic_irq_init. The attached patch fixes this by > reinserting chip_data after the call to dynamic_irq_init.dynamic_irq_init_keep_chip_data will do this for you. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ronny Hegewald
2010-Sep-29 18:51 UTC
Re: [Xen-devel] [PATCH][PVOPS] preserve chip_data when initializing irq in xen_allocate_pirq
On Wednesday 29 September 2010, you wrote:> On Wed, 2010-09-29 at 02:49 +0100, Ronny Hegewald wrote: > > The root-problem is that in xen_allocate_pirq the chip_data iscleared> > by the call to dynamic_irq_init. The attached patch fixes this by > > reinserting chip_data after the call to dynamic_irq_init. > > dynamic_irq_init_keep_chip_data will do this for you.Unfortunatly this function is available since 2.6.32. This why i have send separate patches for 2.6.31 and 2.6.32. The patch for 2.6.32 uses dynamic_irq_init_keep_chip_data. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2010-Sep-29 21:08 UTC
Re: [Xen-devel] [PATCH][PVOPS] preserve chip_data when initializing irq in xen_allocate_pirq
On Wed, 2010-09-29 at 19:51 +0100, Ronny Hegewald wrote:> On Wednesday 29 September 2010, you wrote: > > On Wed, 2010-09-29 at 02:49 +0100, Ronny Hegewald wrote: > > > The root-problem is that in xen_allocate_pirq the chip_data is > cleared > > > by the call to dynamic_irq_init. The attached patch fixes this by > > > reinserting chip_data after the call to dynamic_irq_init. > > > > dynamic_irq_init_keep_chip_data will do this for you. > > Unfortunatly this function is available since 2.6.32. This why i have > send separate patches for 2.6.31 and 2.6.32. The patch for 2.6.32 uses > dynamic_irq_init_keep_chip_data.Sorry, didn''t spot the 2.6.31 bit. Thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel