diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 936845d6339..c69385be9cb 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -637,8 +637,7 @@ struct tcb_s #endif uint16_t flags; /* Misc. general status flags */ int16_t lockcount; /* 0=preemptable (not-locked) */ -#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_CRITMONITOR) || \ - defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) +#ifdef CONFIG_IRQCOUNT int16_t irqcount; /* 0=Not in critical section */ #endif #ifdef CONFIG_CANCELLATION_POINTS @@ -952,9 +951,7 @@ int group_exitinfo(pid_t pid, FAR struct binary_s *bininfo); * ********************************************************************************/ -#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) || \ - defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SCHED_CRITMONITOR) || \ - defined(CONFIG_SMP) +#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_RESUMESCHEDULER) void sched_resume_scheduler(FAR struct tcb_s *tcb); #else # define sched_resume_scheduler(tcb) @@ -976,8 +973,7 @@ void sched_resume_scheduler(FAR struct tcb_s *tcb); * ********************************************************************************/ -#if defined(CONFIG_SCHED_SPORADIC) || defined(CONFIG_SCHED_INSTRUMENTATION) || \ - defined(CONFIG_SCHED_CRITMONITOR) +#ifdef CONFIG_SCHED_SUSPENDSCHEDULER void sched_suspend_scheduler(FAR struct tcb_s *tcb); #else # define sched_suspend_scheduler(tcb) diff --git a/sched/Kconfig b/sched/Kconfig index 09750740fa7..568648d2075 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -276,11 +276,17 @@ config PREALLOC_IRQCHAIN endif # IRQCHAIN +config IRQCOUNT + bool + default n + config SMP bool "Symmetric Multi-Processing (SMP)" default n depends on ARCH_HAVE_MULTICPU select SPINLOCK + select SCHED_RESUMESCHEDULER + select IRQCOUNT ---help--- Enables support for Symmetric Multi-Processing (SMP) on a multi-CPU platform. @@ -429,6 +435,8 @@ config RR_INTERVAL config SCHED_SPORADIC bool "Support sporadic scheduling" default n + select SCHED_SUSPENDSCHEDULER + select SCHED_RESUMESCHEDULER ---help--- Build in additional logic to support sporadic scheduling (SCHED_SPORADIC). @@ -691,6 +699,14 @@ endmenu # Pthread Options menu "Performance Monitoring" +config SCHED_SUSPENDSCHEDULER + bool + default n + +config SCHED_RESUMESCHEDULER + bool + default n + config SCHED_IRQMONITOR bool "Enable IRQ monitoring" default n @@ -704,6 +720,9 @@ config SCHED_CRITMONITOR bool "Enable Critical Section monitoring" default n depends on FS_PROCFS + select SCHED_SUSPENDSCHEDULER + select SCHED_RESUMESCHEDULER + select IRQCOUNT ---help--- Enables logic that monitors the duration of time that a thread keeps interrupts or pre-emption disabled. These global locks can have @@ -870,6 +889,9 @@ endif # SCHED_CPULOAD config SCHED_INSTRUMENTATION bool "System performance monitor hooks" default n + select SCHED_SUSPENDSCHEDULER + select SCHED_RESUMESCHEDULER + select IRQCOUNT ---help--- Enables instrumentation in scheduler to monitor system performance. If enabled, then the board-specific logic must provide the following diff --git a/sched/irq/Make.defs b/sched/irq/Make.defs index 18c2ad11f55..ad32fb16017 100644 --- a/sched/irq/Make.defs +++ b/sched/irq/Make.defs @@ -42,9 +42,9 @@ ifeq ($(CONFIG_ARCH_GLOBAL_IRQDISABLE),y) CSRCS += irq_spinlock.c endif endif -else ifeq ($(CONFIG_SCHED_INSTRUMENTATION_CSECTION),y) -CSRCS += irq_csection.c -else ifeq ($(CONFIG_SCHED_CRITMONITOR),y) +endif + +ifeq ($(CONFIG_IRQCOUNT),y) CSRCS += irq_csection.c endif diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index 45577aefdc6..690f56c289b 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -49,8 +49,7 @@ #include "sched/sched.h" #include "irq/irq.h" -#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) || \ - defined(CONFIG_SCHED_CRITMONITOR) +#ifdef CONFIG_IRQCOUNT /**************************************************************************** * Public Data @@ -392,8 +391,9 @@ try_again: return ret; } -#else /* defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) || \ - * defined(CONFIG_SCHED_CRITMONITOR) */ + +#else + irqstate_t enter_critical_section(void) { irqstate_t ret; @@ -585,8 +585,7 @@ void leave_critical_section(irqstate_t flags) up_irq_restore(flags); } -#else /* defined(CONFIG_SCHED_INSTRUMENTATION_CSECTION) || - * defined(CONFIG_SCHED_CRITMONITOR) */ +#else void leave_critical_section(irqstate_t flags) { @@ -704,5 +703,4 @@ bool irq_cpu_locked(int cpu) } #endif -#endif /* CONFIG_SMP || CONFIG_SCHED_INSTRUMENTATION_CSECTION || - * CONFIG_SCHED_CRITMONITOR */ +#endif /* CONFIG_IRQCOUNT */ diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index 7686cc5d774..91e239dad09 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -70,22 +70,16 @@ CSRCS += sched_roundrobin.c endif ifeq ($(CONFIG_SCHED_SPORADIC),y) -CSRCS += sched_sporadic.c sched_suspendscheduler.c -else ifeq ($(CONFIG_SCHED_INSTRUMENTATION),y) -CSRCS += sched_suspendscheduler.c -else ifeq ($(CONFIG_SCHED_CRITMONITOR),y) +CSRCS += sched_sporadic.c +endif + +ifeq ($(CONFIG_SCHED_SUSPENDSCHEDULER),y) CSRCS += sched_suspendscheduler.c endif ifneq ($(CONFIG_RR_INTERVAL),0) CSRCS += sched_resumescheduler.c -else ifeq ($(CONFIG_SCHED_SPORADIC),y) -CSRCS += sched_resumescheduler.c -else ifeq ($(CONFIG_SCHED_INSTRUMENTATION),y) -CSRCS += sched_resumescheduler.c -else ifeq ($(CONFIG_SCHED_CRITMONITOR),y) -CSRCS += sched_resumescheduler.c -else ifeq ($(CONFIG_SMP),y) +else ifeq ($(CONFIG_SCHED_RESUMESCHEDULER),y) CSRCS += sched_resumescheduler.c endif diff --git a/sched/sched/sched_resumescheduler.c b/sched/sched/sched_resumescheduler.c index fd06c08b1a9..58b5a13210d 100644 --- a/sched/sched/sched_resumescheduler.c +++ b/sched/sched/sched_resumescheduler.c @@ -48,9 +48,7 @@ #include "irq/irq.h" #include "sched/sched.h" -#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC) || \ - defined(CONFIG_SCHED_INSTRUMENTATION) || defined(CONFIG_SCHED_CRITMONITOR) || \ - defined(CONFIG_SMP) +#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_RESUMESCHEDULER) /**************************************************************************** * Public Functions @@ -145,6 +143,4 @@ void sched_resume_scheduler(FAR struct tcb_s *tcb) } -#endif /* CONFIG_RR_INTERVAL > 0 || CONFIG_SCHED_SPORADIC || \ - * CONFIG_SCHED_INSTRUMENTATION || CONFIG_SCHED_CRITMONITOR || - * CONFIG_SMP */ +#endif /* CONFIG_RR_INTERVAL > 0 || CONFIG_SCHED_RESUMESCHEDULER */ diff --git a/sched/sched/sched_suspendscheduler.c b/sched/sched/sched_suspendscheduler.c index a8be48386a5..4581ddc4524 100644 --- a/sched/sched/sched_suspendscheduler.c +++ b/sched/sched/sched_suspendscheduler.c @@ -50,8 +50,7 @@ #include "clock/clock.h" #include "sched/sched.h" -#if defined(CONFIG_SCHED_SPORADIC) || defined(CONFIG_SCHED_INSTRUMENTATION) || \ - defined(CONFIG_SCHED_CRITMONITOR) +#ifdef CONFIG_SCHED_SUSPENDSCHEDULER /**************************************************************************** * Public Functions @@ -94,5 +93,4 @@ void sched_suspend_scheduler(FAR struct tcb_s *tcb) #endif } -#endif /* CONFIG_SCHED_SPORADIC || CONFIG_SCHED_INSTRUMENTATION || - * CONFIG_SCHED_CRITMONITOR */ +#endif /* CONFIG_SCHED_SUSPENDSCHEDULER */