driver/note: Restore SCHED_INSTRUMENTATION config to sched/Konfig

since the chip/board vendor could disable dirvers/note and
provide the implementation of sched_note_xxx by self

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-02-14 00:58:19 +08:00 committed by archer
parent f0825c2402
commit 6b14ad9337
2 changed files with 143 additions and 147 deletions

View File

@ -3,153 +3,9 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SCHED_INSTRUMENTATION
bool "System performance monitor hooks"
default n
select SCHED_SUSPENDSCHEDULER
select SCHED_RESUMESCHEDULER
---help---
Enables instrumentation in scheduler to monitor system performance.
If enabled, then the board-specific logic must provide the following
functions (see include/sched.h):
void sched_note_start(FAR struct tcb_s *tcb);
void sched_note_stop(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_started(FAR struct tcb_s *tcb);
if SCHED_INSTRUMENTATION
config SCHED_INSTRUMENTATION_CPUSET
hex "CPU bit set"
default 0xffff
depends on SMP && SCHED_INSTRUMENTATION_FILTER
---help---
Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc.
config SCHED_INSTRUMENTATION_HIRES
bool "Use Hi-Res RTC for instrumentation"
default n
---help---
Use higher resolution system timer for instrumentation.
config SCHED_INSTRUMENTATION_FILTER
bool "Instrumenation filter"
default n
---help---
Enables the filter logic for the instrumentation. If this option
is enabled, the instrumentation data passed to sched_note_add()
can be filtered by syscall and IRQ number.
The filter logic can be configured by sched_note_filter APIs defined in
include/nuttx/sched_note.h.
config SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
hex "Default instrumentation filter mode"
depends on SCHED_INSTRUMENTATION_FILTER
default 0x3f
---help---
Default mode of the instrumentation filter logic.
Bit 0 = Enable instrumentation
Bit 1 = Enable switch instrumentation
Bit 2 = Enable syscall instrumentation
Bit 3 = Enable IRQ instrumentation
Bit 4 = Enable dump instrumentation
Bit 5 = Enable collecting syscall arguments
menu "System performance monitor hooks choose"
config SCHED_INSTRUMENTATION_SWITCH
bool "Use note switch for instrumentation"
default n
---help---
Use note switch for instrumentation.
void sched_note_suspend(FAR struct tcb_s *tcb);
void sched_note_resume(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
NOTE: These are internal OS interfaces and are called at very
critical locations in the OS. There is very little that can be
done in these interfaces. For example, normal devices may not be
used; syslog output cannot be performed.
config SCHED_INSTRUMENTATION_PREEMPTION
bool "Preemption monitor hooks"
default n
---help---
Enables additional hooks for changes to pre-emption state. Board-
specific logic must provide this additional logic.
void sched_note_premption(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_CSECTION
bool "Critical section monitor hooks"
default n
select IRQCOUNT
---help---
Enables additional hooks for entry and exit from critical sections.
Interrupts are disabled while within a critical section. Board-
specific logic must provide this additional logic.
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_SPINLOCKS
bool "Spinlock monitor hooks"
default n
---help---
Enables additional hooks for spinlock state. Board-specific logic
must provide this additional logic.
void sched_note_spinlock(FAR struct tcb_s *tcb, FAR volatile spinlock_t *spinlock, int type)
config SCHED_INSTRUMENTATION_SYSCALL
bool "System call monitor hooks"
default n
depends on ARCH_HAVE_SYSCALL_HOOKS
---help---
Enables additional hooks for entry and exit from system call.
Board-specific logic must provide this additional logic.
void sched_note_syscall_enter(int nr, int argc, ...);
void sched_note_syscall_leave(int nr, uintptr_t result);
config SCHED_INSTRUMENTATION_IRQHANDLER
bool "Interrupt handler monitor hooks"
default n
---help---
Enables additional hooks for interrupt handler. Board-specific logic
must provide this additional logic.
void sched_note_irqhandler(int irq, FAR void *handler, bool enter);
config SCHED_INSTRUMENTATION_DUMP
bool "Use note dump for instrumentation"
default n
---help---
Use note dump for instrumentation.
void sched_note_string(FAR const char *buf);
void sched_note_dump(uint32_t module, uint8_t event, FAR const void *buf, size_t len);
void sched_note_vprintf(FAR const char *fmt, va_list va);
void sched_note_vbprintf(uint32_t module, uint8_t event, FAR const char *fmt, va_list va);
void sched_note_printf(FAR const char *fmt, ...) printf_like(1, 2);
void sched_note_bprintf(uint32_t module, uint8_t event, FAR const char *fmt, ...);
endmenu # "System performance monitor hooks choose"
config DRIVER_NOTE
bool "Note Driver Support"
depends on SCHED_INSTRUMENTATION
default n
if DRIVER_NOTE
@ -232,5 +88,3 @@ config DRIVER_NOTELOG
The note driver output to syslog.
endif # DRIVER_NOTE
endif # SCHED_INSTRUMENTATION

View File

@ -945,6 +945,148 @@ config SCHED_CPULOAD_TIMECONSTANT
endif # SCHED_CPULOAD
menuconfig SCHED_INSTRUMENTATION
bool "System performance monitor hooks"
default n
select SCHED_SUSPENDSCHEDULER
select SCHED_RESUMESCHEDULER
---help---
Enables instrumentation in scheduler to monitor system performance.
If enabled, then the board-specific logic must provide the following
functions (see include/sched.h):
void sched_note_start(FAR struct tcb_s *tcb);
void sched_note_stop(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_started(FAR struct tcb_s *tcb);
if SCHED_INSTRUMENTATION
config SCHED_INSTRUMENTATION_CPUSET
hex "CPU bit set"
default 0xffff
depends on SMP && SCHED_INSTRUMENTATION_FILTER
---help---
Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc.
config SCHED_INSTRUMENTATION_HIRES
bool "Use Hi-Res RTC for instrumentation"
default n
---help---
Use higher resolution system timer for instrumentation.
config SCHED_INSTRUMENTATION_FILTER
bool "Instrumentation filter"
default n
---help---
Enables the filter logic for the instrumentation. If this option
is enabled, the instrumentation data passed to sched_note_add()
can be filtered by syscall and IRQ number.
The filter logic can be configured by sched_note_filter APIs defined in
include/nuttx/sched_note.h.
config SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
hex "Default instrumentation filter mode"
depends on SCHED_INSTRUMENTATION_FILTER
default 0x3f
---help---
Default mode of the instrumentation filter logic.
Bit 0 = Enable instrumentation
Bit 1 = Enable switch instrumentation
Bit 2 = Enable syscall instrumentation
Bit 3 = Enable IRQ instrumentation
Bit 4 = Enable dump instrumentation
Bit 5 = Enable collecting syscall arguments
config SCHED_INSTRUMENTATION_SWITCH
bool "Use note switch for instrumentation"
default n
---help---
Use note switch for instrumentation.
void sched_note_suspend(FAR struct tcb_s *tcb);
void sched_note_resume(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
NOTE: These are internal OS interfaces and are called at very
critical locations in the OS. There is very little that can be
done in these interfaces. For example, normal devices may not be
used; syslog output cannot be performed.
config SCHED_INSTRUMENTATION_PREEMPTION
bool "Preemption monitor hooks"
default n
---help---
Enables additional hooks for changes to pre-emption state. Board-
specific logic must provide this additional logic.
void sched_note_premption(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_CSECTION
bool "Critical section monitor hooks"
default n
select IRQCOUNT
---help---
Enables additional hooks for entry and exit from critical sections.
Interrupts are disabled while within a critical section. Board-
specific logic must provide this additional logic.
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_SPINLOCKS
bool "Spinlock monitor hooks"
default n
---help---
Enables additional hooks for spinlock state. Board-specific logic
must provide this additional logic.
void sched_note_spinlock(FAR struct tcb_s *tcb, FAR volatile spinlock_t *spinlock, int type)
config SCHED_INSTRUMENTATION_SYSCALL
bool "System call monitor hooks"
default n
depends on ARCH_HAVE_SYSCALL_HOOKS
---help---
Enables additional hooks for entry and exit from system call.
Board-specific logic must provide this additional logic.
void sched_note_syscall_enter(int nr, int argc, ...);
void sched_note_syscall_leave(int nr, uintptr_t result);
config SCHED_INSTRUMENTATION_IRQHANDLER
bool "Interrupt handler monitor hooks"
default n
---help---
Enables additional hooks for interrupt handler. Board-specific logic
must provide this additional logic.
void sched_note_irqhandler(int irq, FAR void *handler, bool enter);
config SCHED_INSTRUMENTATION_DUMP
bool "Use note dump for instrumentation"
default n
---help---
Use note dump for instrumentation.
void sched_note_string(FAR const char *buf);
void sched_note_dump(uint32_t module, uint8_t event, FAR const void *buf, size_t len);
void sched_note_vprintf(FAR const char *fmt, va_list va);
void sched_note_vbprintf(uint32_t module, uint8_t event, FAR const char *fmt, va_list va);
void sched_note_printf(FAR const char *fmt, ...) printf_like(1, 2);
void sched_note_bprintf(uint32_t module, uint8_t event, FAR const char *fmt, ...);
endif # SCHED_INSTRUMENTATION
endmenu # Performance Monitoring
menu "Files and I/O"