All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcutorture: Avoid soft lockup during cpu stall
@ 2021-11-09 17:46 wander
  2021-11-09 20:37 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: wander @ 2021-11-09 17:46 UTC (permalink / raw)
  To: Davidlohr Bueso, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	open list:TORTURE-TEST MODULES, open list:READ-COPY UPDATE (RCU)
  Cc: Wander Lairson Costa

From: Wander Lairson Costa <wander@redhat.com>

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@redhat.com>
---
 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


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

* Re: [PATCH] rcutorture: Avoid soft lockup during cpu stall
  2021-11-09 17:46 [PATCH] rcutorture: Avoid soft lockup during cpu stall wander
@ 2021-11-09 20:37 ` Paul E. McKenney
  2021-11-10 12:24   ` Wander Costa
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2021-11-09 20:37 UTC (permalink / raw)
  To: wander
  Cc: Davidlohr Bueso, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	open list:TORTURE-TEST MODULES, open list:READ-COPY UPDATE (RCU)

On Tue, Nov 09, 2021 at 02:46:02PM -0300, wander@redhat.com wrote:
> From: Wander Lairson Costa <wander@redhat.com>
> 
> 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@redhat.com>

This looks plausible to me, though it would be good to hear others'
thoughts.  In the meantime, could you please forward-port this to
the "dev" branch of the -rcu tree?

https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/rcutodo.html

							Thanx, Paul

> ---
>  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
> 

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

* Re: [PATCH] rcutorture: Avoid soft lockup during cpu stall
  2021-11-09 20:37 ` Paul E. McKenney
@ 2021-11-10 12:24   ` Wander Costa
  0 siblings, 0 replies; 3+ messages in thread
From: Wander Costa @ 2021-11-10 12:24 UTC (permalink / raw)
  To: paulmck
  Cc: wander, Davidlohr Bueso, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	open list:TORTURE-TEST MODULES, open list:READ-COPY UPDATE (RCU)

On Tue, Nov 9, 2021 at 5:47 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Tue, Nov 09, 2021 at 02:46:02PM -0300, wander@redhat.com wrote:
> > From: Wander Lairson Costa <wander@redhat.com>
> >
> > 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@redhat.com>
>
> This looks plausible to me, though it would be good to hear others'
> thoughts.  In the meantime, could you please forward-port this to
> the "dev" branch of the -rcu tree?
>
> https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/rcutodo.html
>
>                                                         Thanx, Paul
>

Thank you for the feedback. I just sent a v2 against that applies to
the aforementioned branch.

Cheers,
Wander

[snip]


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

end of thread, other threads:[~2021-11-10 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 17:46 [PATCH] rcutorture: Avoid soft lockup during cpu stall wander
2021-11-09 20:37 ` Paul E. McKenney
2021-11-10 12:24   ` Wander Costa

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.