Skip to contentSkip to conversation

PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

PATCH Superseded Imre Deak 8 participants 16 messages Nov 18, 2015 – Dec 2, 2015

Subsystems (5)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

---
 drivers/base/power/main.c |  7 +++++--
 drivers/pci/pci-driver.c  |  2 +-
 include/linux/pm.h        | 10 ++++++++--
 3 files changed, 14 insertions(+), 5 deletions(-)
drivers/base/power/main.c +5 -2
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_start);
 
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)
 {
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)
 		printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
 }
 EXPORT_SYMBOL_GPL(__suspend_report_result);
drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);
 	if (error)
 		return error;
 	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +8 -2
index 35d599e..f3dca18 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
 extern int dpm_suspend(pm_message_t state);
 extern int dpm_prepare(pm_message_t state);
 
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);
 
 #define suspend_report_result(fn, ret)					\
 	do {								\
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\
 	} while (0)
 
 extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
reproduce:

Hi Imre,

[auto build test ERROR on pci/next]
[also build test ERROR on v4.4-rc1 next-20151118]

url:    https://github.com/0day-ci/linux/commits/Imre-Deak/PCI-PM-tune-down-RPM-suspend-error-message-with-EBUSY-and-EAGAIN-retval/20151118-171831
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-a0-201546 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

drivers/pci/pci-driver.c: In function 'pci_pm_runtime_suspend':

>> drivers/pci/pci-driver.c:1149:2: error: implicit declaration of function 'rpm_suspend_report_result' [-Werror=implicit-function-declaration]
     rpm_suspend_report_result(pm->runtime_suspend, error);
     ^

cc1: some warnings being treated as errors

vim +/rpm_suspend_report_result +1149 drivers/pci/pci-driver.c

1143 if (!pm || !pm->runtime_suspend)
1144 return -ENOSYS;
1145
1146 pci_dev->state_saved = false;
1147 pci_dev->no_d3cold = false;
1148 error = pm->runtime_suspend(dev);

> 1149		rpm_suspend_report_result(pm->runtime_suspend, error);

1150 if (error)
1151 return error;
1152 if (!pci_dev->d3cold_allowed)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#2 lore raw

PATCH v2 1/1 PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

In reply to Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

---
 drivers/base/power/main.c |  7 +++++--
 drivers/pci/pci-driver.c  |  2 +-
 include/linux/pm.h        | 11 +++++++++--
 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +5 -2
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_start);
 
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)
 {
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)
 		printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
 }
 EXPORT_SYMBOL_GPL(__suspend_report_result);
drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);
 	if (error)
 		return error;
 	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +9 -2
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
 extern int dpm_suspend(pm_message_t state);
 extern int dpm_prepare(pm_message_t state);
 
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);
 
 #define suspend_report_result(fn, ret)					\
 	do {								\
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\
 	} while (0)
 
 extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
@@ -744,6 +750,7 @@ static inline int dpm_suspend_start(pm_message_t state)
 }
 
 #define suspend_report_result(fn, ret)		do {} while (0)
+#define rpm_suspend_report_result(fn, ret)	do {} while (0)
 
 static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
 {
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#3 lore raw
Quoted 10 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Quoted 5 lines

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

Quoted 64 lines

---
 drivers/base/power/main.c |  7 +++++--
 drivers/pci/pci-driver.c  |  2 +-
 include/linux/pm.h        | 11 +++++++++--

 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +0 -0
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
  }
  EXPORT_SYMBOL_GPL(dpm_suspend_start);

drivers/base/power/main.c +2 -1
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)

 {

drivers/base/power/main.c +3 -1
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)

  printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret); }
 EXPORT_SYMBOL_GPL(__suspend_report_result);

drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
  	pci_dev->state_saved = false;
  	pci_dev->no_d3cold = false;
  	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);
  	if (error)
  		return error;
  	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +0 -0
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
  extern int dpm_suspend(pm_message_t state);
  extern int dpm_prepare(pm_message_t state);

include/linux/pm.h +2 -1
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);


 #define suspend_report_result(fn, ret) \
  do { \

include/linux/pm.h +6 -1
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\

  } while (0)

 extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);

include/linux/pm.h +0 -0
@@ -744,6 +750,7 @@ static inline int dpm_suspend_start(pm_message_t state)
  }
Quoted 6 lines


 #define suspend_report_result(fn, ret) do {} while (0)
+#define rpm_suspend_report_result(fn, ret) do {} while (0)

 static inline int device_pm_wait_for_dev(struct device *a, struct device *b) {

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#4 lore raw
Quoted 11 lines · Imre Deak
Quoted 10 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Quoted 7 lines
Quoted 5 lines

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

Rafael, can you please pick this up for 4.4? The spurious KERN_ERR noise in dmesg is causing a lot fo spurious fail in our (very recently put into place) i915 CI system.

Thanks, Daniel

Quoted 71 lines
Quoted 71 lines

---
 drivers/base/power/main.c |  7 +++++--
 drivers/pci/pci-driver.c  |  2 +-
 include/linux/pm.h        | 11 +++++++++--

 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +0 -0
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
  }
  EXPORT_SYMBOL_GPL(dpm_suspend_start);

drivers/base/power/main.c +2 -1
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)

 {

drivers/base/power/main.c +3 -1
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)

  printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret); }
 EXPORT_SYMBOL_GPL(__suspend_report_result);

drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
  	pci_dev->state_saved = false;
  	pci_dev->no_d3cold = false;
  	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);
  	if (error)
  		return error;
  	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +0 -0
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
  extern int dpm_suspend(pm_message_t state);
  extern int dpm_prepare(pm_message_t state);

include/linux/pm.h +2 -1
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);


 #define suspend_report_result(fn, ret) \
  do { \

include/linux/pm.h +6 -1
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\

  } while (0)

 extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);

include/linux/pm.h +0 -0
@@ -744,6 +750,7 @@ static inline int dpm_suspend_start(pm_message_t state)
  }


 #define suspend_report_result(fn, ret) do {} while (0)
+#define rpm_suspend_report_result(fn, ret) do {} while (0)

 static inline int device_pm_wait_for_dev(struct device *a, struct device *b) {

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Imre Deak
Quoted 15 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

Quoted 7 lines
Quoted 1 line

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

Rafael, can you please pick this up for 4.4? The spurious KERN_ERR noise in dmesg is causing a lot fo spurious fail in our (very recently put into place) i915 CI system.

Rafael, ping.

BR,
Jani.

Quoted 74 lines

Thanks, Daniel

Quoted 71 lines
Quoted 71 lines

---
 drivers/base/power/main.c |  7 +++++--
 drivers/pci/pci-driver.c  |  2 +-
 include/linux/pm.h        | 11 +++++++++--

 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +0 -0
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
  }
  EXPORT_SYMBOL_GPL(dpm_suspend_start);

drivers/base/power/main.c +2 -1
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)

 {

drivers/base/power/main.c +3 -1
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)

  printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret); }
 EXPORT_SYMBOL_GPL(__suspend_report_result);

drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
  	pci_dev->state_saved = false;
  	pci_dev->no_d3cold = false;
  	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);
  	if (error)
  		return error;
  	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +0 -0
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
  extern int dpm_suspend(pm_message_t state);
  extern int dpm_prepare(pm_message_t state);

include/linux/pm.h +2 -1
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);


 #define suspend_report_result(fn, ret) \
  do { \

include/linux/pm.h +6 -1
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\

  } while (0)

 extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);

include/linux/pm.h +0 -0
@@ -744,6 +750,7 @@ static inline int dpm_suspend_start(pm_message_t state)
  }


 #define suspend_report_result(fn, ret) do {} while (0)
+#define rpm_suspend_report_result(fn, ret) do {} while (0)

 static inline int device_pm_wait_for_dev(struct device *a, struct device *b) {

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 18 lines · Jani Nikula
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Imre Deak
Quoted 15 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

Rafael, can you please pick this up for 4.4? The spurious KERN_ERR noise in dmesg is causing a lot fo spurious fail in our (very recently put into place) i915 CI system.

Rafael, ping.

Well, so I'm not sure about this one.

And the question is ->

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
---
  drivers/base/power/main.c |  7 +++++--
  drivers/pci/pci-driver.c  |  2 +-
  include/linux/pm.h        | 11 +++++++++--
  3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +0 -0
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t state)
  }
  EXPORT_SYMBOL_GPL(dpm_suspend_start);
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/base/power/main.c int dpm_suspend_start(pm_message_t state) · line 1689

Quoted 10 lines
drivers/base/power/main.c +5 -2
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,
+			     bool runtime_pm)
  {
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n", function, fn, ret);
+	else if (ret)
  		printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
  }

-> why you are adding overhead to this function, instead of -->

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/pci/pci-driver.c static int pci_pm_runtime_suspend(struct device *dev) · line 1145

Quoted 11 lines
drivers/base/power/main.c +0 -0
  EXPORT_SYMBOL_GPL(__suspend_report_result);
drivers/pci/pci-driver.c +1 -1
index 108a311..9569572 100644
@@ -1142,7 +1142,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
  	pci_dev->state_saved = false;
  	pci_dev->no_d3cold = false;
  	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend, error);

--> replacing the suspend_report_result() above with a direct printk() in the if (error) block below.

Surely, suspend_report_result() was not designed with runtime PM in mind and it was a mistake to use it here. It just seemed to do the right thing, but it clearly doesn't.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
drivers/pci/pci-driver.c +0 -0
  	if (error)
  		return error;
  	if (!pci_dev->d3cold_allowed)
include/linux/pm.h +8 -2
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int dpm_suspend_late(pm_message_t state);
  extern int dpm_suspend(pm_message_t state);
  extern int dpm_prepare(pm_message_t state);
 
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,
+				    bool runtime_pm);
 
  #define suspend_report_result(fn, ret)					\
  	do {								\
-		__suspend_report_result(__func__, fn, ret);		\
+		__suspend_report_result(__func__, fn, ret, false);	\
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)				\
+	do {								\
+		__suspend_report_result(__func__, fn, ret, true);	\
  	} while (0)
 
  extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
@@ -744,6 +750,7 @@ static inline int dpm_suspend_start(pm_message_t state)
  }
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

include/linux/pm.h static inline int dpm_suspend_start(pm_message_t state) · line 756

Quoted 5 lines
include/linux/pm.h +1 -0
  #define suspend_report_result(fn, ret)		do {} while (0)
+#define rpm_suspend_report_result(fn, ret)	do {} while (0)
 
  static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
  {

BTW, if you're changing PM code, it is good to CC linux-pm too (now done) and if you're changing PCI code, it is mandatory to CC linux-pci and the PCI maintainer (now done too).

Thanks,
Rafael

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#7 lore raw
Quoted 92 lines · Rafael J. Wysocki
Quoted 26 lines · Jani Nikula
Quoted 25 lines · Daniel Vetter
Quoted 24 lines · Imre Deak
Quoted 17 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver
suspend hooks as errors, but they still show up as errors in dmesg. Tune
them down.

One problem caused by this was noticed by Daniel: the i915 driver
returns EAGAIN to signal a temporary failure to suspend and as a request
towards the RPM core for scheduling a suspend again. This is a normal
event, but the resulting error message flags a breakage during the
driver's automated testing which parses dmesg and picks up the error.

Quoted 5 lines

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

Quoted 8 lines
Quoted 7 lines

Rafael, can you please pick this up for 4.4? The spurious KERN_ERR noise
in dmesg is causing a lot fo spurious fail in our (very recently put into
place) i915 CI system.

Rafael, ping.

Well, so I'm not sure about this one.

And the question is ->

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

---
  drivers/base/power/main.c |  7 +++++--
  drivers/pci/pci-driver.c  |  2 +-
  include/linux/pm.h        | 11 +++++++++--

  3 files changed, 15 insertions(+), 5 deletions(-)
drivers/base/power/main.c +0 -0
index 1710c26..39d2090 100644
@@ -1679,9 +1679,12 @@ int dpm_suspend_start(pm_message_t
 state)
   }
   EXPORT_SYMBOL_GPL(dpm_suspend_start);


-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const char *function, void *fn, int ret,

drivers/base/power/main.c +1 -0
+			     bool runtime_pm)

  {

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/base/power/main.c +2 -1
-	if (ret)
+	if (runtime_pm && (ret == -EBUSY || ret == -EAGAIN))
+		printk(KERN_DEBUG "%s(): %pF returns %d\n",

function, fn, ret);

drivers/base/power/main.c +1 -0
+	else if (ret)

   printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
  }

-> why you are adding overhead to this function, instead of -->

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

  EXPORT_SYMBOL_GPL(__suspend_report_result);

drivers/pci/pci- renamed from drivers/pci/pci-driver.c +0 -0

driver.c
index 108a311..9569572 100644

drivers/pci/pci-driver.c +0 -0
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/pci/pci-driver.c static int · line 1147

Quoted 8 lines
drivers/pci/pci-driver.c +1 -1
@@ -1142,7 +1142,7 @@ static int
 pci_pm_runtime_suspend(struct device *dev)
   	pci_dev->state_saved = false;
   	pci_dev->no_d3cold = false;
   	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
+	rpm_suspend_report_result(pm->runtime_suspend,
 error);

--> replacing the suspend_report_result() above with a direct printk()
in the if (error) block below.

Quoted 4 lines

Surely, suspend_report_result() was not designed with runtime PM in mind
and it was a mistake to use it here.  It just seemed to do the right thing, but it clearly doesn't.

Ok, a helper like rpm_suspend_report_result() seemed like a good idea, since handling -EBUSY and -EAGAIN error reporting will be the same for callers of the pm->runtime_suspend hooks not just the PCI drivers. But since the only user of this is the PCI core atm we can just add a printk locally as you suggested. I'll follow up with v2.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
drivers/pci/pci-driver.c +0 -0
   	if (error)

   return error;
   if (!pci_dev->d3cold_allowed)

include/linux/pm.h +0 -0
index 35d599e..54f37e3 100644
@@ -702,11 +702,17 @@ extern int
 dpm_suspend_late(pm_message_t state);
   extern int dpm_suspend(pm_message_t state);
   extern int dpm_prepare(pm_message_t state);


-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const char *function, void *fn, int ret,

include/linux/pm.h +1 -0
+				    bool runtime_pm);

  #define suspend_report_result(fn, ret)			
		\
  	do {						
		\
include/linux/pm.h +0 -1
-		__suspend_report_result(__func__, fn, ret);	
	\
include/linux/pm.h +1 -0
+		__suspend_report_result(__func__, fn, ret,

false); \

include/linux/pm.h +3 -0
+	} while (0)
+
+#define rpm_suspend_report_result(fn, ret)			
	\
include/linux/pm.h +1 -0
+	do {							
	\
include/linux/pm.h +1 -0
+		__suspend_report_result(__func__, fn, ret,

true); \
   } while (0)

  extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);

include/linux/pm.h +0 -0
@@ -744,6 +750,7 @@ static inline int
 dpm_suspend_start(pm_message_t state)
   }


  #define suspend_report_result(fn, ret) do {}
while (0)
+#define rpm_suspend_report_result(fn, ret) do {}
while (0)

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

  static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
  {

BTW, if you're changing PM code, it is good to CC linux-pm too (now done) and if you're changing PCI code, it is mandatory to CC linux- pci
and the PCI maintainer (now done too).

Sorry, I thought about it too after sending it. Will do so in the future.

--Imre

author
#8 lore raw

PATCH v3 1/1 PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

In reply to Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-driver.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +13 -2
index 4446fcb..67eb4ac 100644
@@ -1146,9 +1146,20 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so don't flag it as an error.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			printk(KERN_DEBUG "%s(): %pF returns %d\n", __func__,
+			       pm->runtime_suspend, error);
+		else
+			printk(KERN_ERR "%s(): %pF returns %d\n", __func__,
+			       pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 1 line
2.5.0
#9 lore raw
Quoted 31 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-driver.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +0 -0
index 4446fcb..67eb4ac 100644

drivers/pci/pci-driver.c static int pci_pm_runtime_suspend(struct device *dev) · line 1153

Quoted 10 lines
drivers/pci/pci-driver.c +5 -2
@@ -1146,9 +1146,20 @@ static int pci_pm_runtime_suspend(struct device *dev)
        pci_dev->state_saved = false;
        pci_dev->no_d3cold = false;
        error = pm->runtime_suspend(dev);
-       suspend_report_result(pm->runtime_suspend, error);
-       if (error)
+       if (error) {
+               /*
+                * -EBUSY and -EAGAIN is used to request the runtime PM core
+                * to schedule a new suspend, so don't flag it as an error.
+                */

KERN_DEBUG and KERN_ERR are log levels, not flags.

Besides, maybe we can use pr_err() and pr_debug() here?

drivers/pci/pci-driver.c static int pci_pm_runtime_suspend(struct device *dev)

Quoted 13 lines
drivers/pci/pci-driver.c +8 -1
+               if (error == -EBUSY || error == -EAGAIN)
+                       printk(KERN_DEBUG "%s(): %pF returns %d\n", __func__,
+                              pm->runtime_suspend, error);
+               else
+                       printk(KERN_ERR "%s(): %pF returns %d\n", __func__,
+                              pm->runtime_suspend, error);
+
                return error;
+       }
        if (!pci_dev->d3cold_allowed)
                pci_dev->no_d3cold = true;
 
--

Thanks,
Rafael

author
#10 lore raw

PATCH v4 1/1 PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

In reply to Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +14 -2
index 4446fcb..32a9947 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			pr_debug("%s(): %pF returns %d\n", __func__,
+				 pm->runtime_suspend, error);
+		else
+			pr_err("%s(): %pF returns %d\n", __func__,
+			       pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 1 line
2.5.0
#11 lore raw
Quoted 20 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael)

Quoted 5 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>

This is fine by me.

Bjorn, any objections against applying it? It reduces log noise quite a bit for i915.

Quoted 23 lines
---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +8 -2
index 4446fcb..32a9947 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			pr_debug("%s(): %pF returns %d\n", __func__,

drivers/pci/pci-driver.c static int pci_pm_runtime_suspend(struct device *dev) · line 1166

Quoted 10 lines
drivers/pci/pci-driver.c +6 -0
+				 pm->runtime_suspend, error);
+		else
+			pr_err("%s(): %pF returns %d\n", __func__,
+			       pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 

Thanks,
Rafael

#12 lore raw
In reply to Imre Deak

Hi Imre,

Quoted 1 line

PCI / PM: tune down RPM suspend error message with EBUSY and EAGAIN retval

Please capitalize the first word, e.g., "Tune ..."

Maybe "Tune down non-fatal runtime suspend error messages" would be more to the point. Or maybe "retryable," since it sounds like that's what's supposed to happen.

Quoted 3 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down.

I looked briefly for the place in the runtime PM core where we handle EBUSY and EAGAIN specially, but I didn't find it. A pointer would be helpful.

Quoted 6 lines

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Quoted 9 lines

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael)

The version history is very useful during development but not after merging, so I prefer it to go after the "---" marker so it doesn't get included in the permanent changelog.

Quoted 21 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +2 -2
index 4446fcb..32a9947 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*

drivers/pci/pci-driver.c static int pci_pm_runtime_suspend(struct device *dev) · line 1160

Quoted 10 lines
drivers/pci/pci-driver.c +10 -0
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			pr_debug("%s(): %pF returns %d\n", __func__,
+				 pm->runtime_suspend, error);
+		else
+			pr_err("%s(): %pF returns %d\n", __func__,
+			       pm->runtime_suspend, error);

This looks fine to me in principle.

We have the device pointer, so please use dev_printk(KERN_DEBUG) and dev_err(). If you're OK with changing the semantics so the debug message is only emitted when dynamically enabled, you could use dev_dbg().

I don't know what a user is supposed to do with a message like:

pci_pm_runtime_suspend(): ata_port_runtime_suspend+0x0/0x200 returns -12

It feels a little bit ... internal. Using dev_err() will help anchor it to a specific device. It's not related to a specific PC in the function, so maybe use %pf instead of %pF to get rid of the function offset and size. And the message doesn't say anything about what the return code *means*; maybe something like:

ata_piix 0000:00:14.0: can't suspend now (ata_port_runtime_suspend returned -11) ata_piix 0000:00:14.0: can't suspend (ata_port_runtime_suspend returned -12)

Quoted 13 lines
drivers/pci/pci-driver.c +2 -0
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#13 lore raw

PATCH v5 1/1 PCI / PM: Tune down retryable runtime suspend error messages

In reply to Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down. See rpm_suspend() for details of handling these return values.

Note that we use dev_dbg() for the retryable retvals, so after this change you'll need either CONFIG_DYNAMIC_DEBUG or CONFIG_PCI_DEBUG for them to show up in the log.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>

---

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael) v5:
- clarify commit message (Bjorn)
- use dev_dbg, dev_err instead of pr_debug, pr_err (Bjorn)
- use %pf in printk format instead of %pF (Bjorn)
- make the debug/error messages more meaningful (Bjorn)

---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +14 -2
index 4446fcb..d7ffd66 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			dev_dbg(dev, "can't suspend now (%pf returned %d)\n",
+				pm->runtime_suspend, error);
+		else
+			dev_err(dev, "can't suspend (%pf returned %d)\n",
+				pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 1 line
2.5.0
#14 lore raw

Re: [PATCH v5] PCI / PM: Tune down retryable runtime suspend error messages

Quoted 14 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down. See rpm_suspend() for details of handling these return values.

Note that we use dev_dbg() for the retryable retvals, so after this change you'll need either CONFIG_DYNAMIC_DEBUG or CONFIG_PCI_DEBUG for them to show up in the log.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Quoted 5 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>

Hi Bjorn,

Are you going to handle this one or should I take care of it?

Rafael

Quoted 49 lines

---

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael) v5:
- clarify commit message (Bjorn)
- use dev_dbg, dev_err instead of pr_debug, pr_err (Bjorn)
- use %pf in printk format instead of %pF (Bjorn)
- make the debug/error messages more meaningful (Bjorn)

---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +14 -2
index 4446fcb..d7ffd66 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			dev_dbg(dev, "can't suspend now (%pf returned %d)\n",
+				pm->runtime_suspend, error);
+		else
+			dev_err(dev, "can't suspend (%pf returned %d)\n",
+				pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
Acked-by
#15 lore raw

Re: [PATCH v5] PCI / PM: Tune down retryable runtime suspend error messages

Quoted 21 lines · Rafael J. Wysocki
Quoted 14 lines · Imre Deak

The runtime PM core doesn't treat EBUSY and EAGAIN retvals from the driver suspend hooks as errors, but they still show up as errors in dmesg. Tune them down. See rpm_suspend() for details of handling these return values.

Note that we use dev_dbg() for the retryable retvals, so after this change you'll need either CONFIG_DYNAMIC_DEBUG or CONFIG_PCI_DEBUG for them to show up in the log.

One problem caused by this was noticed by Daniel: the i915 driver returns EAGAIN to signal a temporary failure to suspend and as a request towards the RPM core for scheduling a suspend again. This is a normal event, but the resulting error message flags a breakage during the driver's automated testing which parses dmesg and picks up the error.

Quoted 5 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92992

CC Bjorn Helgaas <[email protected]>
CC Rafael J. Wysocki <[email protected]>
Quoted 3 lines

Hi Bjorn,

Are you going to handle this one or should I take care of it?

Why don't you take it, since you're the PM guru :)

Thanks for all your work, Imre!

Quoted 41 lines
Quoted 41 lines

---

v2:
- fix compile breake when CONFIG_PM_SLEEP=n (0-day builder) v3:
- instead of modifying the suspend_report_result() helper to disinguish between the runtime and system suspend case, inline the error printing, it's not used anywhere else (Rafael)
v4:
- don't refer to log levels as flags in code comment (Rafael)
- use pr_debug(), pr_err() instead of the corresponding printk() (Rafael) v5:
- clarify commit message (Bjorn)
- use dev_dbg, dev_err instead of pr_debug, pr_err (Bjorn)
- use %pf in printk format instead of %pF (Bjorn)
- make the debug/error messages more meaningful (Bjorn)

---
 drivers/pci/pci-driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +11 -2
index 4446fcb..d7ffd66 100644
@@ -1146,9 +1146,21 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	pci_dev->state_saved = false;
 	pci_dev->no_d3cold = false;
 	error = pm->runtime_suspend(dev);
-	suspend_report_result(pm->runtime_suspend, error);
-	if (error)
+	if (error) {
+		/*
+		 * -EBUSY and -EAGAIN is used to request the runtime PM core
+		 * to schedule a new suspend, so log the event only with debug
+		 * log level.
+		 */
+		if (error == -EBUSY || error == -EAGAIN)
+			dev_dbg(dev, "can't suspend now (%pf returned %d)\n",
+				pm->runtime_suspend, error);
+		else
+			dev_err(dev, "can't suspend (%pf returned %d)\n",
Quoted 16 lines
Quoted 8 lines
drivers/pci/pci-driver.c +3 -0
+				pm->runtime_suspend, error);
+
 		return error;
+	}
 	if (!pci_dev->d3cold_allowed)
 		pci_dev->no_d3cold = true;
 
Signature · 6 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx