[PATCH] rcutorture: Avoid soft lockup during cpu stall

From: wander
Date: Tue Nov 09 2021 - 12:47:12 EST


From: Wander Lairson Costa <wander@xxxxxxxxxx>

If we use the module stall_cpu option, we may get a soft lockup warning
if we also don't pass the stall_cpu_block option.

We introduce the stall_no_softlockup option to avoid a soft lockup on
cpu stall even if we don't use the stall_cpu_block option.

Signed-off-by: Wander Lairson Costa <wander@xxxxxxxxxx>
---
kernel/rcu/rcutorture.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 40ef5417d954..0a2a9a6533d1 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -10,6 +10,7 @@
* See also: Documentation/RCU/torture.rst
*/

+#include "linux/nmi.h"
#define pr_fmt(fmt) fmt

#include <linux/types.h>
@@ -109,6 +110,8 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");
torture_param(int, stall_cpu, 0, "Stall duration (s), zero to disable.");
torture_param(int, stall_cpu_holdoff, 10,
"Time to wait before starting stall (s).");
+torture_param(bool, stall_no_softlockup, false,
+ "Avoid softlockup warning during cpu stall.");
torture_param(int, stall_cpu_irqsoff, 0, "Disable interrupts while stalling.");
torture_param(int, stall_cpu_block, 0, "Sleep while stalling.");
torture_param(int, stall_gp_kthread, 0,
@@ -2024,6 +2027,8 @@ static int rcu_torture_stall(void *args)
stop_at))
if (stall_cpu_block)
schedule_timeout_uninterruptible(HZ);
+ else if (stall_no_softlockup)
+ touch_softlockup_watchdog();
if (stall_cpu_irqsoff)
local_irq_enable();
else if (!stall_cpu_block)
--
2.27.0