From 0b9c513b2513c37e3ed0a5ee047b8d40eef482ab Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 7 Sep 2016 22:11:53 -0400 Subject: [PATCH] Fix: rcutorture: work-around signal issue on mac os x Our MacOS X test machine with the following config: 15.6.0 Darwin Kernel Version 15.6.0 root:xnu-3248.60.10~1/RELEASE_X86_64 appears to have issues with liburcu-signal signal being delivered on top of pthread_cond_wait. It seems to make the thread continue, and therefore corrupt the rcu_head. Work around this issue by unregistering the RCU read-side thread immediately after call_rcu (call_rcu needs us to be registered RCU readers). Signed-off-by: Mathieu Desnoyers --- tests/regression/rcutorture.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/regression/rcutorture.h b/tests/regression/rcutorture.h index 053653f..db3dfad 100644 --- a/tests/regression/rcutorture.h +++ b/tests/regression/rcutorture.h @@ -368,9 +368,6 @@ void *rcu_update_stress_test(void *arg) struct rcu_stress *p; struct rcu_head rh; - rcu_register_thread(); - rcu_thread_offline(); - while (goflag == GOFLAG_INIT) (void) poll(NULL, 0, 1); while (goflag == GOFLAG_RUN) { @@ -399,7 +396,23 @@ void *rcu_update_stress_test(void *arg) strerror(errno)); abort(); } + rcu_register_thread(); call_rcu(&rh, rcu_update_stress_test_rcu); + rcu_unregister_thread(); + /* + * Our MacOS X test machine with the following + * config: + * 15.6.0 Darwin Kernel Version 15.6.0 + * root:xnu-3248.60.10~1/RELEASE_X86_64 + * appears to have issues with liburcu-signal + * signal being delivered on top of + * pthread_cond_wait. It seems to make the + * thread continue, and therefore corrupt the + * rcu_head. Work around this issue by + * unregistering the RCU read-side thread + * immediately after call_rcu (call_rcu needs + * us to be registered RCU readers). + */ ret = pthread_cond_wait(&call_rcu_test_cond, &call_rcu_test_mutex); if (ret) { @@ -419,8 +432,6 @@ void *rcu_update_stress_test(void *arg) n_updates++; } - rcu_thread_online(); - rcu_unregister_thread(); return NULL; } -- 2.34.1