Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: rcu@vger.kernel.org
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Shuah Khan <shuah@kernel.org>,
	Bhaskar Chowdhury <unixbhaskar@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel test robot <yujie.liu@intel.com>,
	Liam Howlett <liam.howlett@oracle.com>
Subject: [PATCH rcu v2 09/10] rcuscale: Move shutdown from wait_event() to wait_event_idle()
Date: Wed, 22 Mar 2023 21:39:34 -0700	[thread overview]
Message-ID: <20230323043935.1221184-10-boqun.feng@gmail.com> (raw)
In-Reply-To: <20230323043935.1221184-1-boqun.feng@gmail.com>

From: "Paul E. McKenney" <paulmck@kernel.org>

The rcu_scale_shutdown() and kfree_scale_shutdown() kthreads/functions
use wait_event() to wait for the rcuscale test to complete.  However,
each updater thread in such a test waits for at least 100 grace periods.
If each grace period takes more than 1.2 seconds, which is long, but
not insanely so, this can trigger the hung-task timeout.

This commit therefore replaces those wait_event() calls with calls to
wait_event_idle(), which do not trigger the hung-task timeout.

Reported-by: kernel test robot <yujie.liu@intel.com>
Reported-by: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Yujie Liu <yujie.liu@intel.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 kernel/rcu/rcuscale.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 91fb5905a008..4120f94030c3 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -631,8 +631,7 @@ static int compute_real(int n)
 static int
 rcu_scale_shutdown(void *arg)
 {
-	wait_event(shutdown_wq,
-		   atomic_read(&n_rcu_scale_writer_finished) >= nrealwriters);
+	wait_event_idle(shutdown_wq, atomic_read(&n_rcu_scale_writer_finished) >= nrealwriters);
 	smp_mb(); /* Wake before output. */
 	rcu_scale_cleanup();
 	kernel_power_off();
@@ -771,8 +770,8 @@ kfree_scale_cleanup(void)
 static int
 kfree_scale_shutdown(void *arg)
 {
-	wait_event(shutdown_wq,
-		   atomic_read(&n_kfree_scale_thread_ended) >= kfree_nrealthreads);
+	wait_event_idle(shutdown_wq,
+			atomic_read(&n_kfree_scale_thread_ended) >= kfree_nrealthreads);
 
 	smp_mb(); /* Wake before output. */
 
-- 
2.38.1


  parent reply	other threads:[~2023-03-23  4:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  4:39 [PATCH rcu v2 00/10] RCU torture test and tool updates for v6.4 Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 01/10] rcutorture: Add test_nmis module parameter Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 02/10] rcutorture: Set CONFIG_BOOTPARAM_HOTPLUG_CPU0 to offline CPU 0 Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 03/10] rcutorture: Make scenario TREE04 enable lazy call_rcu() Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 04/10] tools: rcu: Add usage function and check for argument Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 05/10] torture: Permit kvm-again.sh --duration to default to previous run Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 06/10] rcutorture: Eliminate variable n_rcu_torture_boost_rterror Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 07/10] torture: Enable clocksource watchdog with "tsc=watchdog" Boqun Feng
2023-03-23  4:39 ` [PATCH rcu v2 08/10] rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels Boqun Feng
2023-03-23  4:39 ` Boqun Feng [this message]
2023-03-23  4:39 ` [PATCH rcu v2 10/10] refscale: Move shutdown from wait_event() to wait_event_idle() Boqun Feng

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=20230323043935.1221184-10-boqun.feng@gmail.com \
    --to=boqun.feng@gmail.com \
    --cc=dave@stgolabs.net \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=unixbhaskar@gmail.com \
    --cc=yujie.liu@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox