Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions drivers/note/note_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,10 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool enter)
****************************************************************************/

#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
void sched_note_spinlock(FAR struct tcb_s *tcb,
FAR volatile spinlock_t *spinlock,
void sched_note_spinlock(FAR volatile spinlock_t *spinlock,
int type)
{
FAR struct tcb_s *tcb = running_task();
struct note_spinlock_s note;
FAR struct note_driver_s **driver;
bool formatted = false;
Expand Down Expand Up @@ -1196,27 +1196,6 @@ void sched_note_spinlock(FAR struct tcb_s *tcb,
note_add(*driver, &note, sizeof(struct note_spinlock_s));
}
}

void sched_note_spinlock_lock(FAR volatile spinlock_t *spinlock)
{
sched_note_spinlock(this_task(), spinlock, NOTE_SPINLOCK_LOCK);
}

void sched_note_spinlock_locked(FAR volatile spinlock_t *spinlock)
{
sched_note_spinlock(this_task(), spinlock, NOTE_SPINLOCK_LOCKED);
}

void sched_note_spinlock_abort(FAR volatile spinlock_t *spinlock)
{
sched_note_spinlock(this_task(), spinlock, NOTE_SPINLOCK_ABORT);
}

void sched_note_spinlock_unlock(FAR volatile spinlock_t *spinlock)
{
sched_note_spinlock(this_task(), spinlock, NOTE_SPINLOCK_UNLOCK);
}

#endif

#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
Expand Down
6 changes: 2 additions & 4 deletions include/nuttx/sched_note.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
struct note_filter_syscall_s
{
uint8_t syscall_mask[(SYS_nsyscalls + 7) / 8];

Check failure on line 523 in include/nuttx/sched_note.h

View workflow job for this annotation

GitHub Actions / Linux (arm-01)

'SYS_nsyscalls' undeclared here (not in a function); did you mean 'SYS_syscall'?

Check failure on line 523 in include/nuttx/sched_note.h

View workflow job for this annotation

GitHub Actions / Linux (arm-01)

'SYS_nsyscalls' undeclared here (not in a function); did you mean 'SYS_syscall'?

Check failure on line 523 in include/nuttx/sched_note.h

View workflow job for this annotation

GitHub Actions / Linux (arm-01)

'SYS_nsyscalls' undeclared here (not in a function); did you mean 'SYS_syscall'?

Check failure on line 523 in include/nuttx/sched_note.h

View workflow job for this annotation

GitHub Actions / Linux (arm-01)

'SYS_nsyscalls' undeclared here (not in a function); did you mean 'SYS_syscall'?

Check failure on line 523 in include/nuttx/sched_note.h

View workflow job for this annotation

GitHub Actions / Linux (arm-01)

'SYS_nsyscalls' undeclared here (not in a function); did you mean 'SYS_syscall'?
};

struct note_filter_named_syscall_s
Expand Down Expand Up @@ -632,11 +632,9 @@
#endif

#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
void sched_note_spinlock(FAR struct tcb_s *tcb,
FAR volatile spinlock_t *spinlock,
int type);
void sched_note_spinlock(FAR volatile spinlock_t *spinlock, int type);
#else
# define sched_note_spinlock(tcb, spinlock, type)
# define sched_note_spinlock(spinlock, type)
#endif

#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
Expand Down
31 changes: 10 additions & 21 deletions include/nuttx/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <nuttx/atomic.h>

#include <nuttx/spinlock_type.h>
#include <nuttx/sched_note.h>

#undef EXTERN
#if defined(__cplusplus)
Expand All @@ -54,18 +55,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/

#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
void sched_note_spinlock_lock(FAR volatile spinlock_t *spinlock);
void sched_note_spinlock_locked(FAR volatile spinlock_t *spinlock);
void sched_note_spinlock_abort(FAR volatile spinlock_t *spinlock);
void sched_note_spinlock_unlock(FAR volatile spinlock_t *spinlock);
#else
# define sched_note_spinlock_lock(spinlock)
# define sched_note_spinlock_locked(spinlock)
# define sched_note_spinlock_abort(spinlock)
# define sched_note_spinlock_unlock(spinlock)
#endif

/****************************************************************************
* Public Data Types
****************************************************************************/
Expand Down Expand Up @@ -221,15 +210,15 @@ static inline_function void spin_lock(FAR volatile spinlock_t *lock)
{
/* Notify that we are waiting for a spinlock */

sched_note_spinlock_lock(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCK);

/* Lock without trace note */

spin_lock_notrace(lock);

/* Notify that we have the spinlock */

sched_note_spinlock_locked(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCKED);
}
#else
# define spin_lock(lock)
Expand Down Expand Up @@ -303,7 +292,7 @@ static inline_function bool spin_trylock(FAR volatile spinlock_t *lock)

/* Notify that we are waiting for a spinlock */

sched_note_spinlock_lock(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCK);

/* Try lock without trace note */

Expand All @@ -312,13 +301,13 @@ static inline_function bool spin_trylock(FAR volatile spinlock_t *lock)
{
/* Notify that we have the spinlock */

sched_note_spinlock_locked(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCKED);
}
else
{
/* Notify that we abort for a spinlock */

sched_note_spinlock_abort(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_ABORT);
}

return locked;
Expand Down Expand Up @@ -389,7 +378,7 @@ static inline_function void spin_unlock(FAR volatile spinlock_t *lock)

/* Notify that we are unlocking the spinlock */

sched_note_spinlock_unlock(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_UNLOCK);
}
# else
# define spin_unlock(l) do { *(l) = SP_UNLOCKED; } while (0)
Expand Down Expand Up @@ -475,15 +464,15 @@ irqstate_t spin_lock_irqsave(FAR volatile spinlock_t *lock)

/* Notify that we are waiting for a spinlock */

sched_note_spinlock_lock(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCK);

/* Lock without trace note */

flags = spin_lock_irqsave_notrace(lock);

/* Notify that we have the spinlock */

sched_note_spinlock_locked(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_LOCKED);

return flags;
}
Expand Down Expand Up @@ -745,7 +734,7 @@ void spin_unlock_irqrestore(FAR volatile spinlock_t *lock, irqstate_t flags)

/* Notify that we are unlocking the spinlock */

sched_note_spinlock_unlock(lock);
sched_note_spinlock(lock, NOTE_SPINLOCK_UNLOCK);
}
#else
# define spin_unlock_irqrestore(l, f) ((void)(l), up_irq_restore(f))
Expand Down
Loading