From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
rushikesh.s.kadam@intel.com, urezki@gmail.com,
neeraj.iitr10@gmail.com, frederic@kernel.org, paulmck@kernel.org,
rostedt@goodmis.org, rcu@vger.kernel.org
Subject: [PATCH v3 resend 5/6] rcutorture: Add test code for call_rcu_lazy()
Date: Tue, 9 Aug 2022 03:45:16 +0000 [thread overview]
Message-ID: <20220809034517.3867176-6-joel@joelfernandes.org> (raw)
In-Reply-To: <20220809034517.3867176-1-joel@joelfernandes.org>
We add a new RCU type to test call_rcu_lazy(). This allows us to just
override the '.call' callback. To compensate for the laziness, we force
the laziness to a small number of jiffies. The idea of this test is to
stress the new code paths for stability and ensure it at least is providing
behavior in parity with, or similar to, call_rcu(). The actual check for
amount of laziness is in another test (rcuscale).
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
kernel/rcu/rcu.h | 1 +
kernel/rcu/rcutorture.c | 60 ++++++++++++++++++-
kernel/rcu/tree.c | 1 +
.../selftests/rcutorture/configs/rcu/CFLIST | 1 +
.../selftests/rcutorture/configs/rcu/TREE11 | 18 ++++++
.../rcutorture/configs/rcu/TREE11.boot | 8 +++
6 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE11
create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE11.boot
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 608f6ab76c7f..aa3243e49506 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -460,6 +460,7 @@ enum rcutorture_type {
RCU_TASKS_TRACING_FLAVOR,
RCU_TRIVIAL_FLAVOR,
SRCU_FLAVOR,
+ RCU_LAZY_FLAVOR,
INVALID_RCU_FLAVOR
};
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 7120165a9342..c52cc4c064f9 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -872,6 +872,64 @@ static struct rcu_torture_ops tasks_rude_ops = {
#endif // #else #ifdef CONFIG_TASKS_RUDE_RCU
+#ifdef CONFIG_RCU_LAZY
+
+/*
+ * Definitions for lazy RCU torture testing.
+ */
+static unsigned long orig_jiffies_till_flush;
+
+static void rcu_sync_torture_init_lazy(void)
+{
+ rcu_sync_torture_init();
+
+ orig_jiffies_till_flush = rcu_lazy_get_jiffies_till_flush();
+ rcu_lazy_set_jiffies_till_flush(50);
+}
+
+static void rcu_lazy_cleanup(void)
+{
+ rcu_lazy_set_jiffies_till_flush(orig_jiffies_till_flush);
+}
+
+static struct rcu_torture_ops rcu_lazy_ops = {
+ .ttype = RCU_LAZY_FLAVOR,
+ .init = rcu_sync_torture_init_lazy,
+ .cleanup = rcu_lazy_cleanup,
+ .readlock = rcu_torture_read_lock,
+ .read_delay = rcu_read_delay,
+ .readunlock = rcu_torture_read_unlock,
+ .readlock_held = torture_readlock_not_held,
+ .get_gp_seq = rcu_get_gp_seq,
+ .gp_diff = rcu_seq_diff,
+ .deferred_free = rcu_torture_deferred_free,
+ .sync = synchronize_rcu,
+ .exp_sync = synchronize_rcu_expedited,
+ .get_gp_state = get_state_synchronize_rcu,
+ .start_gp_poll = start_poll_synchronize_rcu,
+ .poll_gp_state = poll_state_synchronize_rcu,
+ .cond_sync = cond_synchronize_rcu,
+ .call = call_rcu_lazy,
+ .cb_barrier = rcu_barrier,
+ .fqs = rcu_force_quiescent_state,
+ .stats = NULL,
+ .gp_kthread_dbg = show_rcu_gp_kthreads,
+ .check_boost_failed = rcu_check_boost_fail,
+ .stall_dur = rcu_jiffies_till_stall_check,
+ .irq_capable = 1,
+ .can_boost = IS_ENABLED(CONFIG_RCU_BOOST),
+ .extendables = RCUTORTURE_MAX_EXTEND,
+ .name = "rcu_lazy"
+};
+
+#define LAZY_OPS &rcu_lazy_ops,
+
+#else // #ifdef CONFIG_RCU_LAZY
+
+#define LAZY_OPS
+
+#endif // #else #ifdef CONFIG_RCU_LAZY
+
#ifdef CONFIG_TASKS_TRACE_RCU
@@ -3145,7 +3203,7 @@ rcu_torture_init(void)
unsigned long gp_seq = 0;
static struct rcu_torture_ops *torture_ops[] = {
&rcu_ops, &rcu_busted_ops, &srcu_ops, &srcud_ops, &busted_srcud_ops,
- TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+ TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS LAZY_OPS
&trivial_ops,
};
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index e76fef8031be..67026382dc21 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -600,6 +600,7 @@ void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
{
switch (test_type) {
case RCU_FLAVOR:
+ case RCU_LAZY_FLAVOR:
*flags = READ_ONCE(rcu_state.gp_flags);
*gp_seq = rcu_seq_current(&rcu_state.gp_seq);
break;
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
index 98b6175e5aa0..609c3370616f 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
+++ b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
@@ -5,6 +5,7 @@ TREE04
TREE05
TREE07
TREE09
+TREE11
SRCU-N
SRCU-P
SRCU-T
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE11 b/tools/testing/selftests/rcutorture/configs/rcu/TREE11
new file mode 100644
index 000000000000..436013f3e015
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE11
@@ -0,0 +1,18 @@
+CONFIG_SMP=y
+CONFIG_PREEMPT_NONE=n
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=y
+#CHECK#CONFIG_PREEMPT_RCU=y
+CONFIG_HZ_PERIODIC=n
+CONFIG_NO_HZ_IDLE=y
+CONFIG_NO_HZ_FULL=n
+CONFIG_RCU_TRACE=y
+CONFIG_HOTPLUG_CPU=y
+CONFIG_MAXSMP=y
+CONFIG_CPUMASK_OFFSTACK=y
+CONFIG_RCU_NOCB_CPU=y
+CONFIG_DEBUG_LOCK_ALLOC=n
+CONFIG_RCU_BOOST=n
+CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
+CONFIG_RCU_EXPERT=y
+CONFIG_RCU_LAZY=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/TREE11.boot b/tools/testing/selftests/rcutorture/configs/rcu/TREE11.boot
new file mode 100644
index 000000000000..9b6f720d4ccd
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/rcu/TREE11.boot
@@ -0,0 +1,8 @@
+maxcpus=8 nr_cpus=43
+rcutree.gp_preinit_delay=3
+rcutree.gp_init_delay=3
+rcutree.gp_cleanup_delay=3
+rcu_nocbs=0-7
+rcutorture.torture_type=rcu_lazy
+rcutorture.nocbs_nthreads=8
+rcutorture.fwd_progress=0
--
2.37.1.559.g78731f0fdb-goog
next prev parent reply other threads:[~2022-08-09 3:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-09 3:45 [PATCH v3 resend 0/6] Implement call_rcu_lazy() and miscellaneous fixes Joel Fernandes (Google)
2022-08-09 3:45 ` [PATCH v3 resend 1/6] rcu: Introduce call_rcu_lazy() API implementation Joel Fernandes (Google)
2022-08-09 3:45 ` [PATCH v3 resend 2/6] rcu: shrinker for lazy rcu Joel Fernandes (Google)
2022-08-09 3:45 ` [PATCH v3 resend 3/6] rcuscale: Add laziness and kfree tests Joel Fernandes (Google)
2022-08-09 3:45 ` [PATCH v3 resend 4/6] fs: Move call_rcu() to call_rcu_lazy() in some paths Joel Fernandes (Google)
2022-08-18 17:22 ` Joel Fernandes
2022-08-18 17:23 ` Joel Fernandes
2022-08-18 23:05 ` Joel Fernandes
2022-08-19 1:21 ` Joel Fernandes
2022-08-19 1:29 ` Joel Fernandes
2022-08-19 2:35 ` Paul E. McKenney
2022-08-19 2:45 ` Joel Fernandes
2022-08-19 16:30 ` Joel Fernandes
2022-08-19 17:12 ` Paul E. McKenney
2022-08-19 18:14 ` Joel Fernandes
2022-08-19 18:17 ` Joel Fernandes
2022-08-19 18:26 ` Paul E. McKenney
2022-08-19 18:29 ` Joel Fernandes
2022-08-19 19:40 ` Joel Fernandes
2022-08-19 19:58 ` Paul E. McKenney
2022-08-19 20:13 ` Joel Fernandes
2022-08-09 3:45 ` Joel Fernandes (Google) [this message]
2022-08-09 3:45 ` [PATCH v3 resend 6/6] debug: Toggle lazy at runtime and change flush jiffies Joel Fernandes (Google)
2022-08-11 2:23 ` [PATCH v3 resend 0/6] Implement call_rcu_lazy() and miscellaneous fixes Joel Fernandes
2022-08-11 2:31 ` Joel Fernandes
2022-08-11 2:51 ` Paul E. McKenney
2022-08-11 3:22 ` Joel Fernandes
2022-08-11 3:46 ` Paul E. McKenney
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=20220809034517.3867176-6-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.iitr10@gmail.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=rushikesh.s.kadam@intel.com \
--cc=urezki@gmail.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
all inboxes | Powered by JetHome®