Skip to content

Conversation

@kkdwvd
Copy link
Collaborator

@kkdwvd kkdwvd commented Jan 21, 2026

No description provided.

The TAS fallback can be invoked directly when queued spin locks are
disabled, and through the slow path when paravirt is enabled for queued
spin locks. In the latter case, the res_spin_lock macro will attempt the
fast path and already hold the entry when entering the slow path. This
will lead to creation of extraneous entries that are not released, which
may cause false positives for deadlock detection.

Fix this by always preceding invocation of the TAS fallback in every
case with the grabbing of the held lock entry, and add a comment to make
note of this.

Fixes: c9102a6 ("rqspinlock: Add a test-and-set fallback")
Reported-by: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the deadlock detection entry management in the resilient spinlock implementation by moving the grab_held_lock_entry call from inside resilient_tas_spin_lock to its call sites.

Changes:

  • Removed grab_held_lock_entry call from resilient_tas_spin_lock function
  • Updated res_spin_lock macro to call grab_held_lock_entry before invoking resilient_tas_spin_lock
  • Updated comment to document that deadlock detection entry is grabbed at call sites

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
kernel/bpf/rqspinlock.c Removes the grab_held_lock_entry call and updates the comment to explain that the entry is grabbed at call sites
include/asm-generic/rqspinlock.h Updates the res_spin_lock macro to call grab_held_lock_entry before resilient_tas_spin_lock for non-queued spinlocks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf-next_base branch 4 times, most recently from 403c46b to 53953d6 Compare January 23, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants