Thread (78 messages) flat view 78 messages, 4 authors, 2022-11-10

Re: [PATCH 04/17] powerpc/qspinlock: convert atomic operations to assembly

From: "Nicholas Piggin" <npiggin@gmail.com>
Date: 2022-11-10 11:50:03

On Thu Nov 10, 2022 at 6:36 PM AEST, Christophe Leroy wrote:

Le 10/11/2022 à 01:39, Jordan Niethe a écrit :
quoted
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help