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

2014-06-26 Thread Yinghai Lu
On Sat, Jun 21, 2014 at 2:08 PM, Thomas Gleixner  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]  0009 885e759bfb60 81f76520
885e759bfba8
[58018.188033]  885e759bfb98 8109d03d 88edf9fb9f00
0002
[58018.196358]  885e759bfc6e 88f07b3f4330 88edf9fb9fb9
885e759bfbf8
[58018.204682] Call Trace:
[58018.207432]  [] dump_stack+0x45/0x56
[58018.213186]  [] warn_slowpath_common+0x7d/0xa0
[58018.219903]  [] warn_slowpath_fmt+0x4c/0x50
[58018.226336]  [] remove_proc_entry+0x150/0x1a0
[58018.232963]  [] unregister_irq_proc+0xbf/0xd0
[58018.239589]  [] free_desc+0x31/0xa0
[58018.245240]  [] irq_free_descs+0x6c/0x80
[58018.251375]  [] irq_dispose_mapping+0x53/0x60
[58018.258011]  [] mp_unmap_irq+0xa0/0xc0
[58018.263960]  [] acpi_unregister_gsi_ioapic+0x2f/0x40
[58018.271263]  [] acpi_unregister_gsi+0x17/0x20
[58018.277896]  [] acpi_pci_irq_disable+0x5e/0x68
[58018.284619]  [] pcibios_disable_device+0x20/0x30
[58018.291536]  [] do_pci_disable_device+0x52/0x60
[58018.298350]  [] pci_disable_device+0x92/0xb0
[58018.304876]  [] usb_hcd_pci_shutdown+0x3f/0x50
[58018.311593]  [] pci_device_shutdown+0x36/0x70
[58018.318220]  [] device_shutdown+0x135/0x190
[58018.324651]  [] kernel_power_off+0x35/0x80
[58018.330980]  [] SyS_reboot+0x233/0x260
[58018.336919]  [] ? cpuacct_account_field+0x99/0xb0
[58018.343929]  [] ? cpuacct_account_field+0x5/0xb0
[58018.350843]  [] ? _raw_spin_unlock+0x27/0x30
[58018.357378]  [] ? trace_hardirqs_on_caller+0x16/0x260
[58018.364774]  [] ? trace_hardirqs_on+0xd/0x10
[58018.371302]  [] ? syscall_trace_enter+0x17c/0x1c0
[58018.378312]  [] 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
 }


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

2014-06-22 Thread Feng Tang
On Sun, Jun 22, 2014 at 10:39:46PM +0800, Feng Tang wrote:
> Hi,
> 
> On Sun, Jun 22, 2014 at 04:42:27PM +0800, Ingo Molnar wrote:
> > 
> > JFYI, with these patches applied x86 allyes32config fails with:
> > 
> >   arch/x86/platform/intel-mid/device_libs/platform_wdt.c:45:3: error: 
> > implicit declaration of function ‘io_apic_set_pci_routing’ 
> 
> In some intel-mid platforms (Medfield/Merrifield etc), the IOAPIC
> may have more than 80 pins, and some devices like a i2c based touch
> screen has its interrupt line directly connected to IOAPIC (this
> platform_wdt.c here should be the same case).
> 
> Since these devices are not PCI device or ACPI device, they can't
> use the general PCI/ACPI xxx_enable_dev APIs which implicitly set
> up the ioapic entry, but use this "io_apic_set_pci_routing"
> directly.

Just quickly read Jiang's patch set, guess these driver should be ok
by using Jiang's new cleaner API "mp_set_gsi_attr()" to replace these
io_apic_set_pci_routing().

Thanks,
Feng
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-06-22 Thread Feng Tang
Hi,

On Sun, Jun 22, 2014 at 04:42:27PM +0800, Ingo Molnar wrote:
> 
> JFYI, with these patches applied x86 allyes32config fails with:
> 
>   arch/x86/platform/intel-mid/device_libs/platform_wdt.c:45:3: error: 
> implicit declaration of function ‘io_apic_set_pci_routing’ 

In some intel-mid platforms (Medfield/Merrifield etc), the IOAPIC
may have more than 80 pins, and some devices like a i2c based touch
screen has its interrupt line directly connected to IOAPIC (this
platform_wdt.c here should be the same case).

Since these devices are not PCI device or ACPI device, they can't
use the general PCI/ACPI xxx_enable_dev APIs which implicitly set
up the ioapic entry, but use this "io_apic_set_pci_routing"
directly.

Thanks,
Feng

> 
> Thanks,
> 
>   Ingo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-06-22 Thread Ingo Molnar

JFYI, with these patches applied x86 allyes32config fails with:

  arch/x86/platform/intel-mid/device_libs/platform_wdt.c:45:3: error: implicit 
declaration of function ‘io_apic_set_pci_routing’ 

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-06-21 Thread Thomas Gleixner
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!

Thanks,

tglx


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/