From mboxrd@z Thu Jan 1 00:00:00 1970 From: pbonzini@redhat.com (Paolo Bonzini) Date: Sat, 27 Feb 2010 16:57:05 +0100 Subject: [ltt-dev] [PATCH 2/3] add rcu_thread_offline before rcu_unregister_thread In-Reply-To: <1267286226-7489-1-git-send-email-pbonzini@redhat.com> References: <1267286226-7489-1-git-send-email-pbonzini@redhat.com> Message-ID: <1267286226-7489-3-git-send-email-pbonzini@redhat.com> As mentioned in the previous commit message, rcu_thread_offline is useful to avoid deadlocks between rcu_unregister_thread and synchronize_rcu. Just like in urcu-qsbr.c, put a thread offline before it unregisters itself. An additional benefit is that a thread can unregister itself and register itself later without triggering the assertion in rcu_register_thread(). Signed-off-by: Paolo Bonzini --- urcu.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/urcu.c b/urcu.c index dee8b59..e82bf6c 100644 --- a/urcu.c +++ b/urcu.c @@ -383,6 +383,7 @@ void rcu_register_thread(void) void rcu_unregister_thread(void) { + _rcu_thread_offline(); mutex_lock(&rcu_gp_lock); list_del(&rcu_reader.head); mutex_unlock(&rcu_gp_lock); -- 1.6.6