Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@gmail.com>
Tested-by: Wanpeng Li <kernellwp@gmail.com>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+1 -1
+1 -1
include/linux/rcuwait.h
··· 31 31 */ 32 32 static inline int rcuwait_active(struct rcuwait *w) 33 33 { 34 - return !!rcu_dereference(w->task); 34 + return !!rcu_access_pointer(w->task); 35 35 } 36 36 37 37 extern int rcuwait_wake_up(struct rcuwait *w);