Re: [PATCH 2/2] locking/pvqspinlock: Use try_cmpxchg() in qspinlock_paravirt.h

From: Uros Bizjak
Date: Thu Apr 11 2024 - 09:36:17 EST


On Thu, Apr 11, 2024 at 3:24 PM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>
> * Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> > - locked = cmpxchg_release(&lock->locked, _Q_LOCKED_VAL, 0);
> > - if (likely(locked == _Q_LOCKED_VAL))
> > + if (try_cmpxchg_release(&lock->locked, &locked, 0);
> > return; ^------------ ???
>
> This doesn't appear to be a particularly well-tested patch. ;-)

Ouch, embarrassing... oh it is a generic function, conditionally compiled with

#ifndef __pv_queued_spin_lock
#endif

and x86 defines its own function ...

I concentrated on different settings of _Q_PENDING_BITS and the above
slipped through.

Thanks,
Uros.