idle: add infrastructure for tickless support in nanokernels

An architecture that supports tickless idle in the nanokernel can allow
selecting TICKLESS_IDLE by forcing NANOKERNEL_TICKLESS_IDLE_SUPPORTED to
be enabled.

Change-Id: I4e45b619c599913d40b7bc19902094fb361b1e3b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Benjamin Walsh 2015-10-05 16:26:52 -04:00 committed by Anas Nashif
commit 1ffdea1eb9
3 changed files with 54 additions and 42 deletions

View file

@ -182,28 +182,72 @@ endmenu
endmenu endmenu
source "kernel/nanokernel/Kconfig" source "kernel/nanokernel/Kconfig"
config ADVANCED_POWER_MANAGEMENT
bool
prompt "Advanced power management"
default n
help
This option enables the platform to implement extra power management
policies whenever the kernel becomes idle. The kernel invokes
_sys_power_save_idle() to inform the power management subsystem of the
number of ticks until the next kernel timer is due to expire.
menu "Advanced Power Management Features"
depends on ADVANCED_POWER_MANAGEMENT
config ADVANCED_IDLE
bool
prompt "Advanced idle state"
default n
depends on MICROKERNEL && ADVANCED_POWER_MANAGEMENT && ADVANCED_IDLE_SUPPORTED
help
This option enables the kernel to interface to a custom advanced idle
power saving manager. This permits the system to enter a custom
power saving state when the kernel becomes idle for extended periods,
and then to restore the system to its previous state (rather than
booting up from scratch) when the kernel is re-activated.
config ADV_IDLE_STACK_SIZE
int
prompt "Advanced idle state stack size"
default 16
depends on ADVANCED_IDLE
help
This option defines the size of the separate stack used during the
system state check while the booting up. A separate stack is used
to avoid memory corruption on the system re-activation from power
down mode. The stack size must be large enough to hold the return
address (4 bytes) and the _AdvIdleCheckSleep() stack frame.
config TICKLESS_IDLE config TICKLESS_IDLE
bool bool
prompt "Tickless idle" prompt "Tickless idle"
default y default y
depends on ADVANCED_POWER_MANAGEMENT depends on MICROKERNEL || NANOKERNEL_TICKLESS_IDLE_SUPPORTED
help help
This option suppresses periodic system clock interrupts whenever the This option suppresses periodic system clock interrupts whenever the
kernel becomes idle. This permits the system to remain in a power kernel becomes idle. This permits the system to remain in a power
saving state for extended periods without having to wake up to saving state for extended periods without having to wake up to
service each tick as it occurs. service each tick as it occurs.
As a policy, an architecture should always provide support for tickless in
the microkernel. If an architecture also provides support for nanokernel
systems, it must select the NANOKERNEL_TICKLESS_IDLE_SUPPORTED kconfig
option.
config TICKLESS_IDLE_THRESH config TICKLESS_IDLE_THRESH
int int
prompt "Tickless idle threshold" prompt "Tickless idle threshold"
default 3 default 3
depends on TICKLESS_IDLE depends on TICKLESS_IDLE
help help
This option disables clock interrupt suppression when the kernel idles This option enables clock interrupt suppression when the kernel idles
for only a short period of time. It specifies the minimum number of for only a short period of time. It specifies the minimum number of
ticks that must occur before the next kernel timer expires in order ticks that must occur before the next kernel timer expires in order
for suppression to happen. for suppression to happen.
endmenu
if MICROKERNEL if MICROKERNEL
source "kernel/microkernel/Kconfig" source "kernel/microkernel/Kconfig"
endif endif

View file

@ -195,44 +195,4 @@ config THREAD_MONITOR
and fibers (excluding those that have not yet started or have and fibers (excluding those that have not yet started or have
already terminated). already terminated).
config ADVANCED_POWER_MANAGEMENT
bool
prompt "Advanced power management"
default n
depends on MICROKERNEL
help
This option enables the platform to implement extra power management
policies whenever the kernel becomes idle. The kernel invokes
_sys_power_save_idle() to inform the power management subsystem of the
number of ticks until the next kernel timer is due to expire.
menu "Advanced Power Management Features"
depends on MICROKERNEL && ADVANCED_POWER_MANAGEMENT && ADVANCED_IDLE_SUPPORTED
config ADVANCED_IDLE
bool
prompt "Advanced idle state"
default n
depends on ADVANCED_POWER_MANAGEMENT && ADVANCED_IDLE_SUPPORTED
help
This option enables the kernel to interface to a custom advanced idle
power saving manager. This permits the system to enter a custom
power saving state when the kernel becomes idle for extended periods,
and then to restore the system to its previous state (rather than
booting up from scratch) when the kernel is re-activated.
config ADV_IDLE_STACK_SIZE
int
prompt "Advanced idle state stack size"
default 16
depends on ADVANCED_IDLE
help
This option defines the size of the separate stack used during the
system state check while the booting up. A separate stack is used
to avoid memory corruption on the system re-activation from power
down mode. The stack size must be large enough to hold the return
address (4 bytes) and the _AdvIdleCheckSleep() stack frame.
endmenu
endmenu endmenu

View file

@ -83,6 +83,13 @@ config NANO_TIMERS
Allow fibers and tasks to wait on nanokernel timers, which can be Allow fibers and tasks to wait on nanokernel timers, which can be
accessed using the nano_timer_xxx() APIs. accessed using the nano_timer_xxx() APIs.
config NANOKERNEL_TICKLESS_IDLE_SUPPORTED
bool
default n
help
To be selected by an architecture if it does support tickless idle in
nanokernel systems.
config ERRNO config ERRNO
bool bool
prompt "Enable errno support" prompt "Enable errno support"
@ -91,4 +98,5 @@ config ERRNO
Enable per-thread errno in the kernel. Application and library code must Enable per-thread errno in the kernel. Application and library code must
include errno.h provided by the C library (libc) to use the errno symbol. include errno.h provided by the C library (libc) to use the errno symbol.
The C library must access the per-thread errno via the _get_errno() symbol. The C library must access the per-thread errno via the _get_errno() symbol.
endmenu endmenu