[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57309494-58bf-a11e-e4ac-e669e6af22f2@redhat.com>
Date: Mon, 18 May 2020 12:33:00 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Davidlohr Bueso <dave@...olabs.net>, tglx@...utronix.de
Cc: peterz@...radead.org, maz@...nel.org, bigeasy@...utronix.de,
rostedt@...dmis.org, torvalds@...ux-foundation.org,
will@...nel.org, joel@...lfernandes.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 4/5] rcuwait: Introduce rcuwait_active()
On 24/04/20 07:48, Davidlohr Bueso wrote:
> +/*
> + * Note: this provides no serialization and, just as with waitqueues,
> + * requires care to estimate as to whether or not the wait is active.
> + */
> +static inline int rcuwait_active(struct rcuwait *w)
> +{
> + return !!rcu_dereference(w->task);
> +}
This needs to be changed to rcu_access_pointer:
--------------- 8< -----------------
From: Paolo Bonzini <pbonzini@...hat.com>
Subject: [PATCH] rcuwait: avoid lockdep splats from rcuwait_active()
rcuwait_active only returns whether w->task is not NULL. This is
exactly one of the usecases that are mentioned in the documentation
for rcu_access_pointer() where it is correct to bypass lockdep checks.
This avoids a splat from kvm_vcpu_on_spin().
Reported-by: Wanpeng Li <kernellwp@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
index c1414ce44abc..61c56cca95c4 100644
--- a/include/linux/rcuwait.h
+++ b/include/linux/rcuwait.h
@@ -31,7 +31,7 @@ static inline void rcuwait_init(struct rcuwait *w)
*/
static inline int rcuwait_active(struct rcuwait *w)
{
- return !!rcu_dereference(w->task);
+ return !!rcu_access_pointer(w->task);
}
extern int rcuwait_wake_up(struct rcuwait *w);
Paolo
Powered by blists - more mailing lists