All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition
@ 2021-12-24  8:19 Kai-Heng Feng
  2021-12-24  8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kai-Heng Feng @ 2021-12-24  8:19 UTC (permalink / raw)
  To: m.chetan.kumar, linuxwwan
  Cc: linux-pci, linux-pm, Kai-Heng Feng, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel

pci_pm_suspend_noirq() and pci_pm_resume_noirq() already handle power
transition for system-wide suspend and resume, so it's not necessary to
do it in the driver.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/net/wwan/iosm/iosm_ipc_pcie.c | 49 ++-------------------------
 1 file changed, 2 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
index 2fe88b8be3481..d73894e2a84ed 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
@@ -363,67 +363,22 @@ static int __maybe_unused ipc_pcie_resume_s2idle(struct iosm_pcie *ipc_pcie)
 
 int __maybe_unused ipc_pcie_suspend(struct iosm_pcie *ipc_pcie)
 {
-	struct pci_dev *pdev;
-	int ret;
-
-	pdev = ipc_pcie->pci;
-
-	/* Execute D3 one time. */
-	if (pdev->current_state != PCI_D0) {
-		dev_dbg(ipc_pcie->dev, "done for PM=%d", pdev->current_state);
-		return 0;
-	}
-
 	/* The HAL shall ask the shared memory layer whether D3 is allowed. */
 	ipc_imem_pm_suspend(ipc_pcie->imem);
 
-	/* Save the PCI configuration space of a device before suspending. */
-	ret = pci_save_state(pdev);
-
-	if (ret) {
-		dev_err(ipc_pcie->dev, "pci_save_state error=%d", ret);
-		return ret;
-	}
-
-	/* Set the power state of a PCI device.
-	 * Transition a device to a new power state, using the device's PCI PM
-	 * registers.
-	 */
-	ret = pci_set_power_state(pdev, PCI_D3cold);
-
-	if (ret) {
-		dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
-		return ret;
-	}
-
 	dev_dbg(ipc_pcie->dev, "SUSPEND done");
-	return ret;
+	return 0;
 }
 
 int __maybe_unused ipc_pcie_resume(struct iosm_pcie *ipc_pcie)
 {
-	int ret;
-
-	/* Set the power state of a PCI device.
-	 * Transition a device to a new power state, using the device's PCI PM
-	 * registers.
-	 */
-	ret = pci_set_power_state(ipc_pcie->pci, PCI_D0);
-
-	if (ret) {
-		dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
-		return ret;
-	}
-
-	pci_restore_state(ipc_pcie->pci);
-
 	/* The HAL shall inform the shared memory layer that the device is
 	 * active.
 	 */
 	ipc_imem_pm_resume(ipc_pcie->imem);
 
 	dev_dbg(ipc_pcie->dev, "RESUME done");
-	return ret;
+	return 0;
 }
 
 static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
-- 
2.33.1


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

* [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2021-12-24  8:19 [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition Kai-Heng Feng
@ 2021-12-24  8:19 ` Kai-Heng Feng
  2021-12-29 20:18   ` Bjorn Helgaas
  2021-12-27 12:30 ` [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition patchwork-bot+netdevbpf
  2021-12-29 20:12 ` Bjorn Helgaas
  2 siblings, 1 reply; 10+ messages in thread
From: Kai-Heng Feng @ 2021-12-24  8:19 UTC (permalink / raw)
  To: m.chetan.kumar, linuxwwan
  Cc: linux-pci, linux-pm, Kai-Heng Feng, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel

We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD laptops.
This prevent those laptops to stay in s2idle state.

From what I can understand, the intention of ipc_pcie_suspend() is to
put the device to D3cold, and ipc_pcie_suspend_s2idle() is to keep the
device at D0. However, the device can still be put to D3hot/D3cold by
PCI core.

So explicitly let PCI core know this device should stay at D0, to solve
the spurious wakeup.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/net/wwan/iosm/iosm_ipc_pcie.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
index d73894e2a84ed..af1d0e837fe99 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
@@ -340,6 +340,9 @@ static int __maybe_unused ipc_pcie_suspend_s2idle(struct iosm_pcie *ipc_pcie)
 
 	ipc_imem_pm_s2idle_sleep(ipc_pcie->imem, true);
 
+	/* Let PCI core know this device should stay at D0 */
+	pci_save_state(ipc_pcie->pci);
+
 	return 0;
 }
 
-- 
2.33.1


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

* Re: [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition
  2021-12-24  8:19 [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition Kai-Heng Feng
  2021-12-24  8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
@ 2021-12-27 12:30 ` patchwork-bot+netdevbpf
  2021-12-29 20:12 ` Bjorn Helgaas
  2 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-27 12:30 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: m.chetan.kumar, linuxwwan, linux-pci, linux-pm, loic.poulain,
	ryazanov.s.a, johannes, davem, kuba, netdev, linux-kernel

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 24 Dec 2021 16:19:13 +0800 you wrote:
> pci_pm_suspend_noirq() and pci_pm_resume_noirq() already handle power
> transition for system-wide suspend and resume, so it's not necessary to
> do it in the driver.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 49 ++-------------------------
>  1 file changed, 2 insertions(+), 47 deletions(-)

Here is the summary with links:
  - [1/2] net: wwan: iosm: Let PCI core handle PCI power transition
    https://git.kernel.org/netdev/net-next/c/8f58e29ed7fc
  - [2/2] net: wwan: iosm: Keep device at D0 for s2idle case
    https://git.kernel.org/netdev/net-next/c/f4dd5174e273

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition
  2021-12-24  8:19 [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition Kai-Heng Feng
  2021-12-24  8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
  2021-12-27 12:30 ` [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition patchwork-bot+netdevbpf
@ 2021-12-29 20:12 ` Bjorn Helgaas
  2021-12-30  0:57   ` Kai-Heng Feng
  2 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2021-12-29 20:12 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: m.chetan.kumar, linuxwwan, linux-pci, linux-pm, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel, Vaibhav Gupta, Rafael J. Wysocki

[+cc Rafael, in case you have insight about the PCI_D0 question below;
Vaibhav, since this is related to your generic PM conversions]

On Fri, Dec 24, 2021 at 04:19:13PM +0800, Kai-Heng Feng wrote:
> pci_pm_suspend_noirq() and pci_pm_resume_noirq() already handle power
> transition for system-wide suspend and resume, so it's not necessary to
> do it in the driver.

I see DaveM has already applied this, but it looks good to me, thanks
for doing this!

One minor question below...

> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 49 ++-------------------------
>  1 file changed, 2 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> index 2fe88b8be3481..d73894e2a84ed 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> @@ -363,67 +363,22 @@ static int __maybe_unused ipc_pcie_resume_s2idle(struct iosm_pcie *ipc_pcie)
>  
>  int __maybe_unused ipc_pcie_suspend(struct iosm_pcie *ipc_pcie)
>  {
> -	struct pci_dev *pdev;
> -	int ret;
> -
> -	pdev = ipc_pcie->pci;
> -
> -	/* Execute D3 one time. */
> -	if (pdev->current_state != PCI_D0) {
> -		dev_dbg(ipc_pcie->dev, "done for PM=%d", pdev->current_state);
> -		return 0;
> -	}

I don't understand the intent of this early exit, and it's not obvious
to me that pci_pm_suspend_noirq() bails out early when
(pdev->current_state != PCI_D0).

>  	/* The HAL shall ask the shared memory layer whether D3 is allowed. */
>  	ipc_imem_pm_suspend(ipc_pcie->imem);
>  
> -	/* Save the PCI configuration space of a device before suspending. */
> -	ret = pci_save_state(pdev);
> -
> -	if (ret) {
> -		dev_err(ipc_pcie->dev, "pci_save_state error=%d", ret);
> -		return ret;
> -	}
> -
> -	/* Set the power state of a PCI device.
> -	 * Transition a device to a new power state, using the device's PCI PM
> -	 * registers.
> -	 */
> -	ret = pci_set_power_state(pdev, PCI_D3cold);
> -
> -	if (ret) {
> -		dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> -		return ret;
> -	}
> -
>  	dev_dbg(ipc_pcie->dev, "SUSPEND done");
> -	return ret;
> +	return 0;
>  }
>  
>  int __maybe_unused ipc_pcie_resume(struct iosm_pcie *ipc_pcie)
>  {
> -	int ret;
> -
> -	/* Set the power state of a PCI device.
> -	 * Transition a device to a new power state, using the device's PCI PM
> -	 * registers.
> -	 */
> -	ret = pci_set_power_state(ipc_pcie->pci, PCI_D0);
> -
> -	if (ret) {
> -		dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> -		return ret;
> -	}
> -
> -	pci_restore_state(ipc_pcie->pci);
> -
>  	/* The HAL shall inform the shared memory layer that the device is
>  	 * active.
>  	 */
>  	ipc_imem_pm_resume(ipc_pcie->imem);
>  
>  	dev_dbg(ipc_pcie->dev, "RESUME done");
> -	return ret;
> +	return 0;
>  }
>  
>  static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
> -- 
> 2.33.1
> 

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

* Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2021-12-24  8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
@ 2021-12-29 20:18   ` Bjorn Helgaas
  2021-12-30  1:00     ` Kai-Heng Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2021-12-29 20:18 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: m.chetan.kumar, linuxwwan, linux-pci, linux-pm, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel, Rafael J. Wysocki, Vaibhav Gupta

[+cc Rafael, Vaibhav]

On Fri, Dec 24, 2021 at 04:19:14PM +0800, Kai-Heng Feng wrote:
> We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD laptops.
> This prevent those laptops to stay in s2idle state.
> 
> From what I can understand, the intention of ipc_pcie_suspend() is to
> put the device to D3cold, and ipc_pcie_suspend_s2idle() is to keep the
> device at D0. However, the device can still be put to D3hot/D3cold by
> PCI core.
> 
> So explicitly let PCI core know this device should stay at D0, to solve
> the spurious wakeup.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> index d73894e2a84ed..af1d0e837fe99 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> @@ -340,6 +340,9 @@ static int __maybe_unused ipc_pcie_suspend_s2idle(struct iosm_pcie *ipc_pcie)
>  
>  	ipc_imem_pm_s2idle_sleep(ipc_pcie->imem, true);
>  
> +	/* Let PCI core know this device should stay at D0 */
> +	pci_save_state(ipc_pcie->pci);

This is a weird and non-obvious way to say "this device should stay at
D0".  It's also fairly expensive since pci_save_state() does a lot of
slow PCI config reads.

>  	return 0;
>  }
>  
> -- 
> 2.33.1
> 

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

* Re: [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition
  2021-12-29 20:12 ` Bjorn Helgaas
@ 2021-12-30  0:57   ` Kai-Heng Feng
  0 siblings, 0 replies; 10+ messages in thread
From: Kai-Heng Feng @ 2021-12-30  0:57 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: m.chetan.kumar, linuxwwan, linux-pci, linux-pm, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel, Vaibhav Gupta, Rafael J. Wysocki

On Thu, Dec 30, 2021 at 4:12 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> [+cc Rafael, in case you have insight about the PCI_D0 question below;
> Vaibhav, since this is related to your generic PM conversions]
>
> On Fri, Dec 24, 2021 at 04:19:13PM +0800, Kai-Heng Feng wrote:
> > pci_pm_suspend_noirq() and pci_pm_resume_noirq() already handle power
> > transition for system-wide suspend and resume, so it's not necessary to
> > do it in the driver.
>
> I see DaveM has already applied this, but it looks good to me, thanks
> for doing this!
>
> One minor question below...
>
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> >  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 49 ++-------------------------
> >  1 file changed, 2 insertions(+), 47 deletions(-)
> >
> > diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > index 2fe88b8be3481..d73894e2a84ed 100644
> > --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > @@ -363,67 +363,22 @@ static int __maybe_unused ipc_pcie_resume_s2idle(struct iosm_pcie *ipc_pcie)
> >
> >  int __maybe_unused ipc_pcie_suspend(struct iosm_pcie *ipc_pcie)
> >  {
> > -     struct pci_dev *pdev;
> > -     int ret;
> > -
> > -     pdev = ipc_pcie->pci;
> > -
> > -     /* Execute D3 one time. */
> > -     if (pdev->current_state != PCI_D0) {
> > -             dev_dbg(ipc_pcie->dev, "done for PM=%d", pdev->current_state);
> > -             return 0;
> > -     }
>
> I don't understand the intent of this early exit, and it's not obvious
> to me that pci_pm_suspend_noirq() bails out early when
> (pdev->current_state != PCI_D0).

Yes, I think this can be removed too. Please let me send v2.

Kai-Heng

>
> >       /* The HAL shall ask the shared memory layer whether D3 is allowed. */
> >       ipc_imem_pm_suspend(ipc_pcie->imem);
> >
> > -     /* Save the PCI configuration space of a device before suspending. */
> > -     ret = pci_save_state(pdev);
> > -
> > -     if (ret) {
> > -             dev_err(ipc_pcie->dev, "pci_save_state error=%d", ret);
> > -             return ret;
> > -     }
> > -
> > -     /* Set the power state of a PCI device.
> > -      * Transition a device to a new power state, using the device's PCI PM
> > -      * registers.
> > -      */
> > -     ret = pci_set_power_state(pdev, PCI_D3cold);
> > -
> > -     if (ret) {
> > -             dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> > -             return ret;
> > -     }
> > -
> >       dev_dbg(ipc_pcie->dev, "SUSPEND done");
> > -     return ret;
> > +     return 0;
> >  }
> >
> >  int __maybe_unused ipc_pcie_resume(struct iosm_pcie *ipc_pcie)
> >  {
> > -     int ret;
> > -
> > -     /* Set the power state of a PCI device.
> > -      * Transition a device to a new power state, using the device's PCI PM
> > -      * registers.
> > -      */
> > -     ret = pci_set_power_state(ipc_pcie->pci, PCI_D0);
> > -
> > -     if (ret) {
> > -             dev_err(ipc_pcie->dev, "pci_set_power_state error=%d", ret);
> > -             return ret;
> > -     }
> > -
> > -     pci_restore_state(ipc_pcie->pci);
> > -
> >       /* The HAL shall inform the shared memory layer that the device is
> >        * active.
> >        */
> >       ipc_imem_pm_resume(ipc_pcie->imem);
> >
> >       dev_dbg(ipc_pcie->dev, "RESUME done");
> > -     return ret;
> > +     return 0;
> >  }
> >
> >  static int __maybe_unused ipc_pcie_suspend_cb(struct device *dev)
> > --
> > 2.33.1
> >

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

* Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2021-12-29 20:18   ` Bjorn Helgaas
@ 2021-12-30  1:00     ` Kai-Heng Feng
  2022-01-03 15:28       ` Kumar, M Chetan
  0 siblings, 1 reply; 10+ messages in thread
From: Kai-Heng Feng @ 2021-12-30  1:00 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: m.chetan.kumar, linuxwwan, linux-pci, linux-pm, Loic Poulain,
	Sergey Ryazanov, Johannes Berg, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel, Rafael J. Wysocki, Vaibhav Gupta

On Thu, Dec 30, 2021 at 4:18 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> [+cc Rafael, Vaibhav]
>
> On Fri, Dec 24, 2021 at 04:19:14PM +0800, Kai-Heng Feng wrote:
> > We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD laptops.
> > This prevent those laptops to stay in s2idle state.
> >
> > From what I can understand, the intention of ipc_pcie_suspend() is to
> > put the device to D3cold, and ipc_pcie_suspend_s2idle() is to keep the
> > device at D0. However, the device can still be put to D3hot/D3cold by
> > PCI core.
> >
> > So explicitly let PCI core know this device should stay at D0, to solve
> > the spurious wakeup.
> >
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > ---
> >  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > index d73894e2a84ed..af1d0e837fe99 100644
> > --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > @@ -340,6 +340,9 @@ static int __maybe_unused ipc_pcie_suspend_s2idle(struct iosm_pcie *ipc_pcie)
> >
> >       ipc_imem_pm_s2idle_sleep(ipc_pcie->imem, true);
> >
> > +     /* Let PCI core know this device should stay at D0 */
> > +     pci_save_state(ipc_pcie->pci);
>
> This is a weird and non-obvious way to say "this device should stay at
> D0".  It's also fairly expensive since pci_save_state() does a lot of
> slow PCI config reads.

Yes, so I was waiting for feedback from IOSM devs what's the expected
PCI state for the s2idle case.

Dave, can you drop it from netdev until IOSM devs confirm this patch is correct?

Kai-Heng

>
> >       return 0;
> >  }
> >
> > --
> > 2.33.1
> >

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

* RE: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2021-12-30  1:00     ` Kai-Heng Feng
@ 2022-01-03 15:28       ` Kumar, M Chetan
  2022-01-03 17:21         ` Jakub Kicinski
  2022-01-04  2:23         ` Kai-Heng Feng
  0 siblings, 2 replies; 10+ messages in thread
From: Kumar, M Chetan @ 2022-01-03 15:28 UTC (permalink / raw)
  To: Kai-Heng Feng, Bjorn Helgaas, David S. Miller
  Cc: linuxwwan, linux-pci, linux-pm, Loic Poulain, Sergey Ryazanov,
	Johannes Berg, Jakub Kicinski, netdev, linux-kernel,
	Rafael J. Wysocki, Vaibhav Gupta

> -----Original Message-----
> From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Sent: Thursday, December 30, 2021 6:31 AM
> To: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Kumar, M Chetan <m.chetan.kumar@intel.com>; linuxwwan
> <linuxwwan@intel.com>; linux-pci@vger.kernel.org; linux-
> pm@vger.kernel.org; Loic Poulain <loic.poulain@linaro.org>; Sergey
> Ryazanov <ryazanov.s.a@gmail.com>; Johannes Berg
> <johannes@sipsolutions.net>; David S. Miller <davem@davemloft.net>;
> Jakub Kicinski <kuba@kernel.org>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; Rafael J. Wysocki <rjw@rjwysocki.net>; Vaibhav
> Gupta <vaibhavgupta40@gmail.com>
> Subject: Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
> 
> On Thu, Dec 30, 2021 at 4:18 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > [+cc Rafael, Vaibhav]
> >
> > On Fri, Dec 24, 2021 at 04:19:14PM +0800, Kai-Heng Feng wrote:
> > > We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD
> laptops.
> > > This prevent those laptops to stay in s2idle state.
> > >
> > > From what I can understand, the intention of ipc_pcie_suspend() is
> > > to put the device to D3cold, and ipc_pcie_suspend_s2idle() is to
> > > keep the device at D0. However, the device can still be put to
> > > D3hot/D3cold by PCI core.
> > >
> > > So explicitly let PCI core know this device should stay at D0, to
> > > solve the spurious wakeup.

Did you get a chance to check the cause of spurious wakeup ? Was there any
information device is trying to send while platform is entering suspend/
host sw missed to unsubscribe certain notifications which resulted in wake event.

In our internal test (x86 platform) we had not noticed such spurious wakeup but would
like to cross check by running few more tests.

> > >
> > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > > ---
> > >  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > index d73894e2a84ed..af1d0e837fe99 100644
> > > --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > @@ -340,6 +340,9 @@ static int __maybe_unused
> > > ipc_pcie_suspend_s2idle(struct iosm_pcie *ipc_pcie)
> > >
> > >       ipc_imem_pm_s2idle_sleep(ipc_pcie->imem, true);
> > >
> > > +     /* Let PCI core know this device should stay at D0 */
> > > +     pci_save_state(ipc_pcie->pci);
> >
> > This is a weird and non-obvious way to say "this device should stay at
> > D0".  It's also fairly expensive since pci_save_state() does a lot of
> > slow PCI config reads.
> 
> Yes, so I was waiting for feedback from IOSM devs what's the expected PCI
> state for the s2idle case.

D3 is the expected state. 

> Dave, can you drop it from netdev until IOSM devs confirm this patch is
> correct?

Dave, please drop this patch from netdev.

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

* Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2022-01-03 15:28       ` Kumar, M Chetan
@ 2022-01-03 17:21         ` Jakub Kicinski
  2022-01-04  2:23         ` Kai-Heng Feng
  1 sibling, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2022-01-03 17:21 UTC (permalink / raw)
  To: Kumar, M Chetan
  Cc: Kai-Heng Feng, Bjorn Helgaas, David S. Miller, linuxwwan,
	linux-pci, linux-pm, Loic Poulain, Sergey Ryazanov,
	Johannes Berg, netdev, linux-kernel, Rafael J. Wysocki,
	Vaibhav Gupta

On Mon, 3 Jan 2022 15:28:18 +0000 Kumar, M Chetan wrote:
> > Dave, can you drop it from netdev until IOSM devs confirm this patch is
> > correct?  
> 
> Dave, please drop this patch from netdev.

YMMV but these sort of requests aren't usually acted on. netdev doesn't
rebase so revert is needed, and the developers involved are best at
writing commit messages for those since they have all the context. 
So sending a revert patch, with Link to the discussion and context
explained is the best way.

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

* Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
  2022-01-03 15:28       ` Kumar, M Chetan
  2022-01-03 17:21         ` Jakub Kicinski
@ 2022-01-04  2:23         ` Kai-Heng Feng
  1 sibling, 0 replies; 10+ messages in thread
From: Kai-Heng Feng @ 2022-01-04  2:23 UTC (permalink / raw)
  To: Kumar, M Chetan
  Cc: Bjorn Helgaas, David S. Miller, linuxwwan, linux-pci, linux-pm,
	Loic Poulain, Sergey Ryazanov, Johannes Berg, Jakub Kicinski,
	netdev, linux-kernel, Rafael J. Wysocki, Vaibhav Gupta

On Mon, Jan 3, 2022 at 11:28 PM Kumar, M Chetan
<m.chetan.kumar@intel.com> wrote:
>
> > -----Original Message-----
> > From: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > Sent: Thursday, December 30, 2021 6:31 AM
> > To: Bjorn Helgaas <helgaas@kernel.org>
> > Cc: Kumar, M Chetan <m.chetan.kumar@intel.com>; linuxwwan
> > <linuxwwan@intel.com>; linux-pci@vger.kernel.org; linux-
> > pm@vger.kernel.org; Loic Poulain <loic.poulain@linaro.org>; Sergey
> > Ryazanov <ryazanov.s.a@gmail.com>; Johannes Berg
> > <johannes@sipsolutions.net>; David S. Miller <davem@davemloft.net>;
> > Jakub Kicinski <kuba@kernel.org>; netdev@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Rafael J. Wysocki <rjw@rjwysocki.net>; Vaibhav
> > Gupta <vaibhavgupta40@gmail.com>
> > Subject: Re: [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case
> >
> > On Thu, Dec 30, 2021 at 4:18 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > >
> > > [+cc Rafael, Vaibhav]
> > >
> > > On Fri, Dec 24, 2021 at 04:19:14PM +0800, Kai-Heng Feng wrote:
> > > > We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD
> > laptops.
> > > > This prevent those laptops to stay in s2idle state.
> > > >
> > > > From what I can understand, the intention of ipc_pcie_suspend() is
> > > > to put the device to D3cold, and ipc_pcie_suspend_s2idle() is to
> > > > keep the device at D0. However, the device can still be put to
> > > > D3hot/D3cold by PCI core.
> > > >
> > > > So explicitly let PCI core know this device should stay at D0, to
> > > > solve the spurious wakeup.
>
> Did you get a chance to check the cause of spurious wakeup ? Was there any
> information device is trying to send while platform is entering suspend/
> host sw missed to unsubscribe certain notifications which resulted in wake event.

Can you please let me know how to check it?

>
> In our internal test (x86 platform) we had not noticed such spurious wakeup but would
> like to cross check by running few more tests.

Sure, let me know what tests you want me to run.

>
> > > >
> > > > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> > > > ---
> > > >  drivers/net/wwan/iosm/iosm_ipc_pcie.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > > b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > > index d73894e2a84ed..af1d0e837fe99 100644
> > > > --- a/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > > +++ b/drivers/net/wwan/iosm/iosm_ipc_pcie.c
> > > > @@ -340,6 +340,9 @@ static int __maybe_unused
> > > > ipc_pcie_suspend_s2idle(struct iosm_pcie *ipc_pcie)
> > > >
> > > >       ipc_imem_pm_s2idle_sleep(ipc_pcie->imem, true);
> > > >
> > > > +     /* Let PCI core know this device should stay at D0 */
> > > > +     pci_save_state(ipc_pcie->pci);
> > >
> > > This is a weird and non-obvious way to say "this device should stay at
> > > D0".  It's also fairly expensive since pci_save_state() does a lot of
> > > slow PCI config reads.
> >
> > Yes, so I was waiting for feedback from IOSM devs what's the expected PCI
> > state for the s2idle case.
>
> D3 is the expected state.

Is it D3hot or D3cold?

Kai-Heng

>
> > Dave, can you drop it from netdev until IOSM devs confirm this patch is
> > correct?
>
> Dave, please drop this patch from netdev.

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

end of thread, other threads:[~2022-01-04  2:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-24  8:19 [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition Kai-Heng Feng
2021-12-24  8:19 ` [PATCH 2/2] net: wwan: iosm: Keep device at D0 for s2idle case Kai-Heng Feng
2021-12-29 20:18   ` Bjorn Helgaas
2021-12-30  1:00     ` Kai-Heng Feng
2022-01-03 15:28       ` Kumar, M Chetan
2022-01-03 17:21         ` Jakub Kicinski
2022-01-04  2:23         ` Kai-Heng Feng
2021-12-27 12:30 ` [PATCH 1/2] net: wwan: iosm: Let PCI core handle PCI power transition patchwork-bot+netdevbpf
2021-12-29 20:12 ` Bjorn Helgaas
2021-12-30  0:57   ` Kai-Heng Feng

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.