Skip to contentSkip to conversation

Early boot self tests for RCU

PATCH Superseded Pranith Kumar 2 participants 6 messages Sep 19, 2014 – Oct 3, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Early boot self tests for RCU

Hi Paul,

Please find v2 of the RCU early boot tests. For now
all we do in these tests are enqueue test callbacks and check if they are being invoked or not.

I was able to reproduce the hang which Amit reported after reverting the fix. So this should catch such errors if they occur in the future.

I enabled the selftests in a few rcutorture configurations.

Thanks!
--
Pranith

v2: removed srcu tests and updated according to feedback

Pranith Kumar (3):
rcu: Add early boot self tests
doc: Document RCU self test boot params
rcutorture: Enable RCU self test in configs

 Documentation/kernel-parameters.txt                |  9 +++
 kernel/rcu/rcu.h                                   |  2 +
 kernel/rcu/tiny.c                                  |  4 +-
 kernel/rcu/tree.c                                  |  2 +
 kernel/rcu/update.c                                | 82 ++++++++++++++++++++++
 .../selftests/rcutorture/configs/rcu/TINY02        |  2 +
 .../selftests/rcutorture/configs/rcu/TINY02.boot   |  2 +
 .../selftests/rcutorture/configs/rcu/TREE05.boot   |  1 +
 .../selftests/rcutorture/configs/rcu/TREE06.boot   |  3 +
 .../selftests/rcutorture/configs/rcu/TREE08        |  2 +
 .../selftests/rcutorture/configs/rcu/TREE08.boot   |  2 +
 11 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TINY02.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot
Signature · 1 line
2.1.0
#1 lore raw

PATCH v2 1/1 rcu: Add early boot self tests

Add early boot self tests for RCU under CONFIG_PROVE_RCU.

Currently the only test is adding a dummy callback which increments a counter which we then later verify after calling rcu_barrier*().

---
 kernel/rcu/rcu.h    |  2 ++
 kernel/rcu/tiny.c   |  4 ++-
 kernel/rcu/tree.c   |  2 ++
 kernel/rcu/update.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 91 insertions(+), 1 deletion(-)
kernel/rcu/rcu.h +2 -0
index ff1a6de..07bb02e 100644
@@ -135,4 +135,6 @@ int rcu_jiffies_till_stall_check(void);
  */
 #define TPS(x)  tracepoint_string(x)
 
+void rcu_early_boot_tests(void);
+
 #endif /* __LINUX_RCU_H */
kernel/rcu/tiny.c +3 -1
index c0623fc..d3d44c5 100644
@@ -380,7 +380,9 @@ void call_rcu_bh(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
 }
 EXPORT_SYMBOL_GPL(call_rcu_bh);
 
-void rcu_init(void)
+void __init rcu_init(void)
 {
 	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
+
+	rcu_early_boot_tests();
 }
kernel/rcu/tree.c +2 -0
index bc085e5..3db8f15 100644
@@ -3774,6 +3774,8 @@ void __init rcu_init(void)
 	pm_notifier(rcu_pm_notify, 0);
 	for_each_online_cpu(cpu)
 		rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
+
+	rcu_early_boot_tests();
 }
 
 #include "tree_plugin.h"
kernel/rcu/update.c +84 -0

87 lines not on this page · raw message

Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 2/3 doc: Document RCU self test boot params

In reply to Pranith Kumar

Document the RCU self test boot parameters in kernel-parameters.txt.

---
 Documentation/kernel-parameters.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/kernel-parameters.txt +9 -0
index c403957..04df74e 100644
@@ -3054,6 +3054,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			messages.  Disable with a value less than or equal
 			to zero.
 
+	rcupdate.rcu_self_test= [KNL]
+			Run the RCU early boot self tests
+
+	rcupdate.rcu_self_test_bh= [KNL]
+			Run the RCU bh early boot self tests
+
+	rcupdate.rcu_self_test_sched= [KNL]
+			Run the RCU sched early boot self tests
+
 	rdinit=		[KNL]
 			Format: <full_path>
 			Run specified binary instead of /init from the ramdisk,
Signature · 1 line
2.1.0
#3 lore raw

Re: [PATCH v2 2/3] doc: Document RCU self test boot params

Quoted 3 lines · Pranith Kumar

Document the RCU self test boot parameters in kernel-parameters.txt.

I have this one queued, please let me know if this is an update.

Thanx, Paul

Quoted 33 lines
---
 Documentation/kernel-parameters.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/kernel-parameters.txt +9 -0
index c403957..04df74e 100644
@@ -3054,6 +3054,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			messages.  Disable with a value less than or equal
 			to zero.
 
+	rcupdate.rcu_self_test= [KNL]
+			Run the RCU early boot self tests
+
+	rcupdate.rcu_self_test_bh= [KNL]
+			Run the RCU bh early boot self tests
+
+	rcupdate.rcu_self_test_sched= [KNL]
+			Run the RCU sched early boot self tests
+
 	rdinit=		[KNL]
 			Format: <full_path>
 			Run specified binary instead of /init from the ramdisk,
Signature · 7 lines
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#4 lore raw

Re: [PATCH v2 2/3] doc: Document RCU self test boot params

Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Pranith Kumar

Document the RCU self test boot parameters in kernel-parameters.txt.

I have this one queued, please let me know if this is an update.

Hi Paul, this is the same one you have queued. Thanks!

Signature · 1 line
Pranith
#5 lore raw

PATCH v2 3/3 rcutorture: Enable RCU self test in configs

In reply to Pranith Kumar

Add config and boot parameters to enable the self tests in rcutorture testing.

---
 tools/testing/selftests/rcutorture/configs/rcu/TINY02      | 2 ++
 tools/testing/selftests/rcutorture/configs/rcu/TINY02.boot | 2 ++
 tools/testing/selftests/rcutorture/configs/rcu/TREE05.boot | 1 +
 tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot | 3 +++
 tools/testing/selftests/rcutorture/configs/rcu/TREE08      | 2 ++
 tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot | 2 ++
 6 files changed, 12 insertions(+)
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TINY02.boot
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot
tools/testing/selftests/rcutorture/configs/rcu/TINY02 +2 -0
index f4feaee..36e41df 100644
@@ -7,6 +7,8 @@ CONFIG_HZ_PERIODIC=y
 CONFIG_NO_HZ_IDLE=n
 CONFIG_NO_HZ_FULL=n
 CONFIG_RCU_TRACE=y
+CONFIG_PROVE_LOCKING=y
+CONFIG_PROVE_RCU=y
 CONFIG_DEBUG_LOCK_ALLOC=y
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
 CONFIG_PREEMPT_COUNT=y
tools/testing/selftests/rcutorture/configs/rcu/TINY02.boot new file +2 -0
new file mode 100644
index 0000000..0f08027
@@ -0,0 +1,2 @@
+rcupdate.rcu_self_test=1
+rcupdate.rcu_self_test_bh=1
tools/testing/selftests/rcutorture/configs/rcu/TREE05.boot +1 -0
index 3b42b8b..15b3e1a 100644
@@ -1 +1,2 @@
 rcutorture.torture_type=sched
+rcupdate.rcu_self_test_sched=1
tools/testing/selftests/rcutorture/configs/rcu/TREE06.boot new file +3 -0
new file mode 100644
index 0000000..da9a03a
@@ -0,0 +1,3 @@
+rcupdate.rcu_self_test=1
+rcupdate.rcu_self_test_bh=1
+rcupdate.rcu_self_test_sched=1
tools/testing/selftests/rcutorture/configs/rcu/TREE08 +2 -0
index 316aa6c..1a9303d 100644
@@ -18,6 +18,8 @@ CONFIG_RCU_FANOUT_LEAF=2
 CONFIG_RCU_NOCB_CPU=y
 CONFIG_RCU_NOCB_CPU_ALL=y
 CONFIG_DEBUG_LOCK_ALLOC=n
+CONFIG_PROVE_LOCKING=y
+CONFIG_PROVE_RCU=y
 CONFIG_RCU_CPU_STALL_INFO=n
 CONFIG_RCU_BOOST=n
 CONFIG_DEBUG_OBJECTS_RCU_HEAD=n
tools/testing/selftests/rcutorture/configs/rcu/TREE08.boot +2 -0
index 3b42b8b..2561daf 100644
@@ -1 +1,3 @@
 rcutorture.torture_type=sched
+rcupdate.rcu_self_test=1
+rcupdate.rcu_self_test_sched=1
Signature · 1 line
2.1.0