[PATCH 04/17] powerpc/qspinlock: convert atomic operations to assembly
Nicholas Piggin
npiggin at gmail.com
Thu Nov 10 22:48:54 AEDT 2022
On Thu Nov 10, 2022 at 6:36 PM AEST, Christophe Leroy wrote:
>
>
> Le 10/11/2022 à 01:39, Jordan Niethe a écrit :
> >> +static __always_inline int trylock_clear_tail_cpu(struct qspinlock *lock, u32 old)
> >> {
> >> - int newval = _Q_LOCKED_VAL;
> >> -
> >> - if (atomic_cmpxchg_acquire(&lock->val, val, newval) == val)
> >> + u32 new = _Q_LOCKED_VAL;
> >> + u32 prev;
> >> +
> >> + BUG_ON(old & _Q_LOCKED_VAL);
> >
> > The BUG_ON() could have been introduced in an earlier patch I think.
>
> Can we avoid the BUG_ON() at all and replace by a WARN_ON ?
Lock has gone wrong here. Critical sections not working means data
corruption and little prospect of continuing to run.
Thanks,
Nick
More information about the Linuxppc-dev
mailing list