All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero
@ 2017-03-14  9:44 Adrian Hunter
  2017-03-14 13:03 ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian Hunter @ 2017-03-14  9:44 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-pm, linux-acpi, Rafael J. Wysocki, Lukas Wunner,
	Andy Shevchenko, Mika Westerberg

Do not sleep at all for the respective cases of d3_delay is zero or
d3cold_delay is zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7904d02ffdb9..9779483f81fd 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
 	if (delay < pci_pm_d3_delay)
 		delay = pci_pm_d3_delay;
 
-	msleep(delay);
+	if (delay)
+		msleep(delay);
 }
 
 #ifdef CONFIG_PCI_DOMAINS
@@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
 		 * because have already delayed for the bridge.
 		 */
 		if (dev->runtime_d3cold) {
-			msleep(dev->d3cold_delay);
+			if (dev->d3cold_delay)
+				msleep(dev->d3cold_delay);
 			/*
 			 * When powering on a bridge from D3cold, the
 			 * whole hierarchy may be powered on into
-- 
1.9.1


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

* Re: [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero
  2017-03-14  9:44 [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero Adrian Hunter
@ 2017-03-14 13:03 ` Bjorn Helgaas
  2017-03-14 13:21   ` Adrian Hunter
  0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2017-03-14 13:03 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: linux-pci, linux-pm, linux-acpi, Rafael J. Wysocki, Lukas Wunner,
	Andy Shevchenko, Mika Westerberg

Hi Adrian,

On Tue, Mar 14, 2017 at 11:44:56AM +0200, Adrian Hunter wrote:
> Do not sleep at all for the respective cases of d3_delay is zero or
> d3cold_delay is zero.

Can you please include a hint here about (1) what msleep() does with an
argument of zero, and (2) why this change is desirable, e.g., maybe it
makes suspend/resume faster or something?

> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/pci/pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7904d02ffdb9..9779483f81fd 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
>  	if (delay < pci_pm_d3_delay)
>  		delay = pci_pm_d3_delay;
>  
> -	msleep(delay);
> +	if (delay)
> +		msleep(delay);
>  }
>  
>  #ifdef CONFIG_PCI_DOMAINS
> @@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>  		 * because have already delayed for the bridge.
>  		 */
>  		if (dev->runtime_d3cold) {
> -			msleep(dev->d3cold_delay);
> +			if (dev->d3cold_delay)
> +				msleep(dev->d3cold_delay);
>  			/*
>  			 * When powering on a bridge from D3cold, the
>  			 * whole hierarchy may be powered on into
> -- 
> 1.9.1
> 

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

* [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero
  2017-03-14 13:03 ` Bjorn Helgaas
@ 2017-03-14 13:21   ` Adrian Hunter
  2017-03-14 13:23     ` Adrian Hunter
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Adrian Hunter @ 2017-03-14 13:21 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-pm, linux-acpi, Rafael J. Wysocki, Lukas Wunner,
	Andy Shevchenko, Mika Westerberg

msleep() still sleeps 1 jiffy even when told to sleep for zero
milliseconds. That can end up being 1-2 milliseconds or more. In the cases
of d3_delay and d3cold_delay, that unnecessarily increases suspend and/or
resume latencies.

So, do not sleep at all for the respective cases of d3_delay is zero or
d3cold_delay is zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7904d02ffdb9..9779483f81fd 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
 	if (delay < pci_pm_d3_delay)
 		delay = pci_pm_d3_delay;
 
-	msleep(delay);
+	if (delay)
+		msleep(delay);
 }
 
 #ifdef CONFIG_PCI_DOMAINS
@@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
 		 * because have already delayed for the bridge.
 		 */
 		if (dev->runtime_d3cold) {
-			msleep(dev->d3cold_delay);
+			if (dev->d3cold_delay)
+				msleep(dev->d3cold_delay);
 			/*
 			 * When powering on a bridge from D3cold, the
 			 * whole hierarchy may be powered on into
-- 
1.9.1

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

* Re: [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero
  2017-03-14 13:21   ` Adrian Hunter
@ 2017-03-14 13:23     ` Adrian Hunter
  2017-03-14 17:52     ` Rafael J. Wysocki
  2017-03-14 20:04     ` Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2017-03-14 13:23 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-pm, linux-acpi, Rafael J. Wysocki, Lukas Wunner,
	Andy Shevchenko, Mika Westerberg

Forgot to put this is V2, sorry.  It has changes to the commit message as
requested.

On 14/03/17 15:21, Adrian Hunter wrote:
> msleep() still sleeps 1 jiffy even when told to sleep for zero
> milliseconds. That can end up being 1-2 milliseconds or more. In the cases
> of d3_delay and d3cold_delay, that unnecessarily increases suspend and/or
> resume latencies.
> 
> So, do not sleep at all for the respective cases of d3_delay is zero or
> d3cold_delay is zero.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/pci/pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7904d02ffdb9..9779483f81fd 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
>  	if (delay < pci_pm_d3_delay)
>  		delay = pci_pm_d3_delay;
>  
> -	msleep(delay);
> +	if (delay)
> +		msleep(delay);
>  }
>  
>  #ifdef CONFIG_PCI_DOMAINS
> @@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>  		 * because have already delayed for the bridge.
>  		 */
>  		if (dev->runtime_d3cold) {
> -			msleep(dev->d3cold_delay);
> +			if (dev->d3cold_delay)
> +				msleep(dev->d3cold_delay);
>  			/*
>  			 * When powering on a bridge from D3cold, the
>  			 * whole hierarchy may be powered on into
> 


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

* Re: [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero
  2017-03-14 13:21   ` Adrian Hunter
  2017-03-14 13:23     ` Adrian Hunter
@ 2017-03-14 17:52     ` Rafael J. Wysocki
  2017-03-14 20:04     ` Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2017-03-14 17:52 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Bjorn Helgaas, linux-pci, linux-pm, linux-acpi,
	Rafael J. Wysocki, Lukas Wunner, Andy Shevchenko,
	Mika Westerberg

On Tue, Mar 14, 2017 at 2:21 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> msleep() still sleeps 1 jiffy even when told to sleep for zero
> milliseconds. That can end up being 1-2 milliseconds or more. In the cases
> of d3_delay and d3cold_delay, that unnecessarily increases suspend and/or
> resume latencies.
>
> So, do not sleep at all for the respective cases of d3_delay is zero or
> d3cold_delay is zero.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

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

> ---
>  drivers/pci/pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7904d02ffdb9..9779483f81fd 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
>         if (delay < pci_pm_d3_delay)
>                 delay = pci_pm_d3_delay;
>
> -       msleep(delay);
> +       if (delay)
> +               msleep(delay);
>  }
>
>  #ifdef CONFIG_PCI_DOMAINS
> @@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>                  * because have already delayed for the bridge.
>                  */
>                 if (dev->runtime_d3cold) {
> -                       msleep(dev->d3cold_delay);
> +                       if (dev->d3cold_delay)
> +                               msleep(dev->d3cold_delay);
>                         /*
>                          * When powering on a bridge from D3cold, the
>                          * whole hierarchy may be powered on into
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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: For d3_delay and d3cold_delay, zero means zero
  2017-03-14 13:21   ` Adrian Hunter
  2017-03-14 13:23     ` Adrian Hunter
  2017-03-14 17:52     ` Rafael J. Wysocki
@ 2017-03-14 20:04     ` Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2017-03-14 20:04 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: linux-pci, linux-pm, linux-acpi, Rafael J. Wysocki, Lukas Wunner,
	Andy Shevchenko, Mika Westerberg

On Tue, Mar 14, 2017 at 03:21:58PM +0200, Adrian Hunter wrote:
> msleep() still sleeps 1 jiffy even when told to sleep for zero
> milliseconds. That can end up being 1-2 milliseconds or more. In the cases
> of d3_delay and d3cold_delay, that unnecessarily increases suspend and/or
> resume latencies.
> 
> So, do not sleep at all for the respective cases of d3_delay is zero or
> d3cold_delay is zero.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Applied with Rafael's ack to pci/pm for v4.12, thanks!

> ---
>  drivers/pci/pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7904d02ffdb9..9779483f81fd 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -66,7 +66,8 @@ static void pci_dev_d3_sleep(struct pci_dev *dev)
>  	if (delay < pci_pm_d3_delay)
>  		delay = pci_pm_d3_delay;
>  
> -	msleep(delay);
> +	if (delay)
> +		msleep(delay);
>  }
>  
>  #ifdef CONFIG_PCI_DOMAINS
> @@ -827,7 +828,8 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
>  		 * because have already delayed for the bridge.
>  		 */
>  		if (dev->runtime_d3cold) {
> -			msleep(dev->d3cold_delay);
> +			if (dev->d3cold_delay)
> +				msleep(dev->d3cold_delay);
>  			/*
>  			 * When powering on a bridge from D3cold, the
>  			 * whole hierarchy may be powered on into
> -- 
> 1.9.1
> 

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

end of thread, other threads:[~2017-03-14 20:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14  9:44 [PATCH] PCI: For d3_delay and d3cold_delay, zero means zero Adrian Hunter
2017-03-14 13:03 ` Bjorn Helgaas
2017-03-14 13:21   ` Adrian Hunter
2017-03-14 13:23     ` Adrian Hunter
2017-03-14 17:52     ` Rafael J. Wysocki
2017-03-14 20:04     ` Bjorn Helgaas

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.