Skip to content

Commit

Permalink
radix tree test suite: Register the main thread with the RCU library
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew Wilcox (Oracle) committed Apr 1, 2021
1 parent 7487de5 commit 1bb4bd2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/radix-tree/idr-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,14 @@ void ida_tests(void)

int __weak main(void)
{
rcu_register_thread();
radix_tree_init();
idr_checks();
ida_tests();
radix_tree_cpu_dead(1);
rcu_barrier();
if (nr_allocated)
printf("nr_allocated = %d\n", nr_allocated);
rcu_unregister_thread();
return 0;
}
2 changes: 2 additions & 0 deletions tools/testing/radix-tree/multiorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ void multiorder_checks(void)

int __weak main(void)
{
rcu_register_thread();
radix_tree_init();
multiorder_checks();
rcu_unregister_thread();
return 0;
}
2 changes: 2 additions & 0 deletions tools/testing/radix-tree/xarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ void xarray_tests(void)

int __weak main(void)
{
rcu_register_thread();
radix_tree_init();
xarray_tests();
radix_tree_cpu_dead(1);
rcu_barrier();
if (nr_allocated)
printf("nr_allocated = %d\n", nr_allocated);
rcu_unregister_thread();
return 0;
}

0 comments on commit 1bb4bd2

Please sign in to comment.