sched_note: Permit spinlock and critical section notes in in-memory buffer iff sched_not_get() interfaces is disabled.
This commit is contained in:
parent
f3e6264654
commit
9ee3f3b933
@ -70,7 +70,7 @@ endif
|
|||||||
config DRIVER_NOTE
|
config DRIVER_NOTE
|
||||||
bool "Scheduler instrumentation driver"
|
bool "Scheduler instrumentation driver"
|
||||||
default n
|
default n
|
||||||
depends on SCHED_INSTRUMENTATION_BUFFER
|
depends on SCHED_INSTRUMENTATION_BUFFER && SCHED_NOTE_GET
|
||||||
---help---
|
---help---
|
||||||
Enable building a serial driver that can be used by an application
|
Enable building a serial driver that can be used by an application
|
||||||
to read data from the in-memory, scheduler instrumentation "note"
|
to read data from the in-memory, scheduler instrumentation "note"
|
||||||
|
@ -58,11 +58,11 @@
|
|||||||
* old configuration files)
|
* old configuration files)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_CPUSET
|
#ifndef CONFIG_SCHED_INSTRUMENTATION_CPUSET
|
||||||
# define CONFIG_SCHED_INSTRUMENTATION_CPUSET 0xffff
|
# define CONFIG_SCHED_INSTRUMENTATION_CPUSET 0xffff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_NOTE_BUFSIZE
|
#ifndef CONFIG_SCHED_NOTE_BUFSIZE
|
||||||
# define CONFIG_SCHED_NOTE_BUFSIZE 2048
|
# define CONFIG_SCHED_NOTE_BUFSIZE 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -301,7 +301,8 @@ void sched_note_spinabort(FAR struct tcb_s *tcb, FAR volatile void *spinlock);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_BUFFER
|
#if defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER) && \
|
||||||
|
defined(CONFIG_SCHED_NOTE_GET)
|
||||||
ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen);
|
ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -320,7 +321,8 @@ ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_BUFFER
|
#if defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER) && \
|
||||||
|
defined(CONFIG_SCHED_NOTE_GET)
|
||||||
ssize_t sched_note_size(void);
|
ssize_t sched_note_size(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -694,15 +694,9 @@ config SCHED_INSTRUMENTATION_PREEMPTION
|
|||||||
|
|
||||||
void sched_note_premption(FAR struct tcb_s *tcb, bool state);
|
void sched_note_premption(FAR struct tcb_s *tcb, bool state);
|
||||||
|
|
||||||
config SCHED_INSTRUMENTATION_FAUXPAS
|
|
||||||
bool
|
|
||||||
default y if !EXPERIMENTAL && SCHED_INSTRUMENTATION_BUFFER
|
|
||||||
default n if EXPERIMENTAL || !SCHED_INSTRUMENTATION_BUFFER
|
|
||||||
|
|
||||||
config SCHED_INSTRUMENTATION_CSECTION
|
config SCHED_INSTRUMENTATION_CSECTION
|
||||||
bool "Critical section monitor hooks"
|
bool "Critical section monitor hooks"
|
||||||
default n
|
default n
|
||||||
depends on !SCHED_INSTRUMENTATION_FAUXPAS
|
|
||||||
---help---
|
---help---
|
||||||
Enables additional hooks for entry and exit from critical sections.
|
Enables additional hooks for entry and exit from critical sections.
|
||||||
Interrupts are disabled while within a critical section. Board-
|
Interrupts are disabled while within a critical section. Board-
|
||||||
@ -710,18 +704,9 @@ config SCHED_INSTRUMENTATION_CSECTION
|
|||||||
|
|
||||||
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
|
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
|
||||||
|
|
||||||
NOTE: This option is marked EXPERIMENTAL because there is a logical
|
|
||||||
error in the design when this feature is used with
|
|
||||||
CONFIG_SCHED_INSTRUMENTATION_BUFFER. That error is that
|
|
||||||
sched_note_get() calls enter_ and leave_critical_section. That
|
|
||||||
means that each call to sched_note_get() causes two entries to be
|
|
||||||
added from the note buffer in order to remove one entry. Not
|
|
||||||
very useful in its current state!
|
|
||||||
|
|
||||||
config SCHED_INSTRUMENTATION_SPINLOCK
|
config SCHED_INSTRUMENTATION_SPINLOCK
|
||||||
bool "Spinlock monitor hooks"
|
bool "Spinlock monitor hooks"
|
||||||
default n
|
default n
|
||||||
depends on SPINLOCK && (!SMP || !SCHED_INSTRUMENTATION_FAUXPAS)
|
|
||||||
---help---
|
---help---
|
||||||
Enables additional hooks for spinlock state. Board-specific logic
|
Enables additional hooks for spinlock state. Board-specific logic
|
||||||
must provide this additional logic.
|
must provide this additional logic.
|
||||||
@ -731,14 +716,6 @@ config SCHED_INSTRUMENTATION_SPINLOCK
|
|||||||
void sched_note_spinunlock(FAR struct tcb_s *tcb, bool state);
|
void sched_note_spinunlock(FAR struct tcb_s *tcb, bool state);
|
||||||
void sched_note_spinabort(FAR struct tcb_s *tcb, bool state);
|
void sched_note_spinabort(FAR struct tcb_s *tcb, bool state);
|
||||||
|
|
||||||
NOTE: This option is marked EXPERIMENTAL because there is a logical
|
|
||||||
error in the design when this feature is used with
|
|
||||||
CONFIG_SCHED_INSTRUMENTATION_BUFFER. That error is that
|
|
||||||
sched_note_get() calls enter_ and leave_critical_section which use
|
|
||||||
spinlocks in SMP mode. That means that each call to sched_note_get()
|
|
||||||
causes several additional entries to be added from the note buffer in
|
|
||||||
order to remove one entry. Not very useful in its current state!
|
|
||||||
|
|
||||||
config SCHED_INSTRUMENTATION_BUFFER
|
config SCHED_INSTRUMENTATION_BUFFER
|
||||||
bool "Buffer instrumentation data in memory"
|
bool "Buffer instrumentation data in memory"
|
||||||
default n
|
default n
|
||||||
@ -763,14 +740,35 @@ config SCHED_INSTRUMENTATION_BUFFER
|
|||||||
does not occur. See include/nuttx/sched_note.h for additional
|
does not occur. See include/nuttx/sched_note.h for additional
|
||||||
information.
|
information.
|
||||||
|
|
||||||
|
if SCHED_INSTRUMENTATION_BUFFER
|
||||||
|
|
||||||
config SCHED_NOTE_BUFSIZE
|
config SCHED_NOTE_BUFSIZE
|
||||||
int "Instrumentation buffer size"
|
int "Instrumentation buffer size"
|
||||||
default 2048
|
default 2048
|
||||||
depends on SCHED_INSTRUMENTATION_BUFFER
|
|
||||||
---help---
|
---help---
|
||||||
The size of the in-memory, circular instrumentation buffer (in
|
The size of the in-memory, circular instrumentation buffer (in
|
||||||
bytes).
|
bytes).
|
||||||
|
|
||||||
|
config SCHED_NOTE_GET
|
||||||
|
int "Callable interface to get instrumentatin data"
|
||||||
|
default 2048
|
||||||
|
depends on !SCHED_INSTRUMENTATION_CSECTION && (!SCHED_INSTRUMENTATION_SPINLOCK || !SMP)
|
||||||
|
---help---
|
||||||
|
Add support for interfaces to get the size of the next note and also
|
||||||
|
to extract the next note from the instrumentation buffer:
|
||||||
|
|
||||||
|
ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen);
|
||||||
|
ssize_t sched_note_size(void);
|
||||||
|
|
||||||
|
NOTE: This option is not available if critical sections are being
|
||||||
|
monitor (nor if spinlocks are being monitored in SMP configuration)
|
||||||
|
because there would be a logical error in the design in those cases.
|
||||||
|
That error is that these interfaces call enter_ and leave_critical_section
|
||||||
|
(and which us spinlocks in SMP mode). That means that each call to
|
||||||
|
sched_note_get() causes several additional entries to be added from
|
||||||
|
the note buffer in order to remove one entry.
|
||||||
|
|
||||||
|
endif # SCHED_INSTRUMENTATION_BUFFER
|
||||||
endif # SCHED_INSTRUMENTATION
|
endif # SCHED_INSTRUMENTATION
|
||||||
endmenu # Performance Monitoring
|
endmenu # Performance Monitoring
|
||||||
|
|
||||||
|
@ -551,6 +551,7 @@ void sched_note_spinabort(FAR struct tcb_s *tcb, FAR volatile void *spinlock);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_NOTE_GET
|
||||||
ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen)
|
ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct note_common_s *note;
|
FAR struct note_common_s *note;
|
||||||
@ -618,6 +619,7 @@ errout_with_csection:
|
|||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
return notelen;
|
return notelen;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: sched_note_size
|
* Name: sched_note_size
|
||||||
@ -634,6 +636,7 @@ errout_with_csection:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_NOTE_GET
|
||||||
ssize_t sched_note_size(void)
|
ssize_t sched_note_size(void)
|
||||||
{
|
{
|
||||||
FAR struct note_common_s *note;
|
FAR struct note_common_s *note;
|
||||||
@ -668,5 +671,6 @@ errout_with_csection:
|
|||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
return notelen;
|
return notelen;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_SCHED_INSTRUMENTATION_BUFFER */
|
#endif /* CONFIG_SCHED_INSTRUMENTATION_BUFFER */
|
||||||
|
Loading…
Reference in New Issue
Block a user