Bug 62521 - PCI IRQ error is not propagated through call stack
Summary: PCI IRQ error is not propagated through call stack
Status: NEW
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: x86-64 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: platform_x86_64@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-03 23:56 UTC by Prarit Bhargava
Modified: 2013-10-16 12:26 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.12.0-rc3
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg log from system (56.30 KB, application/octet-stream)
2013-10-07 12:34 UTC, Prarit Bhargava
Details
acpidump from system (49.48 KB, application/octet-stream)
2013-10-16 12:26 UTC, Prarit Bhargava
Details

Description Prarit Bhargava 2013-10-03 23:56:49 UTC
Description of Problem: When booting a DELL Power Edge 840 a stack trace is seen that indicates a shared IRQ flags mismatch on IRQ 0.

Driver probe's currently do the following

	pci_enable_device();
	/* ... do some other init stuff, and eventually call ... */
	request_irq();

After pci_enable_device() is called it is assumed that the device's irq
value (pci_dev->irq) has been appropriately set on success.  This value
is passed into the request_irq() call.

In the case that ACPI is used to determine the irq value, it is possible
that the ACPI IRQ look up for a specific device fails and success is
returned by pci_enable_device().

The call sequence is:

pci_enable_device();
	-> pci_enable_device_flags();
		->do_pci_enable_device();
			-> pcibios_enable_device() which, if the device
			   does not use MSI calls
			   -> pcibios_enable_irq() which maps to
			      acpi_pci_irq_enable()
				-> acpi_pci_irq_lookup()

If acpi_pci_irq_lookup() cannot map the device's IRQ value it returns NULL
as an error.  The error is returned to acpi_pci_irq_enable(), but is not
propagated further.  This can result in the driver returning success for
pci_enable_device() and the driver probe attempting to call request_irq()
with dev->irq = 0.

Actual Result:

[   13.218815] i801_smbus 0000:00:1f.3: can't derive routing for PCI INT B
[   13.225440] i801_smbus 0000:00:1f.3: PCI INT B: no GSI
[   13.230600] genirq: Flags mismatch irq 0. 00000080 (i801_smbus) vs. 00015a20 
[   13.231578] CPU: 1 PID: 485 Comm: systemd-udevd Not tainted 3.12.0-rc3+ #1
[   13.231578] Hardware name: Dell Computer Corporation PowerEdge 840/0RH822, BI
[   13.246434]  ffff880034b25600 ffff8800354f5a78 ffffffff8161e7c6 ffff88007d005
[   13.246434]  ffff8800354f5ac8 ffffffff810b8c0d ffffffff8119321e 0000000000000
[   13.246434]  ffff8800757e0800 ffffffffa0131240 0000000000000080 0000000000000
[   13.246434] Call Trace:
[   13.246434]  [<ffffffff8161e7c6>] dump_stack+0x45/0x56
[   13.246434]  [<ffffffff810b8c0d>] __setup_irq+0x52d/0x560
[   13.246434]  [<ffffffff8119321e>] ? kmem_cache_alloc_trace+0x1ce/0x1f0
[   13.246434]  [<ffffffffa0131240>] ? i801_check_pre.isra.5+0xe0/0xe0 [i2c_i801
[   13.246434]  [<ffffffff810b8d9c>] request_threaded_irq+0xcc/0x170
[   13.246434]  [<ffffffffa013287d>] i801_probe+0x33d/0x514 [i2c_i801]
[   13.246434]  [<ffffffff81221693>] ? sysfs_addrm_finish+0x33/0xc0
[   13.246434]  [<ffffffff81334c9e>] local_pci_probe+0x3e/0x70
[   13.246434]  [<ffffffff81336041>] pci_device_probe+0x111/0x120
[   13.246434]  [<ffffffff813fc117>] driver_probe_device+0x87/0x390
[   13.246434]  [<ffffffff813fc4f3>] __driver_attach+0x93/0xa0
[   13.246434]  [<ffffffff813fc460>] ? __device_attach+0x40/0x40
[   13.246434]  [<ffffffff813f9fd3>] bus_for_each_dev+0x63/0xa0
[   13.246434]  [<ffffffff813fbb6e>] driver_attach+0x1e/0x20
[   13.246434]  [<ffffffff813fb6e0>] bus_add_driver+0x200/0x2d0
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff813fcb34>] driver_register+0x64/0xf0
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff81334b2c>] __pci_register_driver+0x4c/0x50
[   13.246434]  [<ffffffffa01370af>] i2c_i801_init+0xaf/0x1000 [i2c_i801]
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff810020fa>] do_one_initcall+0xfa/0x1b0
[   13.246434]  [<ffffffff81055733>] ? set_memory_nx+0x43/0x50
[   13.246434]  [<ffffffff810d302c>] load_module+0x11ac/0x1a90
[   13.246434]  [<ffffffff810ceed0>] ? store_uevent+0x40/0x40
[   13.246434]  [<ffffffff810b8c0d>] __setup_irq+0x52d/0x560
[   13.246434]  [<ffffffff8119321e>] ? kmem_cache_alloc_trace+0x1ce/0x1f0
[   13.246434]  [<ffffffffa0131240>] ? i801_check_pre.isra.5+0xe0/0xe0 [i2c_i801
[   13.246434]  [<ffffffff810b8d9c>] request_threaded_irq+0xcc/0x170
[   13.246434]  [<ffffffffa013287d>] i801_probe+0x33d/0x514 [i2c_i801]
[   13.246434]  [<ffffffff81221693>] ? sysfs_addrm_finish+0x33/0xc0
[   13.246434]  [<ffffffff81334c9e>] local_pci_probe+0x3e/0x70
[   13.246434]  [<ffffffff81336041>] pci_device_probe+0x111/0x120
[   13.246434]  [<ffffffff813fc117>] driver_probe_device+0x87/0x390
[   13.246434]  [<ffffffff813fc4f3>] __driver_attach+0x93/0xa0
[   13.246434]  [<ffffffff813fc460>] ? __device_attach+0x40/0x40
[   13.246434]  [<ffffffff813f9fd3>] bus_for_each_dev+0x63/0xa0
[   13.246434]  [<ffffffff813fbb6e>] driver_attach+0x1e/0x20
[   13.246434]  [<ffffffff813fb6e0>] bus_add_driver+0x200/0x2d0
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff813fcb34>] driver_register+0x64/0xf0
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff81334b2c>] __pci_register_driver+0x4c/0x50
[   13.246434]  [<ffffffffa01370af>] i2c_i801_init+0xaf/0x1000 [i2c_i801]
[   13.246434]  [<ffffffffa0137000>] ? 0xffffffffa0136fff
[   13.246434]  [<ffffffff810020fa>] do_one_initcall+0xfa/0x1b0
[   13.246434]  [<ffffffff81055733>] ? set_memory_nx+0x43/0x50
[   13.246434]  [<ffffffff810d302c>] load_module+0x11ac/0x1a90
[   13.246434]  [<ffffffff810ceed0>] ? store_uevent+0x40/0x40
[   13.246434]  [<ffffffff810cfd6a>] ? copy_module_from_fd.isra.44+0x12a/0x190
[   13.246434]  [<ffffffff810d3a86>] SyS_finit_module+0x86/0xb0
[   13.246434]  [<ffffffff8162e329>] system_call_fastpath+0x16/0x1b
[   13.441044] i801_smbus 0000:00:1f.3: Failed to allocate irq 0: -16
[   13.447593] IPMI System Interface driver.
[   13.448557] i801_smbus: probe of 0000:00:1f.3 failed with error -16



Expected Result: PCI should propagate an error.  I originally suggested:

diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 41c5e1b..9681847 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -430,6 +430,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
 		} else {
 			dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
 				 pin_name(pin));
+			return -ENOENT;
 		}
 
 		return 0;

However, this caused some odd failures in xHCI as reported here:

http://marc.info/?l=linux-acpi&m=137571147911129&w=2
Comment 1 Prarit Bhargava 2013-10-07 12:34:24 UTC
Created attachment 110371 [details]
dmesg log from system
Comment 2 Prarit Bhargava 2013-10-16 12:26:14 UTC
Created attachment 111311 [details]
acpidump from system

Bjorn requested the output of acpidump.

P.

Note You need to log in before you can comment on or make changes to this bug.