Skip to contentSkip to conversation

preserve chip_data when initializing irq in xen_allocate_pirq

PATCH In review Ronny Hegewald 3 participants 4 messages Sep 29, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 [email protected]
xen/events.c renamed from xen/events.c.org +5 -1
@@ -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 [email protected]
xen/events.c renamed from xen/events.c.org +1 -1
@@ -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();
#1 lore raw
Quoted 4 lines · Ronny Hegewald

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.

#2 lore raw
Quoted 2 lines · you
Quoted 1 line · Ronny Hegewald

The root-problem is that in xen_allocate_pirq the chip_data is

cleared

Quoted 4 lines
Quoted 2 lines

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.

#3 lore raw
Quoted 4 lines · Ronny Hegewald
Quoted 2 lines · you
Quoted 1 line · Ronny Hegewald

The root-problem is that in xen_allocate_pirq the chip_data is

cleared

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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.