e1000e: Assign DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to speed up s2ram
Subsystems (6)
PATCH 1/1 e1000e: Assign DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to speed up s2ram
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
This patch assigns DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() if dev_pm_skip_suspend() and dev_pm_skip_resume() return true, so as to speed up the s2ram.
--- drivers/base/power/main.c | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/base/power/main.c +2 -0
@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);/** * device_resume_noirq - Execute a "noirq resume" callback for given device.
@@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);
drivers/net/ethernet/intel/e1000e/netdev.c +13 -1
@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +/* Runtime suspended means that there is no wired connection +* and it has nothing to do with WOL that, we don't need to +* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. +*/ +if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);
@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))
@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);
Signature · 1 line
2.25.1
Dear Chen,
Thank you for the patch.
Am 24.11.20 um 16:32 schrieb Chen Yu:
Quoted 5 lines
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
what happens, when I plug in a cable, when the suspend is in ACPI S3 state? I guess it?s ignored?
Quoted 5 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.
What is sped up? Suspend or resume?
Please also document, what system you tested this on, and what the numbers before and after are.
If there is a bug report, please note it too.
Quoted 28 lines
Signed-off-by Chen Yu <[email protected]>--- drivers/base/power/main.c | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +2
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6968
Quoted 4 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +/* Runtime suspended means that there is no wired connection
Maybe explicitly use *cable* in here to avoid confusion?
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6969
Quoted 1 line
drivers/net/ethernet/intel/e1000e/netdev.c +1
-0+* and it has nothing to do with WOL that, we don't need to
Move the comma before *that*?
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6971
Quoted 2 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-0+* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend.
I understood, that the NIC is already in runtime suspend? Could you please clarify the comment?
Quoted 18 lines
drivers/net/ethernet/intel/e1000e/netdev.c +7
-0+*/ +if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7683
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);
Kind regards,
Paul
Hi Paul,
Quoted 5 lines · Paul Menzel
Dear Chen,
Thank you for the patch.
Thanks for reviewing this change.
Quoted 10 lines
Am 24.11.20 um 16:32 schrieb Chen Yu:
Quoted 5 lines
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
what happens, when I plug in a cable, when the suspend is in ACPI S3 state? I guess it’s ignored?
I think it depends on the platform(or BIOS implementation). On my platform it is ignored. When the system is running, the plug event would generate a SCI, but if it is in S3, whether to generate wake up event or not depends on the BIOS and the sysfs whether the device is device_may_wakeup().
In summary, whether the NIC is in runtime_suspend() or system_suspended does not impact the wake up from S3 by plug event.
Quoted 8 lines
Quoted 5 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.What is sped up? Suspend or resume?
Both suspend and resume.
Quoted 2 lines
Please also document, what system you tested this on, and what the numbers before and after are.
The platform I'm testing on a laptop with i5-8300H CPU and I219-LM NIC.
Before this change:
[ 203.391465] e1000e 0000:00:1f.6: pci_pm_suspend+0x0/0x170 returned 0 after 323186 usecs [ 203.598307] e1000e 0000:00:1f.6: pci_pm_suspend_late+0x0/0x40 returned 0 after 4 usecs [ 203.654026] e1000e 0000:00:1f.6: pci_pm_suspend_noirq+0x0/0x290 returned 0 after 20915 usecs [ 203.714464] e1000e 0000:00:1f.6: pci_pm_resume_noirq+0x0/0x120 returned 0 after 19952 usecs [ 203.716208] e1000e 0000:00:1f.6: pci_pm_resume_early+0x0/0x30 returned 0 after 0 usecs [ 203.934399] e1000e 0000:00:1f.6: pci_pm_resume+0x0/0x90 returned 0 after 211437 usecs
After this change:
[ 150.455612] e1000e 0000:00:1f.6: pci_pm_suspend+0x0/0x170 returned 0 after 14 usecs [ 150.987627] e1000e 0000:00:1f.6: pci_pm_suspend_late+0x0/0x40 returned 0 after 3 usecs [ 151.021659] e1000e 0000:00:1f.6: pci_pm_suspend_noirq+0x0/0x290 returned 0 after 1 usecs [ 151.087303] e1000e 0000:00:1f.6: pci_pm_resume_noirq+0x0/0x120 returned 0 after 0 usecs [ 151.112056] e1000e 0000:00:1f.6: pci_pm_resume_early+0x0/0x30 returned 0 after 0 usecs [ 151.136508] e1000e 0000:00:1f.6: pci_pm_resume+0x0/0x90 returned 0 after 3030 usecs
Quoted 3 lines
If there is a bug report, please note it too.
This is an optimization for scenario when cable is unpluged, so there's no dedicated bug report on this.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Chen Yu <[email protected]>--- drivers/base/power/main.c | 2 ++ drivers/net/ethernet/intel/e1000e/netdev.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +2
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6967
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +/* Runtime suspended means that there is no wired connection Maybe explicitly use *cable* in here to avoid confusion?
Okay.
Quoted 4 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6969
Quoted 1 line
drivers/net/ethernet/intel/e1000e/netdev.c +1
-0+* and it has nothing to do with WOL that, we don't need to Move the comma before *that*?
Okay.
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6971
Quoted 2 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-0+* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. I understood, that the NIC is already in runtime suspend? Could you please clarify the comment?
Yes, it is already runtime suspended, I'll revise the comment.
Thanks,
Chenyu
Quoted 27 lines
Quoted 16 lines
drivers/net/ethernet/intel/e1000e/netdev.c +7
-0+*/ +if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7680
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);Kind regards,
Paul
Hi Yu,
Quoted 7 lines · Chen Yu
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
Please see below for the reason why I explicitly disable direct-complete in the driver.
Quoted 6 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.
If we really want direct-complete here, maybe always set current WoL setting in runtime suspend routine?
Quoted 12 lines
Signed-off-by Chen Yu <[email protected]>---
drivers/base/power/main.c| 2 ++drivers/net/ethernet/intel/e1000e/netdev.c| 14 +++++++++++++-2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +0
-0
drivers/base/power/main.c bool dev_pm_skip_resume(struct device *dev) · line 583
Quoted 4 lines
drivers/base/power/main.c +1
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);
I don't think it's a good idea to use this predicate out side of PM core, must_resume may change during suspend process.
Quoted 13 lines
drivers/base/power/main.c +1
-0/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6972
Quoted 8 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +/* Runtime suspended means that there is no wired connection +* and it has nothing to do with WOL that, we don't need to +* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. +*/
What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.
Quoted 17 lines
drivers/net/ethernet/intel/e1000e/netdev.c +6
-0+if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7683
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);
Also, most e1000e device on modern platforms doesn't runtime suspend at all after commit "e1000e: Disable runtime PM on CNP+".
Kai-Heng
Quoted 3 lines
Signature · 1 line
2.25.1
Hi Kai-Heng,
Quoted 4 lines · Kai-Heng Feng
Hi Yu,
Quoted 2 lines · Chen Yu
Quoted 8 lines
Quoted 5 lines
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
Please see below for the reason why I explicitly disable direct-complete in the driver.
Okay.
Quoted 9 lines
Quoted 6 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.If we really want direct-complete here, maybe always set current WoL setting in runtime suspend routine?
Indeed, that would be a choice.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Chen Yu <[email protected]>---
drivers/base/power/main.c| 2 ++drivers/net/ethernet/intel/e1000e/netdev.c| 14 +++++++++++++-2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +0
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)
Quoted 6 lines
drivers/base/power/main.c bool dev_pm_skip_resume(struct device *dev) · line 583
Quoted 3 lines
drivers/base/power/main.c +1
-0return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);I don't think it's a good idea to use this predicate out side of PM core,
must_resumemay change during suspend process.
The dev_pm_skip_resume() is used during system resume, not during suspend, so there would be no race condition I suppose?
Quoted 16 lines
Quoted 16 lines
drivers/base/power/main.c +1
-0/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc;
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6972
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5
-0+/* Runtime suspended means that there is no wired connection +* and it has nothing to do with WOL that, we don't need to +* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. +*/ What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.
Yes, this is what I concerned previously. So in order to support this case, let's adjust this by checking
if (device_may_wakeup() && dev_pm_skip_suspend())
so that if the user has disabled WOL via sysfs then we do not fall into this optimization
commit 6bf6be1127f7 ("e1000e: Do not wake up the system via WOL if device wakeup is disabled")
Quoted 20 lines
Quoted 20 lines
drivers/net/ethernet/intel/e1000e/netdev.c +6
-0+if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter);
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7683
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1-dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);Also, most e1000e device on modern platforms doesn't runtime suspend at all after commit "e1000e: Disable runtime PM on CNP+".
Yes, I did some hack on this to make runtime suspend work. As we do have more newer NICs to come, how about removing the restriction of runtime suspend and let the user determine whether to enable the runtime suspend via echo 'on' or 'auto' via sysfs's control.
thanks,
Chenyu
Quoted 6 lines
Kai-Heng
Quoted 3 lines
Signature · 1 line
2.25.1
Quoted 42 lines · Chen Yu
Hi Kai-Heng,
Quoted 4 lines · Kai-Heng Feng
Hi Yu,
Quoted 2 lines · Chen Yu
Quoted 8 lines
Quoted 5 lines
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
Please see below for the reason why I explicitly disable direct-complete in the driver.
Okay.
Quoted 9 lines
Quoted 6 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.If we really want direct-complete here, maybe always set current WoL setting in runtime suspend routine?
Indeed, that would be a choice.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Chen Yu <[email protected]>---
drivers/base/power/main.c| 2 ++drivers/net/ethernet/intel/e1000e/netdev.c| 14 +++++++++++++-2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +0
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)
Quoted 8 lines
Quoted 6 lines
drivers/base/power/main.c bool dev_pm_skip_resume(struct device *dev) · line 583
Quoted 3 lines
drivers/base/power/main.c +1
-0return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);I don't think it's a good idea to use this predicate out side of PM core,
must_resumemay change during suspend process.The
dev_pm_skip_resume()is used during system resume, not during suspend, so there would be no race condition I suppose?
I think it's better to let PM core to decide.
Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
drivers/base/power/main.c +1
-0/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc;Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6972
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5
-0+/* Runtime suspended means that there is no wired connection +* and it has nothing to do with WOL that, we don't need to +* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. +*/ What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.
Quoted 8 lines
Yes, this is what I concerned previously. So in order to support this case, let's adjust this by checking
if (device_may_wakeup() && dev_pm_skip_suspend())so that if the user has disabled WOL via sysfs then we do not fall into this optimization
commit6bf6be1127f7("e1000e: Do not wake up the system via WOL if device wakeup is disabled")
I don't think this is right.
Isn't E1000_WUFC_LNKC already set for runtime suspend? What if WoL doesn't have it set?
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
drivers/net/ethernet/intel/e1000e/netdev.c +6
-0+if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter);Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7683
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1-dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);Also, most e1000e device on modern platforms doesn't runtime suspend at all after commit "e1000e: Disable runtime PM on CNP+".
Quoted 5 lines
Yes, I did some hack on this to make runtime suspend work. As we do have more newer NICs to come, how about removing the restriction of runtime suspend and let the user determine whether to enable the runtime suspend via echo 'on' or 'auto' via sysfs's control.
There's a discussion on enable runtime PM by default for all PCI devices. So removing this workaround will expose the bug for users.
Let me get the system with the bug (Latitude 5500) and see if latest ACPI code can fix the GPE bug.
Kai-Heng
Quoted 7 lines
thanks,
ChenyuQuoted 4 lines
Kai-Heng
Quoted 2 lines
Signature · 1 line
2.25.1
Quoted 48 lines · Kai-Heng Feng
Quoted 48 lines · Chen Yu
Hi Kai-Heng,
Quoted 4 lines · Kai-Heng Feng
Hi Yu,
Quoted 2 lines · Chen Yu
Quoted 8 lines
Quoted 5 lines
The NIC is put in runtime suspend status when there is no wire connected. As a result, it is safe to keep this NIC in runtime suspended during s2ram because the system does not rely on the NIC plug event nor WOL to wake up the system. Unlike the s2idle, s2ram does not need to manipulate S0ix settings during suspend.
Please see below for the reason why I explicitly disable direct-complete in the driver.
Okay.
Quoted 9 lines
Quoted 6 lines
This patch assigns
DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUMEto the e1000e driver so that the s2ram could skip the .suspend_late(), .suspend_noirq() and .resume_noirq() .resume_early() when possible. Also skip .suspend() and .resume() ifdev_pm_skip_suspend()anddev_pm_skip_resume()return true, so as to speed up the s2ram.If we really want direct-complete here, maybe always set current WoL setting in runtime suspend routine?
Indeed, that would be a choice.
Quoted 19 lines
Quoted 12 lines
Signed-off-by Chen Yu <[email protected]>---
drivers/base/power/main.c| 2 ++drivers/net/ethernet/intel/e1000e/netdev.c| 14 +++++++++++++-2 files changed, 15 insertions(+), 1 deletion(-)drivers/base/power/main.c +0
-0drivers/base/power/main.c bool dev_pm_skip_resume(struct device *dev) · line 583
Quoted 4 lines
drivers/base/power/main.c +1
-0@@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev)return !dev->power.must_resume; } +EXPORT_SYMBOL_GPL (dev_pm_skip_resume);I don't think it's a good idea to use this predicate out side of PM core,
must_resumemay change during suspend process.
Quoted 5 lines
Quoted 2 lines
The
dev_pm_skip_resume()is used during system resume, not during suspend, so there would be no race condition I suppose?I think it's better to let PM core to decide.
Humm, drivers/acpi/acpi_lpss.c alread used it in acpi_lpss_resume_early(), so e1000e is not the only one that wants to leverage this interface : )
Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
drivers/base/power/main.c +1
-0/** * device_resume_noirq - Execute a "noirq resume" callback for given device. @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev)return dev_pm_test_driver_flags (dev,DPM_FLAG_SMART_SUSPEND ) &&pm_runtime_status_suspended (dev); } +EXPORT_SYMBOL_GPL (dev_pm_skip_suspend);drivers/net/ethernet/intel/e1000e/netdev.c +0
-0@@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc;Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static __maybe_unused int e1000e_pm_suspend(struct device *dev) · line 6972
Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +5
-0+/* Runtime suspended means that there is no wired connection +* and it has nothing to do with WOL that, we don't need to +* adjust the WOL settings. So it is safe to put NIC in +* runtime suspend while doing system suspend. +*/ What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.Yes, this is what I concerned previously. So in order to support this case, let's adjust this by checking
if (device_may_wakeup() && dev_pm_skip_suspend())
Quoted 9 lines
Quoted 4 lines
so that if the user has disabled WOL via sysfs then we do not fall into this optimization
commit6bf6be1127f7("e1000e: Do not wake up the system via WOL if device wakeup is disabled")I don't think this is right.
Isn'tE1000_WUFC_LNKCalready set for runtime suspend? What if WoL doesn't have it set?
I did not quite get what your meaning is. First, it was a typo, please check v2 patch set, it is:
if (dev_pm_skip_suspend() && !device_may_wakeup(dev))
if the NIC is runtime suspended, it means that, device_may_wakeup() return true, the code will continue to execute. In summary, if the NIC is a wake up device, we don't fall into the optimization.
Quoted 35 lines
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
drivers/net/ethernet/intel/e1000e/netdev.c +6
-0+if (dev_pm_skip_suspend (dev)) +return 0 ; +e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev);@@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)struct e1000_hw *hw = &adapter->hw;int rc; +if (dev_pm_skip_resume (dev)) +return 0 ; +/* Introduce S0ix implementation */ if (hw->mac.type >= e1000_pch_cnp && !e1000e_check_me (hw->adapter->pdev->device))@@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter);Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7683
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/netdev.c +2
-1-dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE | +DPM_FLAG_SMART_SUSPEND |DPM_FLAG_MAY_SKIP_RESUME );if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp)pm_runtime_put_noidle (&pdev->dev);Also, most e1000e device on modern platforms doesn't runtime suspend at all after commit "e1000e: Disable runtime PM on CNP+".
Quoted 5 lines
Yes, I did some hack on this to make runtime suspend work. As we do have more newer NICs to come, how about removing the restriction of runtime suspend and let the user determine whether to enable the runtime suspend via echo 'on' or 'auto' via sysfs's control.
Quoted 5 lines
There's a discussion on enable runtime PM by default for all PCI devices. So removing this workaround will expose the bug for users.
Let me get the system with the bug (Latitude 5500) and see if latest ACPI code can fix the GPE bug.
There is sysfs for user to disable runtime suspend. If there is an issue on that platform and if we don't want to break the user space(because the blacklist is already there), I think we should only disable the runtime suspend on that platform, but not blocking other platforms IMO.
thanks,
Chenyu
Quoted 10 lines
Kai-Hengs
Quoted 7 lines
thanks,
ChenyuQuoted 4 lines
Kai-Heng
Quoted 2 lines
Signature · 1 line
2.25.1
Quoted 3 lines · Kai-Heng Feng
Quoted 3 lines
Quoted 3 lines
What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.
[cut]
Quoted 5 lines
I don't think this is right.
Isn'tE1000_WUFC_LNKCalready set for runtime suspend? What if WoL doesn't have it set?
After re-taking a look at your description, please let me elaborate more about the scenario. With this patch applied, and with sysfs wake up disabled, the expected behavior is:
1. If NIC is not runtime suspended:
1.1 s2ram suspend -> wufc will be set to 0(no WoL settings), suspend(), suspend_late(), suspend_noirq() 1.2 s2ram resume -> NIC resumes normaly
2. If NIC is runtime suspended:
2.1 s2ram suspend -> wufc set to E1000_WUFC_LNKC, skip the subsequent suspend callbacks. 2.2 s2ram resume -> skip the subsequent resume callbacks.
If between 2.1 and 2.2, the cable is plugged, the user is unable to use WoL to wake up the system.
But if the sysfs wake up is enabled, the code logic falls into the old path, and the user can wake up the system via WoL by plugging the cable, and send packages to the system. Or do I miss something?
thanks,
Chenyu
Quoted 17 lines · Chen Yu
Quoted 3 lines · Kai-Heng Feng
Quoted 3 lines
Quoted 3 lines
What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.[cut]
Quoted 5 lines
I don't think this is right.
Isn'tE1000_WUFC_LNKCalready set for runtime suspend? What if WoL doesn't have it set?After re-taking a look at your description, please let me elaborate more about the scenario. With this patch applied, and with sysfs wake up disabled, the expected behavior is:
Quoted 6 lines
1. If NIC is not runtime suspended:
1.1 s2ram suspend -> wufc will be set to 0(no WoL settings),suspend(),suspend_late(),suspend_noirq()1.2 s2ram resume -> NIC resumes normaly2. If NIC is runtime suspended:
2.1 s2ram suspend -> wufc set toE1000_WUFC_LNKC, skip the subsequent suspend callbacks.
Is it safe to keep E1000_WUFC_LNKC enabled here?
From commit 6bf6be1127f7 ("e1000e: Do not wake up the system via WOL if device wakeup is disabled"):
/* Runtime suspend should only enable wakeup for link changes */
if (runtime)
wufc = E1000_WUFC_LNKC;
else if (device_may_wakeup(&pdev->dev))
wufc = adapter->wol;
else
wufc = 0;So it has different wakeup settings for runtime suspend and system suspend, either device_may_wakeup() true or false. Or maybe e1000e devs can confirm E1000_WUFC_LNKC is a safe for system suspend?
Kai-Heng
Quoted 13 lines
2.2 s2ram resume -> skip the subsequent resume callbacks.
If between 2.1 and 2.2, the cable is plugged, the user is unable to use WoL to wake up the system.
But if the sysfs wake up is enabled, the code logic falls into the old path, and the user can wake up the system via WoL by plugging the cable, and send packages to the system. Or do I miss something?
thanks,
Chenyu
Quoted 36 lines · Kai-Heng Feng
Quoted 17 lines · Chen Yu
Quoted 3 lines · Kai-Heng Feng
Quoted 3 lines
Quoted 3 lines
What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.[cut]
Quoted 5 lines
I don't think this is right.
Isn'tE1000_WUFC_LNKCalready set for runtime suspend? What if WoL doesn't have it set?After re-taking a look at your description, please let me elaborate more about the scenario. With this patch applied, and with sysfs wake up disabled, the expected behavior is:
Quoted 6 lines
1. If NIC is not runtime suspended:
1.1 s2ram suspend -> wufc will be set to 0(no WoL settings),suspend(),suspend_late(),suspend_noirq()1.2 s2ram resume -> NIC resumes normaly2. If NIC is runtime suspended:
2.1 s2ram suspend -> wufc set toE1000_WUFC_LNKC, skip the subsequent suspend callbacks.Is it safe to keep
E1000_WUFC_LNKCenabled here?From commit
6bf6be1127f7("e1000e: Do not wake up the system via WOL if device wakeup is disabled"):/* Runtime suspend should only enable wakeup for link changes */ if (runtime) wufc = E1000_WUFC_LNKC; else if (device_may_wakeup(&pdev->dev)) wufc = adapter->wol; else wufc = 0;
Quoted 1 line
So it has different wakeup settings for runtime suspend and system suspend, either
device_may_wakeup()true or false.
Right.
Quoted 2 lines
Or maybe e1000e devs can confirm
E1000_WUFC_LNKCis a safe for system suspend?
Does 'safe' here mean waking up the system?
For s2ram, whether the NIC can wake up the system from S3 via cable plug is platform (BIOS) specific. So the wufc settings here is not directly related to system wake up via plug event.
thanks,
Chenyu
Quoted 41 lines · Chen Yu
Quoted 36 lines · Kai-Heng Feng
Quoted 17 lines · Chen Yu
Quoted 3 lines · Kai-Heng Feng
Quoted 3 lines
Quoted 3 lines
What about plugging ethernet cable and using WoL after system is suspended?
Commit "e1000e: Exclude device from suspend direct complete optimization" was to address that scenario.[cut]
Quoted 5 lines
I don't think this is right.
Isn'tE1000_WUFC_LNKCalready set for runtime suspend? What if WoL doesn't have it set?After re-taking a look at your description, please let me elaborate more about the scenario. With this patch applied, and with sysfs wake up disabled, the expected behavior is:
Quoted 6 lines
1. If NIC is not runtime suspended:
1.1 s2ram suspend -> wufc will be set to 0(no WoL settings),suspend(),suspend_late(),suspend_noirq()1.2 s2ram resume -> NIC resumes normaly2. If NIC is runtime suspended:
2.1 s2ram suspend -> wufc set toE1000_WUFC_LNKC, skip the subsequent suspend callbacks.Is it safe to keep
E1000_WUFC_LNKCenabled here?From commit
6bf6be1127f7("e1000e: Do not wake up the system via WOL if device wakeup is disabled"):/* Runtime suspend should only enable wakeup for link changes */ if (runtime) wufc = E1000_WUFC_LNKC; else if (device_may_wakeup(&pdev->dev)) wufc = adapter->wol; else wufc = 0;
Quoted 8 lines
Quoted 1 line
So it has different wakeup settings for runtime suspend and system suspend, either
device_may_wakeup()true or false.Right.
Quoted 2 lines
Or maybe e1000e devs can confirm
E1000_WUFC_LNKCis a safe for system suspend?Does 'safe' here mean waking up the system?
For s2ram, whether the NIC can wake up the system from S3 via cable plug is platform (BIOS) specific. So the wufc settings here is not directly related to system wake up via plug event.
Thanks for the confirmation. How about a different approach? Simply use direct-complete to let PM core handle the rest:
drivers/net/ethernet/intel/e1000e/netdev.c +18 -3
@@ -25,6 +25,7 @@#include <linux/pm_runtime.h> #include <linux/aer.h> #include <linux/prefetch.h> +#include <linux/suspend.h> #include "e1000.h"
@@ -6868,6 +6869,20 @@ static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state)__e1000e_disable_aspm (pdev, state,1 ); } +static int e1000e_pm_prepare (struct device *dev) +{ +return pm_runtime_suspended (dev) && +pm_suspend_via_firmware () && + !device_may_wakeup (dev); +} + +static void e1000e_pm_complete (struct device *dev) +{ +/* Detect link change */ +if (pm_runtime_suspended (dev)) +pm_request_resume (dev); +} +static int e1000e_pm_thaw (struct device *dev) {struct net_device *netdev =dev_get_drvdata (dev);
@@ -7665,9 +7680,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); - -if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp) +if (pci_dev_run_wake (pdev))pm_runtime_put_noidle (&pdev->dev);return 0 ;
@@ -7890,6 +7903,8 @@ MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);static const struct dev_pm_ops e1000_pm_ops = { #ifdef CONFIG_PM_SLEEP + .prepare = e1000e_pm_prepare, + .complete = e1000e_pm_complete, .suspend = e1000e_pm_suspend, .resume = e1000e_pm_resume, .freeze = e1000e_pm_freeze,
Quoted 2 lines
thanks,
Chenyu
Quoted 3 lines · Kai-Heng Feng
Thanks for the confirmation. How about a different approach? Simply use direct-complete to let PM core handle the rest:
Thanks for your suggestion and sorry about replying too late. Yes, using direct-complete could leverage pm core to do that, although this is a little different than my original thought to mainly skip the resume process. But anyway, I'll use direct complete and send a v3 out.
Quoted 13 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-0@@ -25,6 +25,7 @@#include <linux/pm_runtime.h> #include <linux/aer.h> #include <linux/prefetch.h> +#include <linux/suspend.h> #include "e1000.h"
drivers/net/ethernet/intel/e1000e/netdev.c static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state) · line 6877
Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c +6
-0@@ -6868,6 +6869,20 @@ static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state)__e1000e_disable_aspm (pdev, state,1 ); } +static int e1000e_pm_prepare (struct device *dev) +{ +return pm_runtime_suspended (dev) && +pm_suspend_via_firmware () && + !device_may_wakeup (dev); +}
device_may_wakeup() is not needed as pm core will check it anyway.
drivers/net/ethernet/intel/e1000e/netdev.c static void e1000e_disable_aspm_locked(struct pci_dev *pdev, u16 state) · line 6884
Quoted 7 lines
drivers/net/ethernet/intel/e1000e/netdev.c +7
-0+ +static void e1000e_pm_complete (struct device *dev) +{ +/* Detect link change */ +if (pm_runtime_suspended (dev)) +pm_request_resume (dev); +}
There is no need to force resume the device, just keep it runtime suspended would be okay. Besides the pm core's complete() will restore runtime usage_count which is increased by pm core's prepare(), so there is no need to do that here again.
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7669
Quoted 10 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-2+static int e1000e_pm_thaw (struct device *dev) {struct net_device *netdev =dev_get_drvdata (dev);@@ -7665,9 +7680,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); -dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NO_DIRECT_COMPLETE ); -
DPM_FLAG_SMART_PREPARE must be set otherwise pci subsystem will ignore the .prepare() from the driver.
drivers/net/ethernet/intel/e1000e/netdev.c static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 7685
Quoted 4 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1
-1-if (pci_dev_run_wake (pdev) && hw->mac.type < e1000_pch_cnp) +if (pci_dev_run_wake (pdev))pm_runtime_put_noidle (&pdev->dev);
I would prefer to only disable runtime for cnp, in case of any user regressions.
thanks,
Chenyu