Re: [Patch V4 00/42] use irqdomain to dynamically allocate IRQ for IOAPIC

From: Yinghai Lu
Date: Thu Jun 26 2014 - 23:36:58 EST


On Sat, Jun 21, 2014 at 2:08 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> Jiang,
>
> On Mon, 9 Jun 2014, Jiang Liu wrote:
>
>> On x86 platforms, IRQ number are statically allocated to IOAPIC pins at boot.
>> There are two issues with this design. First it causes trouble to IOAPIC
>> hotplug because we need to allocate a block of IRQ numbers for each IOAPIC.
>> Second it may waste IRQ nubmers even if some IOAPIC pins are not used because
>> IRQ numbers are statically assigned.
>>
>> This patchset tries to enable dynamic IRQ number allocation for IOAPIC
>> by adopting the irqdomain framework, it solves the two issues mentioned
>> above. It also simplifies the IOAPIC driver by consolidating ways to
>> program IOAPIC pins with the irqdomain map interface.
>>
>> We will enhance the IOAPIC driver core to support ACPI based IOAPIC hotplug
>> once the IOAPIC driver has been converted to irqdomain.
>
> I merged the whole lot. Thanks for doing this and reacting on all the
> review comments. Very nice cleanup work!
>

I got following warning on RHEL 7.0 shutdown path.

[58018.128900] ------------[ cut here ]------------
[58018.134081] WARNING: CPU: 21 PID: 1 at fs/proc/generic.c:521
remove_proc_entry+0x150/0x1a0()
[58018.143596] remove_proc_entry: removing non-empty directory
'irq/23', leaking at least 'ehci_hcd:usb2'
[58018.154001] Modules linked in:
[58018.157435] CPU: 21 PID: 1 Comm: systemd-shutdow Tainted: G
W 3.16.0-rc2-yh-00420-g6d62036-dirty #36
[58018.168716] Hardware name: Oracle Corporation ORACLE SERVER
[58018.179703] 0000000000000009 ffff885e759bfb60 ffffffff81f76520
ffff885e759bfba8
[58018.188033] ffff885e759bfb98 ffffffff8109d03d ffff88edf9fb9f00
0000000000000002
[58018.196358] ffff885e759bfc6e ffff88f07b3f4330 ffff88edf9fb9fb9
ffff885e759bfbf8
[58018.204682] Call Trace:
[58018.207432] [<ffffffff81f76520>] dump_stack+0x45/0x56
[58018.213186] [<ffffffff8109d03d>] warn_slowpath_common+0x7d/0xa0
[58018.219903] [<ffffffff8109d0ac>] warn_slowpath_fmt+0x4c/0x50
[58018.226336] [<ffffffff8124b830>] remove_proc_entry+0x150/0x1a0
[58018.232963] [<ffffffff810fdb5f>] unregister_irq_proc+0xbf/0xd0
[58018.239589] [<ffffffff810f7b41>] free_desc+0x31/0xa0
[58018.245240] [<ffffffff810f7c1c>] irq_free_descs+0x6c/0x80
[58018.251375] [<ffffffff810fd2e3>] irq_dispose_mapping+0x53/0x60
[58018.258011] [<ffffffff81083d60>] mp_unmap_irq+0xa0/0xc0
[58018.263960] [<ffffffff8107ac8f>] acpi_unregister_gsi_ioapic+0x2f/0x40
[58018.271263] [<ffffffff8107ab17>] acpi_unregister_gsi+0x17/0x20
[58018.277896] [<ffffffff815a4562>] acpi_pci_irq_disable+0x5e/0x68
[58018.284619] [<ffffffff81e33680>] pcibios_disable_device+0x20/0x30
[58018.291536] [<ffffffff81557222>] do_pci_disable_device+0x52/0x60
[58018.298350] [<ffffffff815572c2>] pci_disable_device+0x92/0xb0
[58018.304876] [<ffffffff81c710bf>] usb_hcd_pci_shutdown+0x3f/0x50
[58018.311593] [<ffffffff81559666>] pci_device_shutdown+0x36/0x70
[58018.318220] [<ffffffff817a4875>] device_shutdown+0x135/0x190
[58018.324651] [<ffffffff810bd935>] kernel_power_off+0x35/0x80
[58018.330980] [<ffffffff810bdc33>] SyS_reboot+0x233/0x260
[58018.336919] [<ffffffff810de239>] ? cpuacct_account_field+0x99/0xb0
[58018.343929] [<ffffffff810de1a5>] ? cpuacct_account_field+0x5/0xb0
[58018.350843] [<ffffffff81f86327>] ? _raw_spin_unlock+0x27/0x30
[58018.357378] [<ffffffff810e3446>] ? trace_hardirqs_on_caller+0x16/0x260
[58018.364774] [<ffffffff810e369d>] ? trace_hardirqs_on+0xd/0x10
[58018.371302] [<ffffffff8105c83c>] ? syscall_trace_enter+0x17c/0x1c0
[58018.378312] [<ffffffff81f870aa>] tracesys+0xd4/0xd9
[58018.383867] ---[ end trace fade991312a6a2d9 ]---
[58018.389026] free irq_desc for 23

Like to suggest attached patch that skip mp_unregister_gsi on shutdown path.

Thanks

Yinghai
---
arch/x86/kernel/acpi/boot.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -659,6 +659,12 @@ static int acpi_register_gsi_ioapic(stru
static void acpi_unregister_gsi_ioapic(u32 gsi)
{
#ifdef CONFIG_X86_IO_APIC
+ /* should not worry about shutdown path */
+ if (system_state == SYSTEM_HALT ||
+ system_state == SYSTEM_POWER_OFF ||
+ system_state == SYSTEM_RESTART)
+ return;
+
mp_unregister_gsi(gsi);
#endif
}