Skip to content

Commit

Permalink
From patchwork series 421422
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Aug 29, 2024
1 parent ddf9a4c commit 495a83c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/powerpc/lib/qspinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,15 @@ static __always_inline void queued_spin_lock_mcs_queue(struct qspinlock *lock, b
}

release:
qnodesp->count--; /* release the node */
/*
* Clear the lock before releasing the node, as another CPU might see stale
* values if an interrupt occurs after we increment qnodesp->count
* but before node->lock is initialized. The barrier ensures that
* there are no further stores to the node after it has been released.
*/
node->lock = NULL;
barrier();
qnodesp->count--;
}

void queued_spin_lock_slowpath(struct qspinlock *lock)
Expand Down

0 comments on commit 495a83c

Please sign in to comment.