This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 2cf701086cbe55a54cf100985c6d403c329e8d94 Author: ligd <[email protected]> AuthorDate: Tue Mar 24 12:42:47 2026 +0800 spinlock: add sched_note_spinlock trace points to rspin_lock/rspin_unlock rspin_lock/rspin_unlock were missing sched_note_spinlock() trace points that spin_lock/spin_unlock already have. Add NOTE_SPINLOCK_LOCK, NOTE_SPINLOCK_LOCKED and NOTE_SPINLOCK_UNLOCK instrumentation to rspin_lock and rspin_unlock for symmetry with the non-recursive spinlock API. Only first-time acquisition and final release are traced, recursive lock/unlock are not instrumented. Assisted-By: mimo-v2.6-pro Co-authored-by: ouyangxiangzhen <[email protected]> Signed-off-by: ligd <[email protected]> Signed-off-by: ouyangxiangzhen <[email protected]> --- include/nuttx/spinlock.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index 87bb380f488..7576b45a78e 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -720,6 +720,8 @@ void rspin_lock(FAR rspinlock_t *lock) spinlock_mark_locking(&lock->info); + sched_note_spinlock_lock(lock); + /* Try seize the ownership of the lock using CAS. */ new_val = RSPINLOCK_VALUE(owner, 1u); @@ -745,6 +747,8 @@ void rspin_lock(FAR rspinlock_t *lock) /* Mark locked only when the lock is acquired for the first time. */ spinlock_mark_locked(&lock->info); + + sched_note_spinlock_locked(lock); } } # else @@ -1098,6 +1102,7 @@ bool rspin_unlock(FAR rspinlock_t *lock) if (RSPINLOCK_COUNT(val) == 1u) { + sched_note_spinlock_unlock(lock); spinlock_mark_unlocked(&lock->info); atomic_set_release(&lock->val, 0u); SPIN_KICK();
