All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix bridge_d3 update on device removal
@ 2016-09-06  4:20 Lukas Wunner
  2016-09-07 15:47 ` Mika Westerberg
  2016-09-13 21:02 ` Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Lukas Wunner @ 2016-09-06  4:20 UTC (permalink / raw)
  To: linux-pci; +Cc: Mika Westerberg, Rafael J. Wysocki

Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
the port itself and its children satisfy a number of conditions.  Once a
child is removed, we recheck those conditions in case the removed device
was blocking the port from suspending.

The rechecking needs to happen *after* the device has been removed from
the bus it resides on.  Otherwise when walking the port's subordinate
bus in pci_bridge_d3_update(), the device being removed would
erroneously still be taken into account.

However the device is removed from the bus_list in pci_destroy_dev() and
we currently recheck *before* that.  Fix it.

Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/pci/remove.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index d1ef7ac..f9357e0 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -40,6 +40,7 @@ static void pci_destroy_dev(struct pci_dev *dev)
 	list_del(&dev->bus_list);
 	up_write(&pci_bus_sem);
 
+	pci_bridge_d3_device_removed(dev);
 	pci_free_resources(dev);
 	put_device(&dev->dev);
 }
@@ -96,8 +97,6 @@ static void pci_remove_bus_device(struct pci_dev *dev)
 		dev->subordinate = NULL;
 	}
 
-	pci_bridge_d3_device_removed(dev);
-
 	pci_destroy_dev(dev);
 }
 
-- 
2.9.3


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

* Re: [PATCH] PCI: Fix bridge_d3 update on device removal
  2016-09-06  4:20 [PATCH] PCI: Fix bridge_d3 update on device removal Lukas Wunner
@ 2016-09-07 15:47 ` Mika Westerberg
  2016-09-07 16:07   ` Rafael J. Wysocki
  2016-09-13 21:02 ` Bjorn Helgaas
  1 sibling, 1 reply; 6+ messages in thread
From: Mika Westerberg @ 2016-09-07 15:47 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: linux-pci, Rafael J. Wysocki

On Tue, Sep 06, 2016 at 06:20:46AM +0200, Lukas Wunner wrote:
> Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
> the port itself and its children satisfy a number of conditions.  Once a
> child is removed, we recheck those conditions in case the removed device
> was blocking the port from suspending.
> 
> The rechecking needs to happen *after* the device has been removed from
> the bus it resides on.  Otherwise when walking the port's subordinate
> bus in pci_bridge_d3_update(), the device being removed would
> erroneously still be taken into account.
> 
> However the device is removed from the bus_list in pci_destroy_dev() and
> we currently recheck *before* that.  Fix it.

Yes, makes sense.

> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH] PCI: Fix bridge_d3 update on device removal
  2016-09-07 15:47 ` Mika Westerberg
@ 2016-09-07 16:07   ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2016-09-07 16:07 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Lukas Wunner, linux-pci, Rafael J. Wysocki, Bjorn Helgaas

On Wednesday, September 07, 2016 06:47:19 PM Mika Westerberg wrote:
> On Tue, Sep 06, 2016 at 06:20:46AM +0200, Lukas Wunner wrote:
> > Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
> > the port itself and its children satisfy a number of conditions.  Once a
> > child is removed, we recheck those conditions in case the removed device
> > was blocking the port from suspending.
> > 
> > The rechecking needs to happen *after* the device has been removed from
> > the bus it resides on.  Otherwise when walking the port's subordinate
> > bus in pci_bridge_d3_update(), the device being removed would
> > erroneously still be taken into account.
> > 
> > However the device is removed from the bus_list in pci_destroy_dev() and
> > we currently recheck *before* that.  Fix it.
> 
> Yes, makes sense.
> 
> > Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Acked-by: Rafael J. Wysocki <mika.westerberg@linux.intel.com>

Thanks!


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

* Re: [PATCH] PCI: Fix bridge_d3 update on device removal
  2016-09-06  4:20 [PATCH] PCI: Fix bridge_d3 update on device removal Lukas Wunner
  2016-09-07 15:47 ` Mika Westerberg
@ 2016-09-13 21:02 ` Bjorn Helgaas
  2016-09-13 21:03   ` Rafael J. Wysocki
  2016-09-13 21:13   ` Lukas Wunner
  1 sibling, 2 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2016-09-13 21:02 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: linux-pci, Mika Westerberg, Rafael J. Wysocki

On Tue, Sep 06, 2016 at 06:20:46AM +0200, Lukas Wunner wrote:
> Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
> the port itself and its children satisfy a number of conditions.  Once a
> child is removed, we recheck those conditions in case the removed device
> was blocking the port from suspending.
> 
> The rechecking needs to happen *after* the device has been removed from
> the bus it resides on.  Otherwise when walking the port's subordinate
> bus in pci_bridge_d3_update(), the device being removed would
> erroneously still be taken into account.
> 
> However the device is removed from the bus_list in pci_destroy_dev() and
> we currently recheck *before* that.  Fix it.
> 
> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

9d26d3a8f1b0 appeared in v4.8-rc1, so I assume this fix should be merged
before v4.8, right?

I applied it to for-linus with Mika's reviewed-by and Rafael's acked-by on
that assumption.

> ---
>  drivers/pci/remove.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
> index d1ef7ac..f9357e0 100644
> --- a/drivers/pci/remove.c
> +++ b/drivers/pci/remove.c
> @@ -40,6 +40,7 @@ static void pci_destroy_dev(struct pci_dev *dev)
>  	list_del(&dev->bus_list);
>  	up_write(&pci_bus_sem);
>  
> +	pci_bridge_d3_device_removed(dev);
>  	pci_free_resources(dev);
>  	put_device(&dev->dev);
>  }
> @@ -96,8 +97,6 @@ static void pci_remove_bus_device(struct pci_dev *dev)
>  		dev->subordinate = NULL;
>  	}
>  
> -	pci_bridge_d3_device_removed(dev);
> -
>  	pci_destroy_dev(dev);
>  }
>  
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] PCI: Fix bridge_d3 update on device removal
  2016-09-13 21:02 ` Bjorn Helgaas
@ 2016-09-13 21:03   ` Rafael J. Wysocki
  2016-09-13 21:13   ` Lukas Wunner
  1 sibling, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2016-09-13 21:03 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Lukas Wunner, linux-pci, Mika Westerberg

On 9/13/2016 11:02 PM, Bjorn Helgaas wrote:
> On Tue, Sep 06, 2016 at 06:20:46AM +0200, Lukas Wunner wrote:
>> Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
>> the port itself and its children satisfy a number of conditions.  Once a
>> child is removed, we recheck those conditions in case the removed device
>> was blocking the port from suspending.
>>
>> The rechecking needs to happen *after* the device has been removed from
>> the bus it resides on.  Otherwise when walking the port's subordinate
>> bus in pci_bridge_d3_update(), the device being removed would
>> erroneously still be taken into account.
>>
>> However the device is removed from the bus_list in pci_destroy_dev() and
>> we currently recheck *before* that.  Fix it.
>>
>> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
>> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
>> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> 9d26d3a8f1b0 appeared in v4.8-rc1, so I assume this fix should be merged
> before v4.8, right?

Yup.

> I applied it to for-linus with Mika's reviewed-by and Rafael's acked-by on
> that assumption.

Cool, thanks!

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

* Re: [PATCH] PCI: Fix bridge_d3 update on device removal
  2016-09-13 21:02 ` Bjorn Helgaas
  2016-09-13 21:03   ` Rafael J. Wysocki
@ 2016-09-13 21:13   ` Lukas Wunner
  1 sibling, 0 replies; 6+ messages in thread
From: Lukas Wunner @ 2016-09-13 21:13 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, Mika Westerberg, Rafael J. Wysocki

On Tue, Sep 13, 2016 at 04:02:31PM -0500, Bjorn Helgaas wrote:
> On Tue, Sep 06, 2016 at 06:20:46AM +0200, Lukas Wunner wrote:
> > Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
> > the port itself and its children satisfy a number of conditions.  Once a
> > child is removed, we recheck those conditions in case the removed device
> > was blocking the port from suspending.
> > 
> > The rechecking needs to happen *after* the device has been removed from
> > the bus it resides on.  Otherwise when walking the port's subordinate
> > bus in pci_bridge_d3_update(), the device being removed would
> > erroneously still be taken into account.
> > 
> > However the device is removed from the bus_list in pci_destroy_dev() and
> > we currently recheck *before* that.  Fix it.
> > 
> > Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> 
> 9d26d3a8f1b0 appeared in v4.8-rc1, so I assume this fix should be merged
> before v4.8, right?

Yes, it's a bug in the new runtime PM code for PCIe ports,
albeit a relatively harmless one:  I think the worst that
can happen is that a port which should suspend doesn't.

But it's still a bug, so if this could still go into 4.8
it would be ideal.

> I applied it to for-linus with Mika's reviewed-by and Rafael's acked-by on
> that assumption.

Perfect, thanks!

Lukas

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

end of thread, other threads:[~2016-09-13 21:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06  4:20 [PATCH] PCI: Fix bridge_d3 update on device removal Lukas Wunner
2016-09-07 15:47 ` Mika Westerberg
2016-09-07 16:07   ` Rafael J. Wysocki
2016-09-13 21:02 ` Bjorn Helgaas
2016-09-13 21:03   ` Rafael J. Wysocki
2016-09-13 21:13   ` Lukas Wunner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.