linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test
@ 2021-09-23 18:51 Florian Fainelli
  2021-09-23 19:29 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2021-09-23 18:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, Rafael J. Wysocki, Pavel Machek, Len Brown,
	open list:HIBERNATION (aka Software Suspend, aka swsusp)

When testing with a large (>= 22 seconds) pm_test_delay we can see the
NMI soft lockup barfing at us because a task has been blocked for too
long. This can be reproduced with:

	echo devices > /sys/power/pm_test
	echo 30 > /sys/module/suspend/parameters/pm_test_delay

Unroll the loop and touch the NMI watchdog every 1s to avoid the lockup
warnings.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 kernel/power/suspend.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index eb75f394a059..7441f0011ccd 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -30,6 +30,7 @@
 #include <trace/events/power.h>
 #include <linux/compiler.h>
 #include <linux/moduleparam.h>
+#include <linux/nmi.h>
 
 #include "power.h"
 
@@ -324,10 +325,15 @@ MODULE_PARM_DESC(pm_test_delay,
 static int suspend_test(int level)
 {
 #ifdef CONFIG_PM_DEBUG
+	unsigned int i;
+
 	if (pm_test_level == level) {
 		pr_info("suspend debug: Waiting for %d second(s).\n",
 				pm_test_delay);
-		mdelay(pm_test_delay * 1000);
+		for (i = 0; i < pm_test_delay; i++) {
+			mdelay(1000);
+			touch_nmi_watchdog();
+		}
 		return 1;
 	}
 #endif /* !CONFIG_PM_DEBUG */
-- 
2.25.1


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

* Re: [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test
  2021-09-23 18:51 [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test Florian Fainelli
@ 2021-09-23 19:29 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2021-09-23 19:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown,
	open list:HIBERNATION (aka Software Suspend, aka swsusp)

On 9/23/21 11:51 AM, Florian Fainelli wrote:
> When testing with a large (>= 22 seconds) pm_test_delay we can see the
> NMI soft lockup barfing at us because a task has been blocked for too
> long. This can be reproduced with:
> 
> 	echo devices > /sys/power/pm_test
> 	echo 30 > /sys/module/suspend/parameters/pm_test_delay
> 
> Unroll the loop and touch the NMI watchdog every 1s to avoid the lockup
> warnings.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Looks like I cannot reproduce the NMI soft lockup warnings with 5.10 and
newer, however I can easily trigger RCU stalls. Let me sleep on it for a
bit and see what needs fixing in 5.15 and newer. Any feedback welcome.
-- 
Florian

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

end of thread, other threads:[~2021-09-23 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 18:51 [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test Florian Fainelli
2021-09-23 19:29 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).