Skip to content

Commit 0a580fa

Browse files
Frederic Weisbeckerpaulmckrcu
authored andcommitted
srcu: Early test SRCU polling start
Place an early call to start_poll_synchronize_srcu() before the invocation of call_srcu() on the same srcu_struct structure. After the later call to srcu_barrier(), the completion of the first grace period should be visible to a subsequent invocation of poll_state_synchronize_srcu(), and if not, warn. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Cc: Neeraj Upadhyay <neeraju@codeaurora.org> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Joel Fernandes <joel@joelfernandes.org> Cc: Uladzislau Rezki <urezki@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent b5befe8 commit 0a580fa

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎kernel/rcu/update.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ static void test_callback(struct rcu_head *r)
524524
}
525525

526526
DEFINE_STATIC_SRCU(early_srcu);
527+
static unsigned long early_srcu_cookie;
527528

528529
struct early_boot_kfree_rcu {
529530
struct rcu_head rh;
@@ -536,8 +537,10 @@ static void early_boot_test_call_rcu(void)
536537
struct early_boot_kfree_rcu *rhp;
537538

538539
call_rcu(&head, test_callback);
539-
if (IS_ENABLED(CONFIG_SRCU))
540+
if (IS_ENABLED(CONFIG_SRCU)) {
541+
early_srcu_cookie = start_poll_synchronize_srcu(&early_srcu);
540542
call_srcu(&early_srcu, &shead, test_callback);
543+
}
541544
rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
542545
if (!WARN_ON_ONCE(!rhp))
543546
kfree_rcu(rhp, rh);
@@ -563,6 +566,7 @@ static int rcu_verify_early_boot_tests(void)
563566
if (IS_ENABLED(CONFIG_SRCU)) {
564567
early_boot_test_counter++;
565568
srcu_barrier(&early_srcu);
569+
WARN_ON_ONCE(!poll_state_synchronize_srcu(&early_srcu, early_srcu_cookie));
566570
}
567571
}
568572
if (rcu_self_test_counter != early_boot_test_counter) {

0 commit comments

Comments
 (0)