Skip to content

Commit 1bb4bd2

Browse files
author
Matthew Wilcox (Oracle)
committed
radix tree test suite: Register the main thread with the RCU library
Several test runners register individual worker threads with the RCU library, but neglect to register the main thread, which can lead to objects being freed while the main thread is in what appears to be an RCU critical section. Reported-by: Chris von Recklinghausen <crecklin@redhat.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
1 parent 7487de5 commit 1bb4bd2

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

tools/testing/radix-tree/idr-test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,14 @@ void ida_tests(void)
577577

578578
int __weak main(void)
579579
{
580+
rcu_register_thread();
580581
radix_tree_init();
581582
idr_checks();
582583
ida_tests();
583584
radix_tree_cpu_dead(1);
584585
rcu_barrier();
585586
if (nr_allocated)
586587
printf("nr_allocated = %d\n", nr_allocated);
588+
rcu_unregister_thread();
587589
return 0;
588590
}

tools/testing/radix-tree/multiorder.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ void multiorder_checks(void)
224224

225225
int __weak main(void)
226226
{
227+
rcu_register_thread();
227228
radix_tree_init();
228229
multiorder_checks();
230+
rcu_unregister_thread();
229231
return 0;
230232
}

tools/testing/radix-tree/xarray.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ void xarray_tests(void)
2525

2626
int __weak main(void)
2727
{
28+
rcu_register_thread();
2829
radix_tree_init();
2930
xarray_tests();
3031
radix_tree_cpu_dead(1);
3132
rcu_barrier();
3233
if (nr_allocated)
3334
printf("nr_allocated = %d\n", nr_allocated);
35+
rcu_unregister_thread();
3436
return 0;
3537
}

0 commit comments

Comments
 (0)