blob: 414d71517a3a622f66924cc332a126fc8353f40f [file] [log] [blame]
Ulf Magnussonbd6e0442019-11-01 13:45:29 +01001# Kernel configuration options
Juan Manuel Cruzd15251f2015-05-20 11:40:39 -05002
Juan Manuel Cruzd15251f2015-05-20 11:40:39 -05003# Copyright (c) 2014-2015 Wind River Systems, Inc.
David B. Kinderac74d8b2017-01-18 17:01:01 -08004# SPDX-License-Identifier: Apache-2.0
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -06005
6menu "General Kernel Options"
Andy Grossbb063162017-01-29 23:53:17 -06007
Anas Nashif0a0c8c82018-09-17 06:58:09 -05008module = KERNEL
9module-str = kernel
10source "subsys/logging/Kconfig.template.log_config"
11
Anas Nashif9463dc02016-12-17 17:36:20 -050012config MULTITHREADING
Carles Cufi28cb9da2020-09-02 18:51:10 +020013 bool "Multi-threading (DEPRECATED)"
Anas Nashif9463dc02016-12-17 17:36:20 -050014 default y
15 help
Carles Cufi28cb9da2020-09-02 18:51:10 +020016 Disabling this option is DEPRECATED.
17
Anas Nashif429c2a42017-12-13 10:08:21 -050018 If disabled, only the main thread is available, so a main() function
19 must be provided. Interrupts are available. Kernel objects will most
20 probably not behave as expected, especially with regards to pending,
21 since the main thread cannot pend, it being the only thread in the
22 system.
Anas Nashif9463dc02016-12-17 17:36:20 -050023
David Brown22029272019-03-15 16:01:51 -060024 Many drivers and subsystems will not work with this option
25 set to 'n'; disable only when you REALLY know what you are
26 doing.
Anas Nashif9463dc02016-12-17 17:36:20 -050027
Carles Cufi28cb9da2020-09-02 18:51:10 +020028if !MULTITHREADING
29comment "*** WARNING ***"
30comment "Single threaded mode (MULTITHREADING option disabled) is deprecated"
31endif
32
Anas Nashif9463dc02016-12-17 17:36:20 -050033config NUM_COOP_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020034 int "Number of coop priorities" if MULTITHREADING
Anas Nashif9463dc02016-12-17 17:36:20 -050035 default 1 if !MULTITHREADING
Ulf Magnussonec3eff52018-07-30 10:57:47 +020036 default 16
Benjamin Walshf9554762016-12-21 15:38:54 -050037 range 0 128
Anas Nashif9463dc02016-12-17 17:36:20 -050038 help
Anas Nashif429c2a42017-12-13 10:08:21 -050039 Number of cooperative priorities configured in the system. Gives access
40 to priorities:
Anas Nashif9463dc02016-12-17 17:36:20 -050041
42 K_PRIO_COOP(0) to K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)
43
Anas Nashif429c2a42017-12-13 10:08:21 -050044 or seen another way, priorities:
Anas Nashif9463dc02016-12-17 17:36:20 -050045
46 -CONFIG_NUM_COOP_PRIORITIES to -1
47
Anas Nashif429c2a42017-12-13 10:08:21 -050048 This can be set to zero to disable cooperative scheduling. Cooperative
49 threads always preempt preemptible threads.
Anas Nashif9463dc02016-12-17 17:36:20 -050050
Anas Nashif429c2a42017-12-13 10:08:21 -050051 Each priority requires an extra 8 bytes of RAM. Each set of 32 extra
52 total priorities require an extra 4 bytes and add one possible
53 iteration to loops that search for the next thread to run.
Anas Nashif9463dc02016-12-17 17:36:20 -050054
Anas Nashif429c2a42017-12-13 10:08:21 -050055 The total number of priorities is
Anas Nashif9463dc02016-12-17 17:36:20 -050056
57 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1
58
Anas Nashif429c2a42017-12-13 10:08:21 -050059 The extra one is for the idle thread, which must run at the lowest
60 priority, and be the only thread at that priority.
Anas Nashif9463dc02016-12-17 17:36:20 -050061
62config NUM_PREEMPT_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020063 int "Number of preemptible priorities" if MULTITHREADING
Anas Nashif9463dc02016-12-17 17:36:20 -050064 default 0 if !MULTITHREADING
Ulf Magnussonec3eff52018-07-30 10:57:47 +020065 default 15
Benjamin Walshf9554762016-12-21 15:38:54 -050066 range 0 128
Anas Nashif9463dc02016-12-17 17:36:20 -050067 help
Anas Nashif429c2a42017-12-13 10:08:21 -050068 Number of preemptible priorities available in the system. Gives access
69 to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1.
Anas Nashif9463dc02016-12-17 17:36:20 -050070
Anas Nashif429c2a42017-12-13 10:08:21 -050071 This can be set to 0 to disable preemptible scheduling.
Anas Nashif9463dc02016-12-17 17:36:20 -050072
Anas Nashif429c2a42017-12-13 10:08:21 -050073 Each priority requires an extra 8 bytes of RAM. Each set of 32 extra
74 total priorities require an extra 4 bytes and add one possible
75 iteration to loops that search for the next thread to run.
Anas Nashif9463dc02016-12-17 17:36:20 -050076
Anas Nashif429c2a42017-12-13 10:08:21 -050077 The total number of priorities is
Anas Nashif9463dc02016-12-17 17:36:20 -050078
79 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1
80
Anas Nashif429c2a42017-12-13 10:08:21 -050081 The extra one is for the idle thread, which must run at the lowest
82 priority, and be the only thread at that priority.
Anas Nashif9463dc02016-12-17 17:36:20 -050083
84config MAIN_THREAD_PRIORITY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020085 int "Priority of initialization/main thread"
Benjamin Walshe6695592017-01-14 18:50:22 -050086 default -2 if !PREEMPT_ENABLED
Ulf Magnussonec3eff52018-07-30 10:57:47 +020087 default 0
Anas Nashif9463dc02016-12-17 17:36:20 -050088 help
Anas Nashif429c2a42017-12-13 10:08:21 -050089 Priority at which the initialization thread runs, including the start
90 of the main() function. main() can then change its priority if desired.
Anas Nashif9463dc02016-12-17 17:36:20 -050091
92config COOP_ENABLED
Ulf Magnusson7727d1a2018-06-22 02:25:43 +020093 def_bool (NUM_COOP_PRIORITIES != 0)
Anas Nashif9463dc02016-12-17 17:36:20 -050094
95config PREEMPT_ENABLED
Ulf Magnusson7727d1a2018-06-22 02:25:43 +020096 def_bool (NUM_PREEMPT_PRIORITIES != 0)
Anas Nashif9463dc02016-12-17 17:36:20 -050097
98config PRIORITY_CEILING
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020099 int "Priority inheritance ceiling"
Anas Nashif9463dc02016-12-17 17:36:20 -0500100 default 0
101
Andy Ross7aa25fa2018-05-11 14:02:42 -0700102config NUM_METAIRQ_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200103 int "Number of very-high priority 'preemptor' threads"
Andy Ross7aa25fa2018-05-11 14:02:42 -0700104 default 0
105 help
Ulf Magnusson975de212019-11-01 10:24:07 +0100106 This defines a set of priorities at the (numerically) lowest
107 end of the range which have "meta-irq" behavior. Runnable
108 threads at these priorities will always be scheduled before
109 threads at lower priorities, EVEN IF those threads are
110 otherwise cooperative and/or have taken a scheduler lock.
111 Making such a thread runnable in any way thus has the effect
112 of "interrupting" the current task and running the meta-irq
113 thread synchronously, like an exception or system call. The
114 intent is to use these priorities to implement "interrupt
115 bottom half" or "tasklet" behavior, allowing driver
116 subsystems to return from interrupt context but be guaranteed
117 that user code will not be executed (on the current CPU)
118 until the remaining work is finished. As this breaks the
119 "promise" of non-preemptibility granted by the current API
120 for cooperative threads, this tool probably shouldn't be used
121 from application code.
Andy Ross7aa25fa2018-05-11 14:02:42 -0700122
Andy Ross4a2e50f2018-05-15 11:06:25 -0700123config SCHED_DEADLINE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200124 bool "Enable earliest-deadline-first scheduling"
Andy Ross4a2e50f2018-05-15 11:06:25 -0700125 help
126 This enables a simple "earliest deadline first" scheduling
127 mode where threads can set "deadline" deltas measured in
128 k_cycle_get_32() units. Priority decisions within (!!) a
129 single priority will choose the next expiring deadline and
130 not simply the least recently added thread.
131
Andy Rossab46b1b2019-01-30 15:00:42 -0800132config SCHED_CPU_MASK
133 bool "Enable CPU mask affinity/pinning API"
134 depends on SCHED_DUMB
135 help
Anas Nashif8d267502019-12-18 18:10:09 -0500136 When true, the application will have access to the
137 k_thread_cpu_mask_*() APIs which control per-CPU affinity masks in
138 SMP mode, allowing applications to pin threads to specific CPUs or
139 disallow threads from running on given CPUs. Note that as currently
140 implemented, this involves an inherent O(N) scaling in the number of
141 idle-but-runnable threads, and thus works only with the DUMB
142 scheduler (as SCALABLE and MULTIQ would see no benefit).
Andy Rossab46b1b2019-01-30 15:00:42 -0800143
Anas Nashif8d267502019-12-18 18:10:09 -0500144 Note that this setting does not technically depend on SMP and is
145 implemented without it for testing purposes, but for obvious reasons
146 makes sense as an application API only where there is more than one
147 CPU. With one CPU, it's just a higher overhead version of
148 k_thread_start/stop().
Andy Ross4a2e50f2018-05-15 11:06:25 -0700149
Anas Nashif9463dc02016-12-17 17:36:20 -0500150config MAIN_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200151 int "Size of stack for initialization and main thread"
Adithya Baglody76ee02b2018-08-31 15:13:36 +0530152 default 2048 if COVERAGE_GCOV
Andrew Boie7fae2bb2019-07-29 20:47:42 -0700153 default 512 if ZTEST && !(RISCV || X86)
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200154 default 1024
Anas Nashif9463dc02016-12-17 17:36:20 -0500155 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500156 When the initialization is complete, the thread executing it then
157 executes the main() routine, so as to reuse the stack used by the
158 initialization, which would be wasted RAM otherwise.
Anas Nashif9463dc02016-12-17 17:36:20 -0500159
Anas Nashif429c2a42017-12-13 10:08:21 -0500160 After initialization is complete, the thread runs main().
Anas Nashif9463dc02016-12-17 17:36:20 -0500161
162config IDLE_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200163 int "Size of stack for idle thread"
Wentong Wub9919622019-04-04 17:50:30 +0800164 default 2048 if COVERAGE_GCOV
Mazen NEIFER57186762017-01-31 22:50:42 +0100165 default 1024 if XTENSA
Nicolas Pitre1f4b5dd2019-07-17 13:17:05 -0400166 default 512 if RISCV
Andrew Boief5a7e1a2020-09-02 09:20:38 -0700167 default 384 if DYNAMIC_OBJECTS
Andrew Boie3f7ae0d2020-11-19 12:39:16 -0800168 default 320 if ARC || (ARM && CPU_HAS_FPU) || (X86 && MMU)
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200169 default 256
Anas Nashif9463dc02016-12-17 17:36:20 -0500170 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500171 Depending on the work that the idle task must do, most likely due to
172 power management but possibly to other features like system event
173 logging (e.g. logging when the system goes to sleep), the idle thread
174 may need more stack space than the default value.
Anas Nashif9463dc02016-12-17 17:36:20 -0500175
176config ISR_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200177 int "ISR and initialization stack size (in bytes)"
Anas Nashif9463dc02016-12-17 17:36:20 -0500178 default 2048
179 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500180 This option specifies the size of the stack used by interrupt
181 service routines (ISRs), and during kernel initialization.
Anas Nashif9463dc02016-12-17 17:36:20 -0500182
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100183config THREAD_STACK_INFO
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200184 bool "Thread stack info"
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100185 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500186 This option allows each thread to store the thread stack info into
187 the k_thread data structure.
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100188
Ulf Magnusson1f38ea72019-11-01 14:00:09 +0100189config THREAD_CUSTOM_DATA
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200190 bool "Thread custom data"
Anas Nashif9463dc02016-12-17 17:36:20 -0500191 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500192 This option allows each thread to store 32 bits of custom data,
193 which can be accessed using the k_thread_custom_data_xxx() APIs.
Anas Nashif9463dc02016-12-17 17:36:20 -0500194
Daniel Leungfc182432018-08-16 15:42:28 -0700195config THREAD_USERSPACE_LOCAL_DATA
196 bool
197 depends on USERSPACE
Daniel Leung62cf1962020-10-05 14:54:45 -0700198 default y if ERRNO && !ERRNO_IN_TLS
Daniel Leungfc182432018-08-16 15:42:28 -0700199
Anas Nashif9463dc02016-12-17 17:36:20 -0500200config ERRNO
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200201 bool "Enable errno support"
Anas Nashif9463dc02016-12-17 17:36:20 -0500202 default y
203 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500204 Enable per-thread errno in the kernel. Application and library code must
205 include errno.h provided by the C library (libc) to use the errno
206 symbol. The C library must access the per-thread errno via the
Daniel Leung62cf1962020-10-05 14:54:45 -0700207 z_errno() symbol.
208
209config ERRNO_IN_TLS
210 bool "Store errno in thread local storage (TLS)"
211 depends on ERRNO && THREAD_LOCAL_STORAGE
212 default y
213 help
214 Use thread local storage to store errno instead of storing it in
215 the kernel thread struct. This avoids a syscall if userspace is enabled.
Anas Nashif9463dc02016-12-17 17:36:20 -0500216
Andy Ross225c74b2018-06-27 11:20:50 -0700217choice SCHED_ALGORITHM
218 prompt "Scheduler priority queue algorithm"
219 default SCHED_DUMB
Andy Ross1acd8c22018-05-03 14:51:49 -0700220 help
Andy Ross225c74b2018-06-27 11:20:50 -0700221 The kernel can be built with with several choices for the
222 ready queue implementation, offering different choices between
223 code size, constant factor runtime overhead and performance
224 scaling when many threads are added.
Andy Ross1acd8c22018-05-03 14:51:49 -0700225
226config SCHED_DUMB
Andy Ross225c74b2018-06-27 11:20:50 -0700227 bool "Simple linked-list ready queue"
Andy Ross1acd8c22018-05-03 14:51:49 -0700228 help
229 When selected, the scheduler ready queue will be implemented
230 as a simple unordered list, with very fast constant time
231 performance for single threads and very low code size.
232 Choose this on systems with constrained code size that will
233 never see more than a small number (3, maybe) of runnable
234 threads in the queue at any given time. On most platforms
235 (that are not otherwise using the red/black tree) this
236 results in a savings of ~2k of code size.
237
Andy Ross225c74b2018-06-27 11:20:50 -0700238config SCHED_SCALABLE
Andy Ross9f06a352018-06-28 10:38:14 -0700239 bool "Red/black tree ready queue"
240 help
241 When selected, the scheduler ready queue will be implemented
242 as a red/black tree. This has rather slower constant-time
243 insertion and removal overhead, and on most platforms (that
David B. Kinder7c89b632018-08-07 14:03:09 -0700244 are not otherwise using the rbtree somewhere) requires an
Andy Ross9f06a352018-06-28 10:38:14 -0700245 extra ~2kb of code. But the resulting behavior will scale
246 cleanly and quickly into the many thousands of threads. Use
247 this on platforms where you may have many threads (very
248 roughly: more than 20 or so) marked as runnable at a given
249 time. Most applications don't want this.
250
251config SCHED_MULTIQ
252 bool "Traditional multi-queue ready queue"
253 depends on !SCHED_DEADLINE
254 help
255 When selected, the scheduler ready queue will be implemented
256 as the classic/textbook array of lists, one per priority
257 (max 32 priorities). This corresponds to the scheduler
258 algorithm used in Zephyr versions prior to 1.12. It incurs
259 only a tiny code size overhead vs. the "dumb" scheduler and
260 runs in O(1) time in almost all circumstances with very low
261 constant factor. But it requires a fairly large RAM budget
262 to store those list heads, and the limited features make it
263 incompatible with features like deadline scheduling that
264 need to sort threads more finely, and SMP affinity which
265 need to traverse the list of threads. Typical applications
266 with small numbers of runnable threads probably want the
267 DUMB scheduler.
Andy Ross225c74b2018-06-27 11:20:50 -0700268
269endchoice # SCHED_ALGORITHM
270
271choice WAITQ_ALGORITHM
Andy Ross9f06a352018-06-28 10:38:14 -0700272 prompt "Wait queue priority algorithm"
273 default WAITQ_DUMB
274 help
275 The wait_q abstraction used in IPC primitives to pend
276 threads for later wakeup shares the same backend data
277 structure choices as the scheduler, and can use the same
278 options.
Andy Ross225c74b2018-06-27 11:20:50 -0700279
280config WAITQ_SCALABLE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200281 bool "Use scalable wait_q implementation"
Andy Ross225c74b2018-06-27 11:20:50 -0700282 help
283 When selected, the wait_q will be implemented with a
284 balanced tree. Choose this if you expect to have many
285 threads waiting on individual primitives. There is a ~2kb
286 code size increase over WAITQ_DUMB (which may be shared with
287 SCHED_SCALABLE) if the rbtree is not used elsewhere in the
288 application, and pend/unpend operations on "small" queues
289 will be somewhat slower (though this is not generally a
290 performance path).
291
292config WAITQ_DUMB
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200293 bool "Simple linked-list wait_q"
Andy Ross225c74b2018-06-27 11:20:50 -0700294 help
295 When selected, the wait_q will be implemented with a
296 doubly-linked list. Choose this if you expect to have only
297 a few threads blocked on any single IPC primitive.
298
299endchoice # WAITQ_ALGORITHM
300
Anas Nashif9463dc02016-12-17 17:36:20 -0500301menu "Kernel Debugging and Metrics"
Anas Nashif8470b4d2018-02-25 22:18:17 -0500302
303config INIT_STACKS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200304 bool "Initialize stack areas"
Anas Nashif8470b4d2018-02-25 22:18:17 -0500305 help
306 This option instructs the kernel to initialize stack areas with a
307 known value (0xaa) before they are first used, so that the high
308 water mark can be easily determined. This applies to the stack areas
Ioannis Glaropoulos57b7c3d2018-09-25 09:48:15 +0200309 for threads, as well as to the interrupt stack.
Anas Nashif8470b4d2018-02-25 22:18:17 -0500310
Anas Nashif9463dc02016-12-17 17:36:20 -0500311config BOOT_BANNER
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200312 bool "Boot banner"
Anas Nashifa805c972018-01-06 14:29:47 -0500313 default y
Kumar Galaa3629e82017-01-11 08:05:20 -0600314 depends on CONSOLE_HAS_DRIVER
Anas Nashif9463dc02016-12-17 17:36:20 -0500315 select PRINTK
316 select EARLY_CONSOLE
317 help
Sebastian Bøec0287692018-09-26 09:46:23 +0200318 This option outputs a banner to the console device during boot up.
Anas Nashif9463dc02016-12-17 17:36:20 -0500319
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700320config BOOT_DELAY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200321 int "Boot delay in milliseconds"
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700322 default 0
323 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500324 This option delays bootup for the specified amount of
325 milliseconds. This is used to allow serial ports to get ready
326 before starting to print information on them during boot, as
327 some systems might boot to fast for a receiving endpoint to
328 detect the new USB serial bus, enumerate it and get ready to
329 receive before it actually gets data. A similar effect can be
330 achieved by waiting for DCD on the serial port--however, not
331 all serial ports have DCD.
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700332
Anas Nashif9463dc02016-12-17 17:36:20 -0500333config THREAD_MONITOR
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200334 bool "Thread monitoring [EXPERIMENTAL]"
Anas Nashif9463dc02016-12-17 17:36:20 -0500335 help
336 This option instructs the kernel to maintain a list of all threads
337 (excluding those that have not yet started or have already
338 terminated).
Anas Nashif57554052018-03-03 02:31:05 -0600339
340config THREAD_NAME
341 bool "Thread name [EXPERIMENTAL]"
342 help
343 This option allows to set a name for a thread.
Andrew Boie38129ce2019-06-25 08:54:37 -0700344
345config THREAD_MAX_NAME_LEN
346 int "Max length of a thread name"
347 default 32
348 range 8 128
349 depends on THREAD_NAME
350 help
351 Thread names get stored in the k_thread struct. Indicate the max
352 name length, including the terminating NULL byte. Reduce this value
353 to conserve memory.
Daniel Leungfc577c42020-08-27 13:54:14 -0700354
355config INSTRUMENT_THREAD_SWITCHING
356 bool
357
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700358menuconfig THREAD_RUNTIME_STATS
Daniel Leungfc577c42020-08-27 13:54:14 -0700359 bool "Thread runtime statistics"
360 select INSTRUMENT_THREAD_SWITCHING
361 help
362 Gather thread runtime statistics.
363
364 For example:
365 - Thread total execution cycles
366
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700367if THREAD_RUNTIME_STATS
368
369config THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS
370 bool "Use timing functions to gather statistics"
371 select TIMING_FUNCTIONS
372 help
373 Use timing functions to gather thread runtime statistics.
374
375 Note that timing functions may use a different timer than
376 the default timer for OS timekeeping.
377
378endif # THREAD_RUNTIME_STATS
379
Anas Nashif9463dc02016-12-17 17:36:20 -0500380endmenu
381
382menu "Work Queue Options"
383config SYSTEM_WORKQUEUE_STACK_SIZE
384 int "System workqueue stack size"
Andrew Boieafda7642019-05-01 14:11:25 -0700385 default 4096 if COVERAGE
Anas Nashif9463dc02016-12-17 17:36:20 -0500386 default 1024
387
388config SYSTEM_WORKQUEUE_PRIORITY
389 int "System workqueue priority"
Benjamin Walshe6695592017-01-14 18:50:22 -0500390 default -2 if COOP_ENABLED && !PREEMPT_ENABLED
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200391 default 0 if !COOP_ENABLED
392 default -1
Paul Sokolovskyfd559352018-06-07 16:58:11 +0300393 help
394 By default, system work queue priority is the lowest cooperative
395 priority. This means that any work handler, once started, won't
396 be preempted by any other thread until finished.
Anas Nashif9463dc02016-12-17 17:36:20 -0500397
Anas Nashif9463dc02016-12-17 17:36:20 -0500398endmenu
399
400menu "Atomic Operations"
401config ATOMIC_OPERATIONS_BUILTIN
402 bool
403 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500404 Use the compiler builtin functions for atomic operations. This is
405 the preferred method. However, support for all arches in GCC is
406 incomplete.
Anas Nashif9463dc02016-12-17 17:36:20 -0500407
408config ATOMIC_OPERATIONS_CUSTOM
409 bool
410 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500411 Use when there isn't support for compiler built-ins, but you have
412 written optimized assembly code under arch/ which implements these.
Anas Nashif9463dc02016-12-17 17:36:20 -0500413
414config ATOMIC_OPERATIONS_C
415 bool
416 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500417 Use atomic operations routines that are implemented entirely
418 in C by locking interrupts. Selected by architectures which either
419 do not have support for atomic operations in their instruction
420 set, or haven't been implemented yet during bring-up, and also
421 the compiler does not have support for the atomic __sync_* builtins.
Anas Nashif9463dc02016-12-17 17:36:20 -0500422endmenu
423
424menu "Timer API Options"
425
426config TIMESLICING
427 bool "Thread time slicing"
428 default y
429 depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0)
430 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500431 This option enables time slicing between preemptible threads of
432 equal priority.
Anas Nashif9463dc02016-12-17 17:36:20 -0500433
434config TIMESLICE_SIZE
435 int "Time slice size (in ms)"
436 default 0
437 range 0 2147483647
438 depends on TIMESLICING
439 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500440 This option specifies the maximum amount of time a thread can execute
441 before other threads of equal priority are given an opportunity to run.
442 A time slice size of zero means "no limit" (i.e. an infinitely large
443 time slice).
Anas Nashif9463dc02016-12-17 17:36:20 -0500444
445config TIMESLICE_PRIORITY
446 int "Time slicing thread priority ceiling"
447 default 0
448 range 0 NUM_PREEMPT_PRIORITIES
449 depends on TIMESLICING
450 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500451 This option specifies the thread priority level at which time slicing
452 takes effect; threads having a higher priority than this ceiling are
453 not subject to time slicing.
Anas Nashif9463dc02016-12-17 17:36:20 -0500454
Benjamin Walshacc68c12017-01-29 18:57:45 -0500455config POLL
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200456 bool "Async I/O Framework"
Benjamin Walshacc68c12017-01-29 18:57:45 -0500457 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500458 Asynchronous notification framework. Enable the k_poll() and
Flavio Ceolinaecd4ec2018-11-02 12:35:30 -0700459 k_poll_signal_raise() APIs. The former can wait on multiple events
Anas Nashif429c2a42017-12-13 10:08:21 -0500460 concurrently, which can be either directly triggered or triggered by
Anas Nashif56821172020-07-08 14:14:25 -0400461 the availability of some kernel objects (semaphores and FIFOs).
Benjamin Walshacc68c12017-01-29 18:57:45 -0500462
Anas Nashif9463dc02016-12-17 17:36:20 -0500463endmenu
464
465menu "Other Kernel Object Options"
Anas Nashif70a2e132017-01-07 08:43:32 -0500466
Kamil Lazowski104f1002020-09-11 14:27:55 +0200467config MEM_SLAB_TRACE_MAX_UTILIZATION
468 bool "Enable getting maximum slab utilization"
469 help
470 This adds variable to the k_mem_slab structure to hold
471 maximum utilization of the slab.
472
Anas Nashif9463dc02016-12-17 17:36:20 -0500473config NUM_MBOX_ASYNC_MSGS
474 int "Maximum number of in-flight asynchronous mailbox messages"
475 default 10
476 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500477 This option specifies the total number of asynchronous mailbox
478 messages that can exist simultaneously, across all mailboxes
479 in the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500480
Anas Nashif429c2a42017-12-13 10:08:21 -0500481 Setting this option to 0 disables support for asynchronous
482 mailbox messages.
Anas Nashif9463dc02016-12-17 17:36:20 -0500483
484config NUM_PIPE_ASYNC_MSGS
485 int "Maximum number of in-flight asynchronous pipe messages"
486 default 10
487 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500488 This option specifies the total number of asynchronous pipe
489 messages that can exist simultaneously, across all pipes in
490 the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500491
Anas Nashif429c2a42017-12-13 10:08:21 -0500492 Setting this option to 0 disables support for asynchronous
493 pipe messages.
Andrew Boie945af952017-08-22 13:15:23 -0700494
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700495config KERNEL_MEM_POOL
496 bool "Use Kernel Memory Pool"
497 default y
498 help
499 Enable the use of kernel memory pool.
500
501 Say y if unsure.
502
503if KERNEL_MEM_POOL
504
Anas Nashif9463dc02016-12-17 17:36:20 -0500505config HEAP_MEM_POOL_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200506 int "Heap memory pool size (in bytes)"
Youvedeep Singh4a8b2d22018-03-19 20:45:27 +0530507 default 0 if !POSIX_MQUEUE
508 default 1024 if POSIX_MQUEUE
Anas Nashif9463dc02016-12-17 17:36:20 -0500509 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500510 This option specifies the size of the heap memory pool used when
David Leachdb36b142020-07-23 14:13:09 -0500511 dynamically allocating memory using k_malloc(). The maximum size of
512 the memory pool is only limited to available memory. A size of zero
513 means that no heap memory pool is defined.
Pawel Dunajb87920b2019-03-11 17:28:23 +0100514
515config HEAP_MEM_POOL_MIN_SIZE
516 int "The smallest blocks in the heap memory pool (in bytes)"
517 depends on HEAP_MEM_POOL_SIZE != 0
518 default 64
519 help
520 This option specifies the size of the smallest block in the pool.
521 Option must be a power of 2 and lower than or equal to the size
522 of the entire pool.
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700523
524endif # KERNEL_MEM_POOL
525
Anas Nashif9463dc02016-12-17 17:36:20 -0500526endmenu
527
Anas Nashif9463dc02016-12-17 17:36:20 -0500528config ARCH_HAS_CUSTOM_SWAP_TO_MAIN
529 bool
Anas Nashif9463dc02016-12-17 17:36:20 -0500530 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500531 It's possible that an architecture port cannot use _Swap() to swap to
532 the _main() thread, but instead must do something custom. It must
533 enable this option in that case.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600534
Andy Ross7f42dba2019-01-04 12:47:21 -0800535config SWAP_NONATOMIC
536 bool
537 help
538 On some architectures, the _Swap() primitive cannot be made
539 atomic with respect to the irq_lock being released. That
540 is, interrupts may be received between the entry to _Swap
541 and the completion of the context switch. There are a
542 handful of workaround cases in the kernel that need to be
543 enabled when this is true. Currently, this only happens on
544 ARM when the PendSV exception priority sits below that of
545 Zephyr-handled interrupts.
546
Anas Nashif94d034d2017-12-21 18:23:34 -0500547config ARCH_HAS_CUSTOM_BUSY_WAIT
548 bool
Anas Nashif94d034d2017-12-21 18:23:34 -0500549 help
550 It's possible that an architecture port cannot or does not want to use
551 the provided k_busy_wait(), but instead must do something custom. It must
552 enable this option in that case.
553
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600554config SYS_CLOCK_TICKS_PER_SEC
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200555 int "System tick frequency (in ticks/second)"
Andy Ross669730f2019-06-11 11:18:20 -0700556 default 100 if QEMU_TARGET || SOC_POSIX
557 default 10000 if TICKLESS_CAPABLE
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600558 default 100
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600559 help
Andy Ross669730f2019-06-11 11:18:20 -0700560 This option specifies the nominal frequency of the system clock in Hz.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600561
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700562 For asynchronous timekeeping, the kernel defines a "ticks" concept. A
563 "tick" is the internal count in which the kernel does all its internal
564 uptime and timeout bookeeping. Interrupts are expected to be delivered
565 on tick boundaries to the extent practical, and no fractional ticks
566 are tracked.
Benjamin Walsh62092182016-12-20 14:39:08 -0500567
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700568 The choice of tick rate is configurable by this option. Also the number
569 of cycles per tick should be chosen so that 1 millisecond is exactly
570 represented by an integral number of ticks. Defaults on most hardware
571 platforms (ones that support setting arbitrary interrupt timeouts) are
572 expected to be in the range of 10 kHz, with software emulation
573 platforms and legacy drivers using a more traditional 100 Hz value.
Benjamin Walsh62092182016-12-20 14:39:08 -0500574
Andy Ross393ec712018-09-19 11:08:19 -0700575 Note that when available and enabled, in "tickless" mode
576 this config variable specifies the minimum available timing
577 granularity, not necessarily the number or frequency of
578 interrupts delivered to the kernel.
579
Carles Cufi201fdf02019-05-09 19:48:40 +0200580 A value of 0 completely disables timer support in the kernel.
581
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600582config SYS_CLOCK_HW_CYCLES_PER_SEC
Peter Mitsisd2857402015-07-22 16:22:25 -0400583 int "System clock's h/w timer frequency"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600584 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500585 This option specifies the frequency of the hardware timer used for the
Ioannis Glaropoulos1d9bb5d2018-07-16 09:43:32 +0200586 system clock (in Hz). This option is set by the SOC's or board's Kconfig file
Anas Nashif429c2a42017-12-13 10:08:21 -0500587 and the user should generally avoid modifying it via the menu configuration.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600588
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500589config SYS_CLOCK_EXISTS
Andy Ross669730f2019-06-11 11:18:20 -0700590 bool "System clock exists and is enabled"
591 default y
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500592 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500593 This option specifies that the kernel lacks timer support.
Andy Ross669730f2019-06-11 11:18:20 -0700594 Some device configurations can eliminate significant code if
595 this is disabled. Obviously timeout-related APIs will not
596 work.
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500597
Andy Ross78327382020-03-05 15:18:14 -0800598config LEGACY_TIMEOUT_API
599 bool "Support legacy k_timeout_t API"
600 help
601 The k_timeout_t API has changed to become an opaque type
602 that must be initialized with macros. Older applications
603 can choose this to continue using the old style of timeouts
Kumar Galaa1b77fd2020-05-27 11:26:57 -0500604 (which were int32_t counts of milliseconds), at the cost of
Andy Ross78327382020-03-05 15:18:14 -0800605 not being able to use new features.
606
Andy Rosscfeb07e2020-03-05 21:14:02 -0800607config TIMEOUT_64BIT
Andy Ross4d417032020-05-04 15:57:31 -0700608 bool "Store kernel timeouts in 64 bit precision"
Andy Rosscfeb07e2020-03-05 21:14:02 -0800609 depends on !LEGACY_TIMEOUT_API
610 default y
611 help
612 When this option is true, the k_ticks_t values passed to
613 kernel APIs will be a 64 bit quantity, allowing the use of
614 larger values (and higher precision tick rates) without fear
Andy Ross4c7b77a2020-03-09 09:35:35 -0700615 of overflowing the 32 bit word. This feature also gates the
616 availability of absolute timeout values (which require the
617 extra precision).
Andy Rosscfeb07e2020-03-05 21:14:02 -0800618
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500619config XIP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200620 bool "Execute in place"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600621 help
622 This option allows the kernel to operate with its text and read-only
David B. Kinderd7485772016-08-17 16:33:08 -0700623 sections residing in ROM (or similar read-only memory). Not all boards
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600624 support this option so it must be used with care; you must also
625 supply a linker command file when building your image. Enabling this
626 option increases both the code and data footprint of the image.
627
Anas Nashif9463dc02016-12-17 17:36:20 -0500628menu "Initialization Priorities"
Anas Nashif3d8e86c2016-12-19 18:41:17 -0500629
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400630config KERNEL_INIT_PRIORITY_OBJECTS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200631 int "Kernel objects initialization priority"
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400632 default 30
633 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500634 Kernel objects use this priority for initialization. This
635 priority needs to be higher than minimal default initialization
636 priority.
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400637
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400638config KERNEL_INIT_PRIORITY_DEFAULT
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200639 int "Default init priority"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700640 default 40
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400641 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500642 Default minimal init priority for each init level.
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400643
644config KERNEL_INIT_PRIORITY_DEVICE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200645 int "Default init priority for device drivers"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700646 default 50
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400647 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500648 Device driver, that depends on common components, such as
649 interrupt controller, but does not depend on other devices,
650 uses this init priority.
Dirk Brandewiefeee30c2015-09-29 07:08:58 -0700651
Anas Nashif33118f92016-10-07 13:03:51 -0400652config APPLICATION_INIT_PRIORITY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200653 int "Default init priority for application level drivers"
Anas Nashif33118f92016-10-07 13:03:51 -0400654 default 90
655 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500656 This priority level is for end-user drivers such as sensors and display
657 which have no inward dependencies.
Andy Ross53c85992017-07-24 14:59:55 -0700658
Anas Nashif8470b4d2018-02-25 22:18:17 -0500659
660endmenu
661
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600662menu "Security Options"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600663
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600664config STACK_CANARIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200665 bool "Compiler stack canaries"
David Leachaa911132019-11-12 16:02:05 -0600666 depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600667 help
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100668 This option enables compiler stack canaries.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600669
Anas Nashif429c2a42017-12-13 10:08:21 -0500670 If stack canaries are supported by the compiler, it will emit
671 extra code that inserts a canary value into the stack frame when
672 a function is entered and validates this value upon exit.
673 Stack corruption (such as that caused by buffer overflow) results
674 in a fatal error condition for the running entity.
675 Enabling this option can result in a significant increase
676 in footprint and an associated decrease in performance.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600677
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100678 If stack canaries are not supported by the compiler an error
679 will occur at build time.
Leandro Pereirab007b642017-10-17 17:01:48 -0700680
681config EXECUTE_XOR_WRITE
682 bool "Enable W^X for memory partitions"
683 depends on USERSPACE
684 depends on ARCH_HAS_EXECUTABLE_PAGE_BIT
685 default y
686 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500687 When enabled, will enforce that a writable page isn't executable
688 and vice versa. This might not be acceptable in all scenarios,
689 so this option is given for those unafraid of shooting themselves
690 in the foot.
Leandro Pereirab007b642017-10-17 17:01:48 -0700691
Anas Nashif429c2a42017-12-13 10:08:21 -0500692 If unsure, say Y.
Leandro Pereirab007b642017-10-17 17:01:48 -0700693
Andrew Boie83752c12018-03-02 07:54:13 -0800694config STACK_POINTER_RANDOM
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200695 int "Initial stack pointer randomization bounds"
Andrew Boie83752c12018-03-02 07:54:13 -0800696 depends on !STACK_GROWS_UP
Flavio Ceolinfbeaa0a2020-02-25 15:32:39 -0800697 depends on MULTITHREADING
Flavio Ceolin2e0095a2019-04-30 10:45:48 -0700698 depends on TEST_RANDOM_GENERATOR || ENTROPY_HAS_DRIVER
Andrew Boie83752c12018-03-02 07:54:13 -0800699 default 0
700 help
701 This option performs a limited form of Address Space Layout
702 Randomization by offsetting some random value to a thread's
703 initial stack pointer upon creation. This hinders some types of
704 security attacks by making the location of any given stack frame
705 non-deterministic.
706
707 This feature can waste up to the specified size in bytes the stack
708 region, which is carved out of the total size of the stack region.
709 A reasonable minimum value would be around 100 bytes if this can
710 be spared.
711
712 This is currently only implemented for systems whose stack pointers
713 grow towards lower memory addresses.
714
Andrew Boie576ebf42019-03-07 15:56:55 -0800715config BOUNDS_CHECK_BYPASS_MITIGATION
716 bool "Enable bounds check bypass mitigations for speculative execution"
717 depends on USERSPACE
718 help
719 Untrusted parameters from user mode may be used in system calls to
720 index arrays during speculative execution, also known as the Spectre
721 V1 vulnerability. When enabled, various macros defined in
722 misc/speculation.h will insert fence instructions or other appropriate
723 mitigations after bounds checking any array index parameters passed
724 in from untrusted sources (user mode threads). When disabled, these
725 macros do nothing.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600726endmenu
727
Chunlin Hane9c97022017-07-07 20:29:30 +0800728config MAX_DOMAIN_PARTITIONS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200729 int "Maximum number of partitions per memory domain"
Chunlin Hane9c97022017-07-07 20:29:30 +0800730 default 16
731 range 0 255
732 depends on USERSPACE
733 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500734 Configure the maximum number of partitions per memory domain.
Chunlin Hane9c97022017-07-07 20:29:30 +0800735
Andrew Boiebc35b0b2020-08-19 13:11:47 -0700736config ARCH_MEM_DOMAIN_DATA
737 bool
738 depends on USERSPACE
739 help
740 This hidden option is selected by the target architecture if
741 architecture-specific data is needed on a per memory domain basis.
742 If so, the architecture defines a 'struct arch_mem_domain' which is
743 embedded within every struct k_mem_domain. The architecture
744 must also define the arch_mem_domain_init() function to set this up
745 when a memory domain is created.
746
747 Typical uses might be a set of page tables for that memory domain.
748
Andrew Boie00f71b02020-08-25 17:02:38 -0700749config ARCH_MEM_DOMAIN_SYNCHRONOUS_API
750 bool
751 depends on USERSPACE
752 help
753 This hidden option is selected by the target architecture if
754 modifying a memory domain's partitions at runtime, or changing
755 a memory domain's thread membership requires synchronous calls
756 into the architecture layer.
757
758 If enabled, the architecture layer must implement the following
759 APIs:
760
761 arch_mem_domain_thread_add
762 arch_mem_domain_thread_remove
763 arch_mem_domain_partition_remove
764 arch_mem_domain_partition_add
765 arch_mem_domain_destroy
766
767 It's important to note that although supervisor threads can be
768 members of memory domains, they have no implications on supervisor
769 thread access to memory. Memory domain APIs may only be invoked from
770 supervisor mode.
771
772 For these reasons, on uniprocessor systems unless memory access
773 policy is managed in separate software constructions like page
774 tables, these APIs don't need to be implemented as the underlying
775 memory management hardware will be reprogrammed on context switch
776 anyway.
777
Anas Nashifee9bebf2018-02-25 22:12:35 -0500778menu "SMP Options"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100779
Andy Ross042d8ec2017-12-09 08:37:20 -0800780config USE_SWITCH
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800781 bool "Use new-style _arch_switch instead of arch_swap"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100782 depends on USE_SWITCH_SUPPORTED
Andy Ross042d8ec2017-12-09 08:37:20 -0800783 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500784 The _arch_switch() API is a lower level context switching
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800785 primitive than the original arch_swap mechanism. It is required
Anas Nashifee9bebf2018-02-25 22:12:35 -0500786 for an SMP-aware scheduler, or if the architecture does not
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800787 provide arch_swap. In uniprocess situations where the
Anas Nashifee9bebf2018-02-25 22:12:35 -0500788 architecture provides both, _arch_switch incurs more somewhat
789 overhead and may be slower.
Andy Ross042d8ec2017-12-09 08:37:20 -0800790
Sebastian Bøef42ed322018-12-27 18:20:56 +0100791config USE_SWITCH_SUPPORTED
792 bool
793 help
794 Indicates whether _arch_switch() API is supported by the
795 currently enabled platform. This option should be selected by
796 platforms that implement it.
797
Andy Rossd3376f22018-01-25 14:03:02 -0800798config SMP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200799 bool "Enable symmetric multithreading support"
Sebastian Bøe21d69572018-12-27 18:08:24 +0100800 depends on USE_SWITCH
Andy Rossd3376f22018-01-25 14:03:02 -0800801 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500802 When true, kernel will be built with SMP support, allowing
803 more than one CPU to schedule Zephyr tasks at a time.
Andy Rossd3376f22018-01-25 14:03:02 -0800804
805config MP_NUM_CPUS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200806 int "Number of CPUs/cores"
Andy Rossd3376f22018-01-25 14:03:02 -0800807 default 1
Charles E. Youse64300a72019-09-24 13:29:41 -0400808 range 1 4
Andy Rossd3376f22018-01-25 14:03:02 -0800809 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500810 Number of multiprocessing-capable cores available to the
811 multicpu API and SMP features.
812
Andy Ross42ed12a2019-02-19 16:03:39 -0800813config SCHED_IPI_SUPPORTED
Ulf Magnusson40b49e22020-01-17 23:14:54 +0100814 bool
Andy Ross42ed12a2019-02-19 16:03:39 -0800815 help
816 True if the architecture supports a call to
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800817 arch_sched_ipi() to broadcast an interrupt that will call
Andy Ross42ed12a2019-02-19 16:03:39 -0800818 z_sched_ipi() on other CPUs in the system. Required for
819 k_thread_abort() to operate with reasonable latency
820 (otherwise we might have to wait for the other thread to
821 take an interrupt, which can be arbitrarily far in the
822 future).
823
Enjia Mai7ac40aa2020-05-28 11:29:50 +0800824config TRACE_SCHED_IPI
825 bool "Enable Test IPI"
826 help
827 When true, it will add a hook into z_sched_ipi(), in order
828 to check if schedule IPI has called or not, for testing
829 purpose.
830 depends on SCHED_IPI_SUPPORTED
831 depends on MP_NUM_CPUS>1
832
Andy Rossf6d32ab2020-05-13 15:34:04 +0000833config KERNEL_COHERENCE
834 bool "Place all shared data into coherent memory"
Anas Nashife1d42722020-12-07 14:28:53 -0500835 depends on ARCH_HAS_COHERENCE
836 default y if SMP && MP_NUM_CPUS > 1
Andy Rossf6d32ab2020-05-13 15:34:04 +0000837 select THREAD_STACK_INFO
838 help
839 When available and selected, the kernel will build in a mode
840 where all shared data is placed in multiprocessor-coherent
841 (generally "uncached") memory. Thread stacks will remain
842 cached, as will application memory declared with
843 __incoherent. This is intended for Zephyr SMP kernels
844 running on cache-incoherent architectures only. Note that
845 when this is selected, there is an implicit API change that
846 assumes cache coherence to any memory passed to the kernel.
847 Code that creates kernel data structures in uncached regions
848 may fail strangely. Some assertions exist to catch these
849 mistakes, but not all circumstances can be tested.
850
Anas Nashifee9bebf2018-02-25 22:12:35 -0500851endmenu
Andy Rossd3376f22018-01-25 14:03:02 -0800852
Andy Ross08397272018-10-01 11:13:55 -0700853config TICKLESS_IDLE
Sebastian Bøe204f05b2018-12-27 19:09:09 +0100854 # NB: This option is deprecated, see TICKLESS_KERNEL and
855 # https://github.com/zephyrproject-rtos/zephyr/pull/12234
Andy Ross08397272018-10-01 11:13:55 -0700856 bool "Tickless idle"
Andy Rossc0a184c2018-10-12 06:58:21 -0700857 default y if SYS_POWER_MANAGEMENT || TICKLESS_CAPABLE
Andy Ross08397272018-10-01 11:13:55 -0700858 help
859 This option suppresses periodic system clock interrupts whenever the
860 kernel becomes idle. This permits the system to remain in a power
861 saving state for extended periods without having to wake up to
862 service each tick as it occurs.
863
864config TICKLESS_IDLE_THRESH
865 int "Tickless idle threshold"
866 default 3
867 depends on TICKLESS_IDLE
868 help
869 This option enables clock interrupt suppression when the kernel idles
870 for only a short period of time. It specifies the minimum number of
871 ticks that must occur before the next kernel timer expires in order
872 for suppression to happen.
873
874config TICKLESS_KERNEL
875 bool "Tickless kernel"
Andy Rossc0a184c2018-10-12 06:58:21 -0700876 default y if TICKLESS_CAPABLE
Andy Ross08397272018-10-01 11:13:55 -0700877 help
878 This option enables a fully event driven kernel. Periodic system
Sebastian Bøe204f05b2018-12-27 19:09:09 +0100879 clock interrupt generation would be stopped at all times.
Andy Ross08397272018-10-01 11:13:55 -0700880
Daniel Leung2d152ab2020-10-27 10:50:10 -0700881config TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
882 bool
883 default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"
884 help
885 Hidden option to signal that toolchain supports generating code
886 with thread local storage.
887
Daniel Leung240beb42020-09-28 11:03:52 -0700888config THREAD_LOCAL_STORAGE
889 bool "Thread Local Storage (TLS)"
Daniel Leung2d152ab2020-10-27 10:50:10 -0700890 depends on ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
Daniel Leung38872582020-09-29 12:16:01 -0700891 select NEED_LIBC_MEM_PARTITION if (CPU_CORTEX_M && USERSPACE)
Daniel Leung240beb42020-09-28 11:03:52 -0700892 help
893 This option enables thread local storage (TLS) support in kernel.
894
Anas Nashif9463dc02016-12-17 17:36:20 -0500895endmenu