All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software
	Suspend, aka swsusp))
Subject: [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test
Date: Thu, 23 Sep 2021 11:51:05 -0700	[thread overview]
Message-ID: <20210923185106.501848-1-f.fainelli@gmail.com> (raw)

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


             reply	other threads:[~2021-09-23 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 18:51 Florian Fainelli [this message]
2021-09-23 19:29 ` [PATCH] PM / Suspend: Avoid soft lockup warning with suspend_test Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210923185106.501848-1-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.