Re: [PATCH 1/2] vmw_vmci: Clean up uses of atomic*_set()
From: Andrea Parri
Date: Fri May 24 2019 - 07:59:20 EST
On Fri, May 24, 2019 at 12:39:34PM +0200, Peter Zijlstra wrote:
> On Fri, May 24, 2019 at 12:35:35PM +0200, Andrea Parri wrote:
> > The primitive vmci_q_set_pointer() relies on atomic*_set() being of
> > type 'void', but this is a non-portable implementation detail.
> >
> > Reported-by: Mark Rutland <mark.rutland@xxxxxxx>
> > Signed-off-by: Andrea Parri <andrea.parri@xxxxxxxxxxxxxxxxxxxx>
> > Cc: Arnd Bergmann <arnd@xxxxxxxx>
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Cc: Jorgen Hansen <jhansen@xxxxxxxxxx>
> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Cc: Will Deacon <will.deacon@xxxxxxx>
> > Cc: Mark Rutland <mark.rutland@xxxxxxx>
> > Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxx>
> > ---
> > include/linux/vmw_vmci_defs.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/vmw_vmci_defs.h b/include/linux/vmw_vmci_defs.h
> > index 0c06178e4985b..eb593868e2e9e 100644
> > --- a/include/linux/vmw_vmci_defs.h
> > +++ b/include/linux/vmw_vmci_defs.h
> > @@ -759,9 +759,9 @@ static inline void vmci_q_set_pointer(atomic64_t *var,
> > u64 new_val)
> > {
> > #if defined(CONFIG_X86_32)
> > - return atomic_set((atomic_t *)var, (u32)new_val);
> > + atomic_set((atomic_t *)var, (u32)new_val);
> > #else
> > - return atomic64_set(var, new_val);
> > + atomic64_set(var, new_val);
> > #endif
> > }
>
> All that should just die a horrible death. That code is crap.
>
> See:
>
> lkml.kernel.org/r/20190524103731.GN2606@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I see, that was indeed 'racy' with my patch! ;-) Thank you!
Andrea