blob: 8c31c14bc736129a7ad4c0f54b0aa1cb6b64dd7e [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
Krzysztof Chruscinski2165e8c2021-04-14 14:57:37 +020013 bool "Multi-threading"
Anas Nashif9463dc02016-12-17 17:36:20 -050014 default y
15 help
Anas Nashif429c2a42017-12-13 10:08:21 -050016 If disabled, only the main thread is available, so a main() function
17 must be provided. Interrupts are available. Kernel objects will most
18 probably not behave as expected, especially with regards to pending,
19 since the main thread cannot pend, it being the only thread in the
20 system.
Anas Nashif9463dc02016-12-17 17:36:20 -050021
David Brown22029272019-03-15 16:01:51 -060022 Many drivers and subsystems will not work with this option
23 set to 'n'; disable only when you REALLY know what you are
24 doing.
Anas Nashif9463dc02016-12-17 17:36:20 -050025
26config NUM_COOP_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020027 int "Number of coop priorities" if MULTITHREADING
Anas Nashif9463dc02016-12-17 17:36:20 -050028 default 1 if !MULTITHREADING
Ulf Magnussonec3eff52018-07-30 10:57:47 +020029 default 16
Benjamin Walshf9554762016-12-21 15:38:54 -050030 range 0 128
Anas Nashif9463dc02016-12-17 17:36:20 -050031 help
Anas Nashif429c2a42017-12-13 10:08:21 -050032 Number of cooperative priorities configured in the system. Gives access
33 to priorities:
Anas Nashif9463dc02016-12-17 17:36:20 -050034
35 K_PRIO_COOP(0) to K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1)
36
Anas Nashif429c2a42017-12-13 10:08:21 -050037 or seen another way, priorities:
Anas Nashif9463dc02016-12-17 17:36:20 -050038
39 -CONFIG_NUM_COOP_PRIORITIES to -1
40
Anas Nashif429c2a42017-12-13 10:08:21 -050041 This can be set to zero to disable cooperative scheduling. Cooperative
42 threads always preempt preemptible threads.
Anas Nashif9463dc02016-12-17 17:36:20 -050043
Anas Nashif429c2a42017-12-13 10:08:21 -050044 Each priority requires an extra 8 bytes of RAM. Each set of 32 extra
45 total priorities require an extra 4 bytes and add one possible
46 iteration to loops that search for the next thread to run.
Anas Nashif9463dc02016-12-17 17:36:20 -050047
Anas Nashif429c2a42017-12-13 10:08:21 -050048 The total number of priorities is
Anas Nashif9463dc02016-12-17 17:36:20 -050049
50 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1
51
Anas Nashif429c2a42017-12-13 10:08:21 -050052 The extra one is for the idle thread, which must run at the lowest
53 priority, and be the only thread at that priority.
Anas Nashif9463dc02016-12-17 17:36:20 -050054
55config NUM_PREEMPT_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020056 int "Number of preemptible priorities" if MULTITHREADING
Anas Nashif9463dc02016-12-17 17:36:20 -050057 default 0 if !MULTITHREADING
Ulf Magnussonec3eff52018-07-30 10:57:47 +020058 default 15
Benjamin Walshf9554762016-12-21 15:38:54 -050059 range 0 128
Anas Nashif9463dc02016-12-17 17:36:20 -050060 help
Anas Nashif429c2a42017-12-13 10:08:21 -050061 Number of preemptible priorities available in the system. Gives access
62 to priorities 0 to CONFIG_NUM_PREEMPT_PRIORITIES - 1.
Anas Nashif9463dc02016-12-17 17:36:20 -050063
Anas Nashif429c2a42017-12-13 10:08:21 -050064 This can be set to 0 to disable preemptible scheduling.
Anas Nashif9463dc02016-12-17 17:36:20 -050065
Anas Nashif429c2a42017-12-13 10:08:21 -050066 Each priority requires an extra 8 bytes of RAM. Each set of 32 extra
67 total priorities require an extra 4 bytes and add one possible
68 iteration to loops that search for the next thread to run.
Anas Nashif9463dc02016-12-17 17:36:20 -050069
Anas Nashif429c2a42017-12-13 10:08:21 -050070 The total number of priorities is
Anas Nashif9463dc02016-12-17 17:36:20 -050071
72 NUM_COOP_PRIORITIES + NUM_PREEMPT_PRIORITIES + 1
73
Anas Nashif429c2a42017-12-13 10:08:21 -050074 The extra one is for the idle thread, which must run at the lowest
75 priority, and be the only thread at that priority.
Anas Nashif9463dc02016-12-17 17:36:20 -050076
77config MAIN_THREAD_PRIORITY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020078 int "Priority of initialization/main thread"
Benjamin Walshe6695592017-01-14 18:50:22 -050079 default -2 if !PREEMPT_ENABLED
Ulf Magnussonec3eff52018-07-30 10:57:47 +020080 default 0
Anas Nashif9463dc02016-12-17 17:36:20 -050081 help
Anas Nashif429c2a42017-12-13 10:08:21 -050082 Priority at which the initialization thread runs, including the start
83 of the main() function. main() can then change its priority if desired.
Anas Nashif9463dc02016-12-17 17:36:20 -050084
85config COOP_ENABLED
Ulf Magnusson7727d1a2018-06-22 02:25:43 +020086 def_bool (NUM_COOP_PRIORITIES != 0)
Anas Nashif9463dc02016-12-17 17:36:20 -050087
88config PREEMPT_ENABLED
Ulf Magnusson7727d1a2018-06-22 02:25:43 +020089 def_bool (NUM_PREEMPT_PRIORITIES != 0)
Anas Nashif9463dc02016-12-17 17:36:20 -050090
91config PRIORITY_CEILING
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020092 int "Priority inheritance ceiling"
Anas Nashif9463dc02016-12-17 17:36:20 -050093 default 0
94
Andy Ross7aa25fa2018-05-11 14:02:42 -070095config NUM_METAIRQ_PRIORITIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +020096 int "Number of very-high priority 'preemptor' threads"
Andy Ross7aa25fa2018-05-11 14:02:42 -070097 default 0
98 help
Ulf Magnusson975de212019-11-01 10:24:07 +010099 This defines a set of priorities at the (numerically) lowest
100 end of the range which have "meta-irq" behavior. Runnable
101 threads at these priorities will always be scheduled before
102 threads at lower priorities, EVEN IF those threads are
103 otherwise cooperative and/or have taken a scheduler lock.
104 Making such a thread runnable in any way thus has the effect
105 of "interrupting" the current task and running the meta-irq
106 thread synchronously, like an exception or system call. The
107 intent is to use these priorities to implement "interrupt
108 bottom half" or "tasklet" behavior, allowing driver
109 subsystems to return from interrupt context but be guaranteed
110 that user code will not be executed (on the current CPU)
111 until the remaining work is finished. As this breaks the
112 "promise" of non-preemptibility granted by the current API
113 for cooperative threads, this tool probably shouldn't be used
114 from application code.
Andy Ross7aa25fa2018-05-11 14:02:42 -0700115
Andy Ross4a2e50f2018-05-15 11:06:25 -0700116config SCHED_DEADLINE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200117 bool "Enable earliest-deadline-first scheduling"
Andy Ross4a2e50f2018-05-15 11:06:25 -0700118 help
119 This enables a simple "earliest deadline first" scheduling
120 mode where threads can set "deadline" deltas measured in
121 k_cycle_get_32() units. Priority decisions within (!!) a
122 single priority will choose the next expiring deadline and
123 not simply the least recently added thread.
124
Andy Rossab46b1b2019-01-30 15:00:42 -0800125config SCHED_CPU_MASK
126 bool "Enable CPU mask affinity/pinning API"
127 depends on SCHED_DUMB
128 help
Anas Nashif8d267502019-12-18 18:10:09 -0500129 When true, the application will have access to the
130 k_thread_cpu_mask_*() APIs which control per-CPU affinity masks in
131 SMP mode, allowing applications to pin threads to specific CPUs or
132 disallow threads from running on given CPUs. Note that as currently
133 implemented, this involves an inherent O(N) scaling in the number of
134 idle-but-runnable threads, and thus works only with the DUMB
135 scheduler (as SCALABLE and MULTIQ would see no benefit).
Andy Rossab46b1b2019-01-30 15:00:42 -0800136
Anas Nashif8d267502019-12-18 18:10:09 -0500137 Note that this setting does not technically depend on SMP and is
138 implemented without it for testing purposes, but for obvious reasons
139 makes sense as an application API only where there is more than one
140 CPU. With one CPU, it's just a higher overhead version of
141 k_thread_start/stop().
Andy Ross4a2e50f2018-05-15 11:06:25 -0700142
Anas Nashif9463dc02016-12-17 17:36:20 -0500143config MAIN_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200144 int "Size of stack for initialization and main thread"
Adithya Baglody76ee02b2018-08-31 15:13:36 +0530145 default 2048 if COVERAGE_GCOV
Alexandre Bourdiol8925af92021-02-01 11:06:12 +0100146 default 1024 if TEST_ARM_CORTEX_M
Andrew Boie7fae2bb2019-07-29 20:47:42 -0700147 default 512 if ZTEST && !(RISCV || X86)
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200148 default 1024
Anas Nashif9463dc02016-12-17 17:36:20 -0500149 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500150 When the initialization is complete, the thread executing it then
151 executes the main() routine, so as to reuse the stack used by the
152 initialization, which would be wasted RAM otherwise.
Anas Nashif9463dc02016-12-17 17:36:20 -0500153
Anas Nashif429c2a42017-12-13 10:08:21 -0500154 After initialization is complete, the thread runs main().
Anas Nashif9463dc02016-12-17 17:36:20 -0500155
156config IDLE_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200157 int "Size of stack for idle thread"
Wentong Wub9919622019-04-04 17:50:30 +0800158 default 2048 if COVERAGE_GCOV
Mazen NEIFER57186762017-01-31 22:50:42 +0100159 default 1024 if XTENSA
Nicolas Pitre1f4b5dd2019-07-17 13:17:05 -0400160 default 512 if RISCV
Andrew Boief5a7e1a2020-09-02 09:20:38 -0700161 default 384 if DYNAMIC_OBJECTS
Andrew Boie3f7ae0d2020-11-19 12:39:16 -0800162 default 320 if ARC || (ARM && CPU_HAS_FPU) || (X86 && MMU)
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200163 default 256
Anas Nashif9463dc02016-12-17 17:36:20 -0500164 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500165 Depending on the work that the idle task must do, most likely due to
166 power management but possibly to other features like system event
167 logging (e.g. logging when the system goes to sleep), the idle thread
168 may need more stack space than the default value.
Anas Nashif9463dc02016-12-17 17:36:20 -0500169
170config ISR_STACK_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200171 int "ISR and initialization stack size (in bytes)"
Anas Nashif9463dc02016-12-17 17:36:20 -0500172 default 2048
173 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500174 This option specifies the size of the stack used by interrupt
175 service routines (ISRs), and during kernel initialization.
Anas Nashif9463dc02016-12-17 17:36:20 -0500176
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100177config THREAD_STACK_INFO
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200178 bool "Thread stack info"
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100179 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500180 This option allows each thread to store the thread stack info into
181 the k_thread data structure.
Vincenzo Frascinodfed8c42017-03-27 15:52:42 +0100182
Ulf Magnusson1f38ea72019-11-01 14:00:09 +0100183config THREAD_CUSTOM_DATA
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200184 bool "Thread custom data"
Anas Nashif9463dc02016-12-17 17:36:20 -0500185 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500186 This option allows each thread to store 32 bits of custom data,
187 which can be accessed using the k_thread_custom_data_xxx() APIs.
Anas Nashif9463dc02016-12-17 17:36:20 -0500188
Daniel Leungfc182432018-08-16 15:42:28 -0700189config THREAD_USERSPACE_LOCAL_DATA
190 bool
191 depends on USERSPACE
Daniel Leung62cf1962020-10-05 14:54:45 -0700192 default y if ERRNO && !ERRNO_IN_TLS
Daniel Leungfc182432018-08-16 15:42:28 -0700193
Anas Nashif9463dc02016-12-17 17:36:20 -0500194config ERRNO
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200195 bool "Enable errno support"
Anas Nashif9463dc02016-12-17 17:36:20 -0500196 default y
197 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500198 Enable per-thread errno in the kernel. Application and library code must
199 include errno.h provided by the C library (libc) to use the errno
200 symbol. The C library must access the per-thread errno via the
Daniel Leung62cf1962020-10-05 14:54:45 -0700201 z_errno() symbol.
202
203config ERRNO_IN_TLS
204 bool "Store errno in thread local storage (TLS)"
205 depends on ERRNO && THREAD_LOCAL_STORAGE
206 default y
207 help
208 Use thread local storage to store errno instead of storing it in
209 the kernel thread struct. This avoids a syscall if userspace is enabled.
Anas Nashif9463dc02016-12-17 17:36:20 -0500210
Andy Ross225c74b2018-06-27 11:20:50 -0700211choice SCHED_ALGORITHM
212 prompt "Scheduler priority queue algorithm"
213 default SCHED_DUMB
Andy Ross1acd8c22018-05-03 14:51:49 -0700214 help
Andy Ross225c74b2018-06-27 11:20:50 -0700215 The kernel can be built with with several choices for the
216 ready queue implementation, offering different choices between
217 code size, constant factor runtime overhead and performance
218 scaling when many threads are added.
Andy Ross1acd8c22018-05-03 14:51:49 -0700219
220config SCHED_DUMB
Andy Ross225c74b2018-06-27 11:20:50 -0700221 bool "Simple linked-list ready queue"
Andy Ross1acd8c22018-05-03 14:51:49 -0700222 help
223 When selected, the scheduler ready queue will be implemented
224 as a simple unordered list, with very fast constant time
225 performance for single threads and very low code size.
226 Choose this on systems with constrained code size that will
227 never see more than a small number (3, maybe) of runnable
228 threads in the queue at any given time. On most platforms
229 (that are not otherwise using the red/black tree) this
230 results in a savings of ~2k of code size.
231
Andy Ross225c74b2018-06-27 11:20:50 -0700232config SCHED_SCALABLE
Andy Ross9f06a352018-06-28 10:38:14 -0700233 bool "Red/black tree ready queue"
234 help
235 When selected, the scheduler ready queue will be implemented
236 as a red/black tree. This has rather slower constant-time
237 insertion and removal overhead, and on most platforms (that
David B. Kinder7c89b632018-08-07 14:03:09 -0700238 are not otherwise using the rbtree somewhere) requires an
Andy Ross9f06a352018-06-28 10:38:14 -0700239 extra ~2kb of code. But the resulting behavior will scale
240 cleanly and quickly into the many thousands of threads. Use
241 this on platforms where you may have many threads (very
242 roughly: more than 20 or so) marked as runnable at a given
243 time. Most applications don't want this.
244
245config SCHED_MULTIQ
246 bool "Traditional multi-queue ready queue"
247 depends on !SCHED_DEADLINE
248 help
249 When selected, the scheduler ready queue will be implemented
250 as the classic/textbook array of lists, one per priority
251 (max 32 priorities). This corresponds to the scheduler
252 algorithm used in Zephyr versions prior to 1.12. It incurs
253 only a tiny code size overhead vs. the "dumb" scheduler and
254 runs in O(1) time in almost all circumstances with very low
255 constant factor. But it requires a fairly large RAM budget
256 to store those list heads, and the limited features make it
257 incompatible with features like deadline scheduling that
258 need to sort threads more finely, and SMP affinity which
259 need to traverse the list of threads. Typical applications
260 with small numbers of runnable threads probably want the
261 DUMB scheduler.
Andy Ross225c74b2018-06-27 11:20:50 -0700262
263endchoice # SCHED_ALGORITHM
264
265choice WAITQ_ALGORITHM
Andy Ross9f06a352018-06-28 10:38:14 -0700266 prompt "Wait queue priority algorithm"
267 default WAITQ_DUMB
268 help
269 The wait_q abstraction used in IPC primitives to pend
270 threads for later wakeup shares the same backend data
271 structure choices as the scheduler, and can use the same
272 options.
Andy Ross225c74b2018-06-27 11:20:50 -0700273
274config WAITQ_SCALABLE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200275 bool "Use scalable wait_q implementation"
Andy Ross225c74b2018-06-27 11:20:50 -0700276 help
277 When selected, the wait_q will be implemented with a
278 balanced tree. Choose this if you expect to have many
279 threads waiting on individual primitives. There is a ~2kb
280 code size increase over WAITQ_DUMB (which may be shared with
281 SCHED_SCALABLE) if the rbtree is not used elsewhere in the
282 application, and pend/unpend operations on "small" queues
283 will be somewhat slower (though this is not generally a
284 performance path).
285
286config WAITQ_DUMB
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200287 bool "Simple linked-list wait_q"
Andy Ross225c74b2018-06-27 11:20:50 -0700288 help
289 When selected, the wait_q will be implemented with a
290 doubly-linked list. Choose this if you expect to have only
291 a few threads blocked on any single IPC primitive.
292
293endchoice # WAITQ_ALGORITHM
294
Anas Nashif9463dc02016-12-17 17:36:20 -0500295menu "Kernel Debugging and Metrics"
Anas Nashif8470b4d2018-02-25 22:18:17 -0500296
297config INIT_STACKS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200298 bool "Initialize stack areas"
Anas Nashif8470b4d2018-02-25 22:18:17 -0500299 help
300 This option instructs the kernel to initialize stack areas with a
301 known value (0xaa) before they are first used, so that the high
302 water mark can be easily determined. This applies to the stack areas
Ioannis Glaropoulos57b7c3d2018-09-25 09:48:15 +0200303 for threads, as well as to the interrupt stack.
Anas Nashif8470b4d2018-02-25 22:18:17 -0500304
Anas Nashif9463dc02016-12-17 17:36:20 -0500305config BOOT_BANNER
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200306 bool "Boot banner"
Anas Nashifa805c972018-01-06 14:29:47 -0500307 default y
Kumar Galaa3629e82017-01-11 08:05:20 -0600308 depends on CONSOLE_HAS_DRIVER
Anas Nashif9463dc02016-12-17 17:36:20 -0500309 select PRINTK
310 select EARLY_CONSOLE
311 help
Sebastian Bøec0287692018-09-26 09:46:23 +0200312 This option outputs a banner to the console device during boot up.
Anas Nashif9463dc02016-12-17 17:36:20 -0500313
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700314config BOOT_DELAY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200315 int "Boot delay in milliseconds"
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700316 default 0
317 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500318 This option delays bootup for the specified amount of
319 milliseconds. This is used to allow serial ports to get ready
320 before starting to print information on them during boot, as
321 some systems might boot to fast for a receiving endpoint to
322 detect the new USB serial bus, enumerate it and get ready to
323 receive before it actually gets data. A similar effect can be
324 achieved by waiting for DCD on the serial port--however, not
325 all serial ports have DCD.
Inaky Perez-Gonzalezc51f73f2017-06-20 17:01:09 -0700326
Anas Nashif9463dc02016-12-17 17:36:20 -0500327config THREAD_MONITOR
Anas Nashif068e0872021-03-22 17:31:33 -0400328 bool "Thread monitoring"
Anas Nashif9463dc02016-12-17 17:36:20 -0500329 help
330 This option instructs the kernel to maintain a list of all threads
331 (excluding those that have not yet started or have already
332 terminated).
Anas Nashif57554052018-03-03 02:31:05 -0600333
334config THREAD_NAME
Anas Nashif068e0872021-03-22 17:31:33 -0400335 bool "Thread name"
Anas Nashif57554052018-03-03 02:31:05 -0600336 help
337 This option allows to set a name for a thread.
Andrew Boie38129ce2019-06-25 08:54:37 -0700338
339config THREAD_MAX_NAME_LEN
340 int "Max length of a thread name"
341 default 32
Anas Nashif7b9084c2021-05-13 09:46:28 -0400342 default 64 if ZTEST
Andrew Boie38129ce2019-06-25 08:54:37 -0700343 range 8 128
344 depends on THREAD_NAME
345 help
346 Thread names get stored in the k_thread struct. Indicate the max
347 name length, including the terminating NULL byte. Reduce this value
348 to conserve memory.
Daniel Leungfc577c42020-08-27 13:54:14 -0700349
350config INSTRUMENT_THREAD_SWITCHING
351 bool
352
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700353menuconfig THREAD_RUNTIME_STATS
Daniel Leungfc577c42020-08-27 13:54:14 -0700354 bool "Thread runtime statistics"
355 select INSTRUMENT_THREAD_SWITCHING
356 help
357 Gather thread runtime statistics.
358
359 For example:
360 - Thread total execution cycles
361
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700362if THREAD_RUNTIME_STATS
363
364config THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS
365 bool "Use timing functions to gather statistics"
Daniel Leung15597122021-03-31 13:40:01 -0700366 select TIMING_FUNCTIONS_NEED_AT_BOOT
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700367 help
368 Use timing functions to gather thread runtime statistics.
369
370 Note that timing functions may use a different timer than
371 the default timer for OS timekeeping.
372
373endif # THREAD_RUNTIME_STATS
374
Anas Nashif9463dc02016-12-17 17:36:20 -0500375endmenu
376
377menu "Work Queue Options"
378config SYSTEM_WORKQUEUE_STACK_SIZE
379 int "System workqueue stack size"
Andrew Boieafda7642019-05-01 14:11:25 -0700380 default 4096 if COVERAGE
Anas Nashif9463dc02016-12-17 17:36:20 -0500381 default 1024
382
383config SYSTEM_WORKQUEUE_PRIORITY
384 int "System workqueue priority"
Benjamin Walshe6695592017-01-14 18:50:22 -0500385 default -2 if COOP_ENABLED && !PREEMPT_ENABLED
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200386 default 0 if !COOP_ENABLED
387 default -1
Paul Sokolovskyfd559352018-06-07 16:58:11 +0300388 help
389 By default, system work queue priority is the lowest cooperative
390 priority. This means that any work handler, once started, won't
391 be preempted by any other thread until finished.
Anas Nashif9463dc02016-12-17 17:36:20 -0500392
Peter Bigotdc34e7c2020-10-28 11:24:05 -0500393config SYSTEM_WORKQUEUE_NO_YIELD
394 bool "Select whether system work queue yields"
395 help
396 By default, the system work queue yields between each work item, to
397 prevent other threads from being starved. Selecting this removes
398 this yield, which may be useful if the work queue thread is
399 cooperative and a sequence of work items is expected to complete
400 without yielding.
401
Anas Nashif9463dc02016-12-17 17:36:20 -0500402endmenu
403
404menu "Atomic Operations"
405config ATOMIC_OPERATIONS_BUILTIN
406 bool
407 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500408 Use the compiler builtin functions for atomic operations. This is
409 the preferred method. However, support for all arches in GCC is
410 incomplete.
Anas Nashif9463dc02016-12-17 17:36:20 -0500411
Andy Ross820c94e2021-02-14 11:51:46 -0800412config ATOMIC_OPERATIONS_ARCH
Anas Nashif9463dc02016-12-17 17:36:20 -0500413 bool
414 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500415 Use when there isn't support for compiler built-ins, but you have
416 written optimized assembly code under arch/ which implements these.
Anas Nashif9463dc02016-12-17 17:36:20 -0500417
418config ATOMIC_OPERATIONS_C
419 bool
420 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500421 Use atomic operations routines that are implemented entirely
422 in C by locking interrupts. Selected by architectures which either
423 do not have support for atomic operations in their instruction
424 set, or haven't been implemented yet during bring-up, and also
425 the compiler does not have support for the atomic __sync_* builtins.
Anas Nashif9463dc02016-12-17 17:36:20 -0500426endmenu
427
428menu "Timer API Options"
429
430config TIMESLICING
431 bool "Thread time slicing"
432 default y
433 depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0)
434 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500435 This option enables time slicing between preemptible threads of
436 equal priority.
Anas Nashif9463dc02016-12-17 17:36:20 -0500437
438config TIMESLICE_SIZE
439 int "Time slice size (in ms)"
440 default 0
441 range 0 2147483647
442 depends on TIMESLICING
443 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500444 This option specifies the maximum amount of time a thread can execute
445 before other threads of equal priority are given an opportunity to run.
446 A time slice size of zero means "no limit" (i.e. an infinitely large
447 time slice).
Anas Nashif9463dc02016-12-17 17:36:20 -0500448
449config TIMESLICE_PRIORITY
450 int "Time slicing thread priority ceiling"
451 default 0
452 range 0 NUM_PREEMPT_PRIORITIES
453 depends on TIMESLICING
454 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500455 This option specifies the thread priority level at which time slicing
456 takes effect; threads having a higher priority than this ceiling are
457 not subject to time slicing.
Anas Nashif9463dc02016-12-17 17:36:20 -0500458
Benjamin Walshacc68c12017-01-29 18:57:45 -0500459config POLL
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200460 bool "Async I/O Framework"
Benjamin Walshacc68c12017-01-29 18:57:45 -0500461 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500462 Asynchronous notification framework. Enable the k_poll() and
Flavio Ceolinaecd4ec2018-11-02 12:35:30 -0700463 k_poll_signal_raise() APIs. The former can wait on multiple events
Anas Nashif429c2a42017-12-13 10:08:21 -0500464 concurrently, which can be either directly triggered or triggered by
Anas Nashif56821172020-07-08 14:14:25 -0400465 the availability of some kernel objects (semaphores and FIFOs).
Benjamin Walshacc68c12017-01-29 18:57:45 -0500466
Anas Nashif9463dc02016-12-17 17:36:20 -0500467endmenu
468
469menu "Other Kernel Object Options"
Anas Nashif70a2e132017-01-07 08:43:32 -0500470
Kamil Lazowski104f1002020-09-11 14:27:55 +0200471config MEM_SLAB_TRACE_MAX_UTILIZATION
472 bool "Enable getting maximum slab utilization"
473 help
474 This adds variable to the k_mem_slab structure to hold
475 maximum utilization of the slab.
476
Anas Nashif9463dc02016-12-17 17:36:20 -0500477config NUM_MBOX_ASYNC_MSGS
478 int "Maximum number of in-flight asynchronous mailbox messages"
479 default 10
480 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500481 This option specifies the total number of asynchronous mailbox
482 messages that can exist simultaneously, across all mailboxes
483 in the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500484
Anas Nashif429c2a42017-12-13 10:08:21 -0500485 Setting this option to 0 disables support for asynchronous
486 mailbox messages.
Anas Nashif9463dc02016-12-17 17:36:20 -0500487
488config NUM_PIPE_ASYNC_MSGS
489 int "Maximum number of in-flight asynchronous pipe messages"
490 default 10
491 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500492 This option specifies the total number of asynchronous pipe
493 messages that can exist simultaneously, across all pipes in
494 the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500495
Anas Nashif429c2a42017-12-13 10:08:21 -0500496 Setting this option to 0 disables support for asynchronous
497 pipe messages.
Andrew Boie945af952017-08-22 13:15:23 -0700498
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700499config KERNEL_MEM_POOL
500 bool "Use Kernel Memory Pool"
501 default y
502 help
503 Enable the use of kernel memory pool.
504
505 Say y if unsure.
506
507if KERNEL_MEM_POOL
508
Anas Nashif9463dc02016-12-17 17:36:20 -0500509config HEAP_MEM_POOL_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200510 int "Heap memory pool size (in bytes)"
Youvedeep Singh4a8b2d22018-03-19 20:45:27 +0530511 default 0 if !POSIX_MQUEUE
512 default 1024 if POSIX_MQUEUE
Anas Nashif9463dc02016-12-17 17:36:20 -0500513 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500514 This option specifies the size of the heap memory pool used when
David Leachdb36b142020-07-23 14:13:09 -0500515 dynamically allocating memory using k_malloc(). The maximum size of
516 the memory pool is only limited to available memory. A size of zero
517 means that no heap memory pool is defined.
Pawel Dunajb87920b2019-03-11 17:28:23 +0100518
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700519endif # KERNEL_MEM_POOL
520
Anas Nashif9463dc02016-12-17 17:36:20 -0500521endmenu
522
Anas Nashif9463dc02016-12-17 17:36:20 -0500523config ARCH_HAS_CUSTOM_SWAP_TO_MAIN
524 bool
Anas Nashif9463dc02016-12-17 17:36:20 -0500525 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500526 It's possible that an architecture port cannot use _Swap() to swap to
527 the _main() thread, but instead must do something custom. It must
528 enable this option in that case.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600529
Andy Ross7f42dba2019-01-04 12:47:21 -0800530config SWAP_NONATOMIC
531 bool
532 help
533 On some architectures, the _Swap() primitive cannot be made
534 atomic with respect to the irq_lock being released. That
535 is, interrupts may be received between the entry to _Swap
536 and the completion of the context switch. There are a
537 handful of workaround cases in the kernel that need to be
538 enabled when this is true. Currently, this only happens on
539 ARM when the PendSV exception priority sits below that of
540 Zephyr-handled interrupts.
541
Anas Nashif94d034d2017-12-21 18:23:34 -0500542config ARCH_HAS_CUSTOM_BUSY_WAIT
543 bool
Anas Nashif94d034d2017-12-21 18:23:34 -0500544 help
545 It's possible that an architecture port cannot or does not want to use
546 the provided k_busy_wait(), but instead must do something custom. It must
547 enable this option in that case.
548
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600549config SYS_CLOCK_TICKS_PER_SEC
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200550 int "System tick frequency (in ticks/second)"
Andy Ross669730f2019-06-11 11:18:20 -0700551 default 100 if QEMU_TARGET || SOC_POSIX
Martin Åberg612dad22021-02-03 18:24:15 +0100552 default 10000 if TICKLESS_KERNEL
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600553 default 100
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600554 help
Andy Ross669730f2019-06-11 11:18:20 -0700555 This option specifies the nominal frequency of the system clock in Hz.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600556
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700557 For asynchronous timekeeping, the kernel defines a "ticks" concept. A
558 "tick" is the internal count in which the kernel does all its internal
Anas Nashif6df44052021-04-30 09:58:20 -0400559 uptime and timeout bookkeeping. Interrupts are expected to be delivered
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700560 on tick boundaries to the extent practical, and no fractional ticks
561 are tracked.
Benjamin Walsh62092182016-12-20 14:39:08 -0500562
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700563 The choice of tick rate is configurable by this option. Also the number
564 of cycles per tick should be chosen so that 1 millisecond is exactly
565 represented by an integral number of ticks. Defaults on most hardware
566 platforms (ones that support setting arbitrary interrupt timeouts) are
567 expected to be in the range of 10 kHz, with software emulation
568 platforms and legacy drivers using a more traditional 100 Hz value.
Benjamin Walsh62092182016-12-20 14:39:08 -0500569
Andy Ross393ec712018-09-19 11:08:19 -0700570 Note that when available and enabled, in "tickless" mode
571 this config variable specifies the minimum available timing
572 granularity, not necessarily the number or frequency of
573 interrupts delivered to the kernel.
574
Carles Cufi201fdf02019-05-09 19:48:40 +0200575 A value of 0 completely disables timer support in the kernel.
576
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600577config SYS_CLOCK_HW_CYCLES_PER_SEC
Peter Mitsisd2857402015-07-22 16:22:25 -0400578 int "System clock's h/w timer frequency"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600579 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500580 This option specifies the frequency of the hardware timer used for the
Ioannis Glaropoulos1d9bb5d2018-07-16 09:43:32 +0200581 system clock (in Hz). This option is set by the SOC's or board's Kconfig file
Anas Nashif429c2a42017-12-13 10:08:21 -0500582 and the user should generally avoid modifying it via the menu configuration.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600583
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500584config SYS_CLOCK_EXISTS
Andy Ross669730f2019-06-11 11:18:20 -0700585 bool "System clock exists and is enabled"
586 default y
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500587 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500588 This option specifies that the kernel lacks timer support.
Andy Ross669730f2019-06-11 11:18:20 -0700589 Some device configurations can eliminate significant code if
590 this is disabled. Obviously timeout-related APIs will not
591 work.
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500592
Andy Rosscfeb07e2020-03-05 21:14:02 -0800593config TIMEOUT_64BIT
Andy Ross4d417032020-05-04 15:57:31 -0700594 bool "Store kernel timeouts in 64 bit precision"
Andy Rosscfeb07e2020-03-05 21:14:02 -0800595 default y
596 help
597 When this option is true, the k_ticks_t values passed to
598 kernel APIs will be a 64 bit quantity, allowing the use of
599 larger values (and higher precision tick rates) without fear
Andy Ross4c7b77a2020-03-09 09:35:35 -0700600 of overflowing the 32 bit word. This feature also gates the
601 availability of absolute timeout values (which require the
602 extra precision).
Andy Rosscfeb07e2020-03-05 21:14:02 -0800603
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500604config XIP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200605 bool "Execute in place"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600606 help
607 This option allows the kernel to operate with its text and read-only
David B. Kinderd7485772016-08-17 16:33:08 -0700608 sections residing in ROM (or similar read-only memory). Not all boards
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600609 support this option so it must be used with care; you must also
610 supply a linker command file when building your image. Enabling this
611 option increases both the code and data footprint of the image.
612
Anas Nashif9463dc02016-12-17 17:36:20 -0500613menu "Initialization Priorities"
Anas Nashif3d8e86c2016-12-19 18:41:17 -0500614
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400615config KERNEL_INIT_PRIORITY_OBJECTS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200616 int "Kernel objects initialization priority"
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400617 default 30
618 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500619 Kernel objects use this priority for initialization. This
620 priority needs to be higher than minimal default initialization
621 priority.
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400622
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400623config KERNEL_INIT_PRIORITY_DEFAULT
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200624 int "Default init priority"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700625 default 40
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400626 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500627 Default minimal init priority for each init level.
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400628
629config KERNEL_INIT_PRIORITY_DEVICE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200630 int "Default init priority for device drivers"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700631 default 50
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400632 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500633 Device driver, that depends on common components, such as
634 interrupt controller, but does not depend on other devices,
635 uses this init priority.
Dirk Brandewiefeee30c2015-09-29 07:08:58 -0700636
Anas Nashif33118f92016-10-07 13:03:51 -0400637config APPLICATION_INIT_PRIORITY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200638 int "Default init priority for application level drivers"
Anas Nashif33118f92016-10-07 13:03:51 -0400639 default 90
640 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500641 This priority level is for end-user drivers such as sensors and display
642 which have no inward dependencies.
Andy Ross53c85992017-07-24 14:59:55 -0700643
Anas Nashif8470b4d2018-02-25 22:18:17 -0500644
645endmenu
646
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600647menu "Security Options"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600648
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600649config STACK_CANARIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200650 bool "Compiler stack canaries"
David Leachaa911132019-11-12 16:02:05 -0600651 depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600652 help
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100653 This option enables compiler stack canaries.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600654
Anas Nashif429c2a42017-12-13 10:08:21 -0500655 If stack canaries are supported by the compiler, it will emit
656 extra code that inserts a canary value into the stack frame when
657 a function is entered and validates this value upon exit.
658 Stack corruption (such as that caused by buffer overflow) results
659 in a fatal error condition for the running entity.
660 Enabling this option can result in a significant increase
661 in footprint and an associated decrease in performance.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600662
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100663 If stack canaries are not supported by the compiler an error
664 will occur at build time.
Leandro Pereirab007b642017-10-17 17:01:48 -0700665
666config EXECUTE_XOR_WRITE
667 bool "Enable W^X for memory partitions"
668 depends on USERSPACE
669 depends on ARCH_HAS_EXECUTABLE_PAGE_BIT
670 default y
671 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500672 When enabled, will enforce that a writable page isn't executable
673 and vice versa. This might not be acceptable in all scenarios,
674 so this option is given for those unafraid of shooting themselves
675 in the foot.
Leandro Pereirab007b642017-10-17 17:01:48 -0700676
Anas Nashif429c2a42017-12-13 10:08:21 -0500677 If unsure, say Y.
Leandro Pereirab007b642017-10-17 17:01:48 -0700678
Andrew Boie83752c12018-03-02 07:54:13 -0800679config STACK_POINTER_RANDOM
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200680 int "Initial stack pointer randomization bounds"
Andrew Boie83752c12018-03-02 07:54:13 -0800681 depends on !STACK_GROWS_UP
Flavio Ceolinfbeaa0a2020-02-25 15:32:39 -0800682 depends on MULTITHREADING
Flavio Ceolin2e0095a2019-04-30 10:45:48 -0700683 depends on TEST_RANDOM_GENERATOR || ENTROPY_HAS_DRIVER
Andrew Boie83752c12018-03-02 07:54:13 -0800684 default 0
685 help
686 This option performs a limited form of Address Space Layout
687 Randomization by offsetting some random value to a thread's
688 initial stack pointer upon creation. This hinders some types of
689 security attacks by making the location of any given stack frame
690 non-deterministic.
691
692 This feature can waste up to the specified size in bytes the stack
693 region, which is carved out of the total size of the stack region.
694 A reasonable minimum value would be around 100 bytes if this can
695 be spared.
696
697 This is currently only implemented for systems whose stack pointers
698 grow towards lower memory addresses.
699
Andrew Boie576ebf42019-03-07 15:56:55 -0800700config BOUNDS_CHECK_BYPASS_MITIGATION
701 bool "Enable bounds check bypass mitigations for speculative execution"
702 depends on USERSPACE
703 help
704 Untrusted parameters from user mode may be used in system calls to
705 index arrays during speculative execution, also known as the Spectre
706 V1 vulnerability. When enabled, various macros defined in
707 misc/speculation.h will insert fence instructions or other appropriate
708 mitigations after bounds checking any array index parameters passed
709 in from untrusted sources (user mode threads). When disabled, these
710 macros do nothing.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600711endmenu
712
Chunlin Hane9c97022017-07-07 20:29:30 +0800713config MAX_DOMAIN_PARTITIONS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200714 int "Maximum number of partitions per memory domain"
Chunlin Hane9c97022017-07-07 20:29:30 +0800715 default 16
716 range 0 255
717 depends on USERSPACE
718 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500719 Configure the maximum number of partitions per memory domain.
Chunlin Hane9c97022017-07-07 20:29:30 +0800720
Andrew Boiebc35b0b2020-08-19 13:11:47 -0700721config ARCH_MEM_DOMAIN_DATA
722 bool
723 depends on USERSPACE
724 help
725 This hidden option is selected by the target architecture if
726 architecture-specific data is needed on a per memory domain basis.
727 If so, the architecture defines a 'struct arch_mem_domain' which is
728 embedded within every struct k_mem_domain. The architecture
729 must also define the arch_mem_domain_init() function to set this up
730 when a memory domain is created.
731
732 Typical uses might be a set of page tables for that memory domain.
733
Andrew Boie00f71b02020-08-25 17:02:38 -0700734config ARCH_MEM_DOMAIN_SYNCHRONOUS_API
735 bool
736 depends on USERSPACE
737 help
738 This hidden option is selected by the target architecture if
739 modifying a memory domain's partitions at runtime, or changing
740 a memory domain's thread membership requires synchronous calls
741 into the architecture layer.
742
743 If enabled, the architecture layer must implement the following
744 APIs:
745
746 arch_mem_domain_thread_add
747 arch_mem_domain_thread_remove
748 arch_mem_domain_partition_remove
749 arch_mem_domain_partition_add
Andrew Boie00f71b02020-08-25 17:02:38 -0700750
751 It's important to note that although supervisor threads can be
752 members of memory domains, they have no implications on supervisor
753 thread access to memory. Memory domain APIs may only be invoked from
754 supervisor mode.
755
756 For these reasons, on uniprocessor systems unless memory access
757 policy is managed in separate software constructions like page
758 tables, these APIs don't need to be implemented as the underlying
759 memory management hardware will be reprogrammed on context switch
760 anyway.
761
Anas Nashifee9bebf2018-02-25 22:12:35 -0500762menu "SMP Options"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100763
Andy Ross042d8ec2017-12-09 08:37:20 -0800764config USE_SWITCH
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800765 bool "Use new-style _arch_switch instead of arch_swap"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100766 depends on USE_SWITCH_SUPPORTED
Andy Ross042d8ec2017-12-09 08:37:20 -0800767 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500768 The _arch_switch() API is a lower level context switching
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800769 primitive than the original arch_swap mechanism. It is required
Anas Nashifee9bebf2018-02-25 22:12:35 -0500770 for an SMP-aware scheduler, or if the architecture does not
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800771 provide arch_swap. In uniprocess situations where the
Anas Nashifee9bebf2018-02-25 22:12:35 -0500772 architecture provides both, _arch_switch incurs more somewhat
773 overhead and may be slower.
Andy Ross042d8ec2017-12-09 08:37:20 -0800774
Sebastian Bøef42ed322018-12-27 18:20:56 +0100775config USE_SWITCH_SUPPORTED
776 bool
777 help
778 Indicates whether _arch_switch() API is supported by the
779 currently enabled platform. This option should be selected by
780 platforms that implement it.
781
Andy Rossd3376f22018-01-25 14:03:02 -0800782config SMP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200783 bool "Enable symmetric multithreading support"
Sebastian Bøe21d69572018-12-27 18:08:24 +0100784 depends on USE_SWITCH
Andy Rossd3376f22018-01-25 14:03:02 -0800785 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500786 When true, kernel will be built with SMP support, allowing
787 more than one CPU to schedule Zephyr tasks at a time.
Andy Rossd3376f22018-01-25 14:03:02 -0800788
Guennadi Liakhovetski8d07b772021-04-01 13:46:57 +0200789config SMP_BOOT_DELAY
790 bool "Delay booting secondary cores"
791 depends on SMP
792 help
793 By default Zephyr will boot all available CPUs during start up.
794 Select this option to skip this and allow architecture code boot
795 secondary CPUs at a later time.
796
Andy Rossd3376f22018-01-25 14:03:02 -0800797config MP_NUM_CPUS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200798 int "Number of CPUs/cores"
Andy Rossd3376f22018-01-25 14:03:02 -0800799 default 1
Charles E. Youse64300a72019-09-24 13:29:41 -0400800 range 1 4
Andy Rossd3376f22018-01-25 14:03:02 -0800801 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500802 Number of multiprocessing-capable cores available to the
803 multicpu API and SMP features.
804
Andy Ross42ed12a2019-02-19 16:03:39 -0800805config SCHED_IPI_SUPPORTED
Ulf Magnusson40b49e22020-01-17 23:14:54 +0100806 bool
Andy Ross42ed12a2019-02-19 16:03:39 -0800807 help
808 True if the architecture supports a call to
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800809 arch_sched_ipi() to broadcast an interrupt that will call
Andy Ross42ed12a2019-02-19 16:03:39 -0800810 z_sched_ipi() on other CPUs in the system. Required for
811 k_thread_abort() to operate with reasonable latency
812 (otherwise we might have to wait for the other thread to
813 take an interrupt, which can be arbitrarily far in the
814 future).
815
Enjia Mai7ac40aa2020-05-28 11:29:50 +0800816config TRACE_SCHED_IPI
817 bool "Enable Test IPI"
818 help
819 When true, it will add a hook into z_sched_ipi(), in order
820 to check if schedule IPI has called or not, for testing
821 purpose.
822 depends on SCHED_IPI_SUPPORTED
823 depends on MP_NUM_CPUS>1
824
Andy Rossf6d32ab2020-05-13 15:34:04 +0000825config KERNEL_COHERENCE
826 bool "Place all shared data into coherent memory"
Anas Nashife1d42722020-12-07 14:28:53 -0500827 depends on ARCH_HAS_COHERENCE
828 default y if SMP && MP_NUM_CPUS > 1
Andy Rossf6d32ab2020-05-13 15:34:04 +0000829 select THREAD_STACK_INFO
830 help
831 When available and selected, the kernel will build in a mode
832 where all shared data is placed in multiprocessor-coherent
833 (generally "uncached") memory. Thread stacks will remain
834 cached, as will application memory declared with
835 __incoherent. This is intended for Zephyr SMP kernels
836 running on cache-incoherent architectures only. Note that
837 when this is selected, there is an implicit API change that
838 assumes cache coherence to any memory passed to the kernel.
839 Code that creates kernel data structures in uncached regions
840 may fail strangely. Some assertions exist to catch these
841 mistakes, but not all circumstances can be tested.
842
Anas Nashifee9bebf2018-02-25 22:12:35 -0500843endmenu
Andy Rossd3376f22018-01-25 14:03:02 -0800844
Andy Ross08397272018-10-01 11:13:55 -0700845config TICKLESS_KERNEL
846 bool "Tickless kernel"
Andy Rossc0a184c2018-10-12 06:58:21 -0700847 default y if TICKLESS_CAPABLE
Flavio Ceolind6d4a832021-01-06 12:14:45 -0800848 depends on TICKLESS_CAPABLE
Andy Ross08397272018-10-01 11:13:55 -0700849 help
850 This option enables a fully event driven kernel. Periodic system
Sebastian Bøe204f05b2018-12-27 19:09:09 +0100851 clock interrupt generation would be stopped at all times.
Andy Ross08397272018-10-01 11:13:55 -0700852
Daniel Leung2d152ab2020-10-27 10:50:10 -0700853config TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
854 bool
855 default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"
856 help
857 Hidden option to signal that toolchain supports generating code
858 with thread local storage.
859
Daniel Leung240beb42020-09-28 11:03:52 -0700860config THREAD_LOCAL_STORAGE
861 bool "Thread Local Storage (TLS)"
Daniel Leung2d152ab2020-10-27 10:50:10 -0700862 depends on ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
Daniel Leung38872582020-09-29 12:16:01 -0700863 select NEED_LIBC_MEM_PARTITION if (CPU_CORTEX_M && USERSPACE)
Daniel Leung240beb42020-09-28 11:03:52 -0700864 help
865 This option enables thread local storage (TLS) support in kernel.
866
Anas Nashif9463dc02016-12-17 17:36:20 -0500867endmenu