rcutorture: Avoid soft lockup during cpu stall
authorWander Lairson Costa <wander@redhat.com>
Wed, 10 Nov 2021 14:37:45 +0000 (11:37 -0300)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 8 Dec 2021 00:36:17 +0000 (16:36 -0800)
If we use the module stall_cpu option, we may get a soft lockup warning
in case we also don't pass the stall_cpu_block option.

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@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcutorture.c

index 36a273589a35c60eb7941a1c1686d6aeae1478c5..bc854f93554886d51cb8ba510091c6ba230553ea 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/oom.h>
 #include <linux/tick.h>
 #include <linux/rcupdate_trace.h>
+#include <linux/nmi.h>
 
 #include "rcu.h"
 
@@ -112,6 +113,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,
@@ -2085,6 +2088,8 @@ static int rcu_torture_stall(void *args)
 #else
                                schedule_timeout_uninterruptible(HZ);
 #endif
+                       } else if (stall_no_softlockup) {
+                               touch_softlockup_watchdog();
                        }
                if (stall_cpu_irqsoff)
                        local_irq_enable();