public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] mfd: rtsx: release IRQ during shutdown
@ 2018-01-03 12:32 Sinan Kaya
  2018-01-03 12:54 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sinan Kaya @ 2018-01-03 12:32 UTC (permalink / raw)
  To: lee.jones, timur
  Cc: chris2553, linux-pci, linux-acpi, bhelgaas, rjw, Sinan Kaya,
	linux-kernel

'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during
shutdown")' revealed a resource leak in rtsx_pci driver during shutdown.

Issue shows up as a warning during shutdown as follows:

remove_proc_entry: removing non-empty directory 'irq/17', leaking at least
'rtsx_pci'
WARNING: CPU: 0 PID: 1578 at fs/proc/generic.c:572
remove_proc_entry+0x11d/0x130
Modules linked in <long list but none that are out-of-tree>
...
Call Trace:
unregister_irq_proc
free_desc
irq_free_descs
mp_unmap_irq
acpi_unregister_gsi_apic
acpi_pci_irq_disable
do_pci_disable_device
pci_disable_device
device_shutdown
kernel_restart
Sys_reboot

Even though rtsx_pci driver implements a shutdown callback, it is not
releasing the interrupt that it registered during probe. This is causing
the ACPI layer to complain that the shared IRQ is in use while freeing
IRQ.

This code releases the IRQ to prevent resource leak and eliminate the
warning.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=198141
Reported-by: Chris Clayton <chris2553@googlemail.com>
Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/mfd/rtsx_pcr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 590fb9a..c3ed885 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -1543,6 +1543,9 @@ static void rtsx_pci_shutdown(struct pci_dev *pcidev)
 	rtsx_pci_power_off(pcr, HOST_ENTER_S1);
 
 	pci_disable_device(pcidev);
+	free_irq(pcr->irq, (void *)pcr);
+	if (pcr->msi_en)
+		pci_disable_msi(pcr->pci);
 }
 
 #else /* CONFIG_PM */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] mfd: rtsx: release IRQ during shutdown
  2018-01-03 12:32 [PATCH V2] mfd: rtsx: release IRQ during shutdown Sinan Kaya
@ 2018-01-03 12:54 ` Rafael J. Wysocki
  2018-01-03 16:34 ` Chris Clayton
  2018-01-05 14:22 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2018-01-03 12:54 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: Lee Jones, Timur Tabi, chris2553, Linux PCI,
	ACPI Devel Maling List, Bjorn Helgaas, Rafael J. Wysocki,
	Linux Kernel Mailing List

On Wed, Jan 3, 2018 at 1:32 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
> 'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during
> shutdown")' revealed a resource leak in rtsx_pci driver during shutdown.
>
> Issue shows up as a warning during shutdown as follows:
>
> remove_proc_entry: removing non-empty directory 'irq/17', leaking at least
> 'rtsx_pci'
> WARNING: CPU: 0 PID: 1578 at fs/proc/generic.c:572
> remove_proc_entry+0x11d/0x130
> Modules linked in <long list but none that are out-of-tree>
> ...
> Call Trace:
> unregister_irq_proc
> free_desc
> irq_free_descs
> mp_unmap_irq
> acpi_unregister_gsi_apic
> acpi_pci_irq_disable
> do_pci_disable_device
> pci_disable_device
> device_shutdown
> kernel_restart
> Sys_reboot
>
> Even though rtsx_pci driver implements a shutdown callback, it is not
> releasing the interrupt that it registered during probe. This is causing
> the ACPI layer to complain that the shared IRQ is in use while freeing
> IRQ.
>
> This code releases the IRQ to prevent resource leak and eliminate the
> warning.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198141
> Reported-by: Chris Clayton <chris2553@googlemail.com>
> Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/mfd/rtsx_pcr.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
> index 590fb9a..c3ed885 100644
> --- a/drivers/mfd/rtsx_pcr.c
> +++ b/drivers/mfd/rtsx_pcr.c
> @@ -1543,6 +1543,9 @@ static void rtsx_pci_shutdown(struct pci_dev *pcidev)
>         rtsx_pci_power_off(pcr, HOST_ENTER_S1);
>
>         pci_disable_device(pcidev);
> +       free_irq(pcr->irq, (void *)pcr);
> +       if (pcr->msi_en)
> +               pci_disable_msi(pcr->pci);
>  }
>
>  #else /* CONFIG_PM */
> --

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] mfd: rtsx: release IRQ during shutdown
  2018-01-03 12:32 [PATCH V2] mfd: rtsx: release IRQ during shutdown Sinan Kaya
  2018-01-03 12:54 ` Rafael J. Wysocki
@ 2018-01-03 16:34 ` Chris Clayton
  2018-01-05 14:22 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Clayton @ 2018-01-03 16:34 UTC (permalink / raw)
  To: Sinan Kaya, lee.jones, timur
  Cc: linux-pci, linux-acpi, bhelgaas, rjw, linux-kernel



On 03/01/18 12:32, Sinan Kaya wrote:
> 'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during
> shutdown")' revealed a resource leak in rtsx_pci driver during shutdown.
> 
> Issue shows up as a warning during shutdown as follows:
> 
> remove_proc_entry: removing non-empty directory 'irq/17', leaking at least
> 'rtsx_pci'
> WARNING: CPU: 0 PID: 1578 at fs/proc/generic.c:572
> remove_proc_entry+0x11d/0x130
> Modules linked in <long list but none that are out-of-tree>
> ...
> Call Trace:
> unregister_irq_proc
> free_desc
> irq_free_descs
> mp_unmap_irq
> acpi_unregister_gsi_apic
> acpi_pci_irq_disable
> do_pci_disable_device
> pci_disable_device
> device_shutdown
> kernel_restart
> Sys_reboot
> 
> Even though rtsx_pci driver implements a shutdown callback, it is not
> releasing the interrupt that it registered during probe. This is causing
> the ACPI layer to complain that the shared IRQ is in use while freeing
> IRQ.
> 
> This code releases the IRQ to prevent resource leak and eliminate the
> warning.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198141
> Reported-by: Chris Clayton <chris2553@googlemail.com>
> Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/mfd/rtsx_pcr.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
> index 590fb9a..c3ed885 100644
> --- a/drivers/mfd/rtsx_pcr.c
> +++ b/drivers/mfd/rtsx_pcr.c
> @@ -1543,6 +1543,9 @@ static void rtsx_pci_shutdown(struct pci_dev *pcidev)
>  	rtsx_pci_power_off(pcr, HOST_ENTER_S1);
>  
>  	pci_disable_device(pcidev);
> +	free_irq(pcr->irq, (void *)pcr);
> +	if (pcr->msi_en)
> +		pci_disable_msi(pcr->pci);
>  }
>  
>  #else /* CONFIG_PM */

I've applied v2 of the patch and built and installed the kernel (-rc6). All I can say, is that my system still closes
down without the warning and call trace that the unpatched kernel produces. It's the best I can do by way of a test
because I have no idea what the code added in v2 is supposed to achieve and, because my system shuts down (or reboots)
moments later, there is no opportunity to check. If that constitutes a valid test:

Tested-by: Chris Clayton <chris2553@googlemail.com>

> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] mfd: rtsx: release IRQ during shutdown
  2018-01-03 12:32 [PATCH V2] mfd: rtsx: release IRQ during shutdown Sinan Kaya
  2018-01-03 12:54 ` Rafael J. Wysocki
  2018-01-03 16:34 ` Chris Clayton
@ 2018-01-05 14:22 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2018-01-05 14:22 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: timur, chris2553, linux-pci, linux-acpi, bhelgaas, rjw,
	linux-kernel

On Wed, 03 Jan 2018, Sinan Kaya wrote:

> 'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during
> shutdown")' revealed a resource leak in rtsx_pci driver during shutdown.
> 
> Issue shows up as a warning during shutdown as follows:
> 
> remove_proc_entry: removing non-empty directory 'irq/17', leaking at least
> 'rtsx_pci'
> WARNING: CPU: 0 PID: 1578 at fs/proc/generic.c:572
> remove_proc_entry+0x11d/0x130
> Modules linked in <long list but none that are out-of-tree>
> ...
> Call Trace:
> unregister_irq_proc
> free_desc
> irq_free_descs
> mp_unmap_irq
> acpi_unregister_gsi_apic
> acpi_pci_irq_disable
> do_pci_disable_device
> pci_disable_device
> device_shutdown
> kernel_restart
> Sys_reboot
> 
> Even though rtsx_pci driver implements a shutdown callback, it is not
> releasing the interrupt that it registered during probe. This is causing
> the ACPI layer to complain that the shared IRQ is in use while freeing
> IRQ.
> 
> This code releases the IRQ to prevent resource leak and eliminate the
> warning.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198141
> Reported-by: Chris Clayton <chris2553@googlemail.com>
> Fixes: cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/mfd/rtsx_pcr.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-05 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-03 12:32 [PATCH V2] mfd: rtsx: release IRQ during shutdown Sinan Kaya
2018-01-03 12:54 ` Rafael J. Wysocki
2018-01-03 16:34 ` Chris Clayton
2018-01-05 14:22 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox