[PATCH 13/14] compiler-context-analysis: Split the RCU assertion tests
From: Bart Van Assche
Date: Mon Nov 02 2026 - 16:36:46 EST
Split test_rcu_assert_variants() in lib/test_context-analysis.c into
test_rcu_assert(), test_rcu_assert_bh() and test_rcu_assert_sched() such
that each RCU assertion variant is tested independently. Add
test_rcu_assert_reader() to test lockdep_assert_in_rcu_reader().
Cc: Marco Elver <elver@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
lib/test_context-analysis.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/test_context-analysis.c b/lib/test_context-analysis.c
index 022891999c9c..048b839bae92 100644
--- a/lib/test_context-analysis.c
+++ b/lib/test_context-analysis.c
@@ -464,18 +464,30 @@ static void __used test_rcu_lock_reentrant(void)
rcu_read_unlock();
}
-static void __used test_rcu_assert_variants(void)
+static void __used test_rcu_assert(void)
{
lockdep_assert_in_rcu_read_lock();
wants_rcu_held();
+}
+static void __used test_rcu_assert_bh(void)
+{
lockdep_assert_in_rcu_read_lock_bh();
wants_rcu_held_bh();
+}
+static void __used test_rcu_assert_sched(void)
+{
lockdep_assert_in_rcu_read_lock_sched();
wants_rcu_held_sched();
}
+static void __used test_rcu_assert_reader(void)
+{
+ lockdep_assert_in_rcu_reader();
+ wants_rcu_held();
+}
+
struct test_srcu_data {
struct srcu_struct srcu;
long __rcu_guarded *data;