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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -524,6 +524,7 @@ static void test_callback(struct rcu_head *r) · 523 unmodified lines | ||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | DEFINE_STATIC_SRCU(early_srcu); |
| 527 | +static unsigned long early_srcu_cookie; | |
| 527 | 528 | |
| 528 | 529 | struct early_boot_kfree_rcu { |
| 529 | 530 | struct rcu_head rh; |
| @@ -536,8 +537,10 @@ static void early_boot_test_call_rcu(void) · 6 unmodified lines | ||
| 536 | 537 | struct early_boot_kfree_rcu *rhp; |
| 537 | 538 | |
| 538 | 539 | 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); | |
| 540 | 542 | call_srcu(&early_srcu, &shead, test_callback); |
| 543 | + } | |
| 541 | 544 | rhp = kmalloc(sizeof(*rhp), GFP_KERNEL); |
| 542 | 545 | if (!WARN_ON_ONCE(!rhp)) |
| 543 | 546 | kfree_rcu(rhp, rh); |
| @@ -563,6 +566,7 @@ static int rcu_verify_early_boot_tests(void) · 19 unmodified lines | ||
| 563 | 566 | if (IS_ENABLED(CONFIG_SRCU)) { |
| 564 | 567 | early_boot_test_counter++; |
| 565 | 568 | srcu_barrier(&early_srcu); |
| 569 | + WARN_ON_ONCE(!poll_state_synchronize_srcu(&early_srcu, early_srcu_cookie)); | |
| 566 | 570 | } |
| 567 | 571 | } |
| 568 | 572 | if (rcu_self_test_counter != early_boot_test_counter) { |