blob: 5dbb91ccde95e92cdf9154224364b44ad211f2ac [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
342 range 8 128
343 depends on THREAD_NAME
344 help
345 Thread names get stored in the k_thread struct. Indicate the max
346 name length, including the terminating NULL byte. Reduce this value
347 to conserve memory.
Daniel Leungfc577c42020-08-27 13:54:14 -0700348
349config INSTRUMENT_THREAD_SWITCHING
350 bool
351
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700352menuconfig THREAD_RUNTIME_STATS
Daniel Leungfc577c42020-08-27 13:54:14 -0700353 bool "Thread runtime statistics"
354 select INSTRUMENT_THREAD_SWITCHING
355 help
356 Gather thread runtime statistics.
357
358 For example:
359 - Thread total execution cycles
360
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700361if THREAD_RUNTIME_STATS
362
363config THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS
364 bool "Use timing functions to gather statistics"
Daniel Leung15597122021-03-31 13:40:01 -0700365 select TIMING_FUNCTIONS_NEED_AT_BOOT
Daniel Leungfd7a68d2020-10-14 12:17:12 -0700366 help
367 Use timing functions to gather thread runtime statistics.
368
369 Note that timing functions may use a different timer than
370 the default timer for OS timekeeping.
371
372endif # THREAD_RUNTIME_STATS
373
Anas Nashif9463dc02016-12-17 17:36:20 -0500374endmenu
375
376menu "Work Queue Options"
377config SYSTEM_WORKQUEUE_STACK_SIZE
378 int "System workqueue stack size"
Andrew Boieafda7642019-05-01 14:11:25 -0700379 default 4096 if COVERAGE
Anas Nashif9463dc02016-12-17 17:36:20 -0500380 default 1024
381
382config SYSTEM_WORKQUEUE_PRIORITY
383 int "System workqueue priority"
Benjamin Walshe6695592017-01-14 18:50:22 -0500384 default -2 if COOP_ENABLED && !PREEMPT_ENABLED
Ulf Magnussonec3eff52018-07-30 10:57:47 +0200385 default 0 if !COOP_ENABLED
386 default -1
Paul Sokolovskyfd559352018-06-07 16:58:11 +0300387 help
388 By default, system work queue priority is the lowest cooperative
389 priority. This means that any work handler, once started, won't
390 be preempted by any other thread until finished.
Anas Nashif9463dc02016-12-17 17:36:20 -0500391
Peter Bigotdc34e7c2020-10-28 11:24:05 -0500392config SYSTEM_WORKQUEUE_NO_YIELD
393 bool "Select whether system work queue yields"
394 help
395 By default, the system work queue yields between each work item, to
396 prevent other threads from being starved. Selecting this removes
397 this yield, which may be useful if the work queue thread is
398 cooperative and a sequence of work items is expected to complete
399 without yielding.
400
Anas Nashif9463dc02016-12-17 17:36:20 -0500401endmenu
402
403menu "Atomic Operations"
404config ATOMIC_OPERATIONS_BUILTIN
405 bool
406 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500407 Use the compiler builtin functions for atomic operations. This is
408 the preferred method. However, support for all arches in GCC is
409 incomplete.
Anas Nashif9463dc02016-12-17 17:36:20 -0500410
Andy Ross820c94e2021-02-14 11:51:46 -0800411config ATOMIC_OPERATIONS_ARCH
Anas Nashif9463dc02016-12-17 17:36:20 -0500412 bool
413 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500414 Use when there isn't support for compiler built-ins, but you have
415 written optimized assembly code under arch/ which implements these.
Anas Nashif9463dc02016-12-17 17:36:20 -0500416
417config ATOMIC_OPERATIONS_C
418 bool
419 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500420 Use atomic operations routines that are implemented entirely
421 in C by locking interrupts. Selected by architectures which either
422 do not have support for atomic operations in their instruction
423 set, or haven't been implemented yet during bring-up, and also
424 the compiler does not have support for the atomic __sync_* builtins.
Anas Nashif9463dc02016-12-17 17:36:20 -0500425endmenu
426
427menu "Timer API Options"
428
429config TIMESLICING
430 bool "Thread time slicing"
431 default y
432 depends on SYS_CLOCK_EXISTS && (NUM_PREEMPT_PRIORITIES != 0)
433 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500434 This option enables time slicing between preemptible threads of
435 equal priority.
Anas Nashif9463dc02016-12-17 17:36:20 -0500436
437config TIMESLICE_SIZE
438 int "Time slice size (in ms)"
439 default 0
440 range 0 2147483647
441 depends on TIMESLICING
442 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500443 This option specifies the maximum amount of time a thread can execute
444 before other threads of equal priority are given an opportunity to run.
445 A time slice size of zero means "no limit" (i.e. an infinitely large
446 time slice).
Anas Nashif9463dc02016-12-17 17:36:20 -0500447
448config TIMESLICE_PRIORITY
449 int "Time slicing thread priority ceiling"
450 default 0
451 range 0 NUM_PREEMPT_PRIORITIES
452 depends on TIMESLICING
453 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500454 This option specifies the thread priority level at which time slicing
455 takes effect; threads having a higher priority than this ceiling are
456 not subject to time slicing.
Anas Nashif9463dc02016-12-17 17:36:20 -0500457
Benjamin Walshacc68c12017-01-29 18:57:45 -0500458config POLL
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200459 bool "Async I/O Framework"
Benjamin Walshacc68c12017-01-29 18:57:45 -0500460 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500461 Asynchronous notification framework. Enable the k_poll() and
Flavio Ceolinaecd4ec2018-11-02 12:35:30 -0700462 k_poll_signal_raise() APIs. The former can wait on multiple events
Anas Nashif429c2a42017-12-13 10:08:21 -0500463 concurrently, which can be either directly triggered or triggered by
Anas Nashif56821172020-07-08 14:14:25 -0400464 the availability of some kernel objects (semaphores and FIFOs).
Benjamin Walshacc68c12017-01-29 18:57:45 -0500465
Anas Nashif9463dc02016-12-17 17:36:20 -0500466endmenu
467
468menu "Other Kernel Object Options"
Anas Nashif70a2e132017-01-07 08:43:32 -0500469
Kamil Lazowski104f1002020-09-11 14:27:55 +0200470config MEM_SLAB_TRACE_MAX_UTILIZATION
471 bool "Enable getting maximum slab utilization"
472 help
473 This adds variable to the k_mem_slab structure to hold
474 maximum utilization of the slab.
475
Anas Nashif9463dc02016-12-17 17:36:20 -0500476config NUM_MBOX_ASYNC_MSGS
477 int "Maximum number of in-flight asynchronous mailbox messages"
478 default 10
479 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500480 This option specifies the total number of asynchronous mailbox
481 messages that can exist simultaneously, across all mailboxes
482 in the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500483
Anas Nashif429c2a42017-12-13 10:08:21 -0500484 Setting this option to 0 disables support for asynchronous
485 mailbox messages.
Anas Nashif9463dc02016-12-17 17:36:20 -0500486
487config NUM_PIPE_ASYNC_MSGS
488 int "Maximum number of in-flight asynchronous pipe messages"
489 default 10
490 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500491 This option specifies the total number of asynchronous pipe
492 messages that can exist simultaneously, across all pipes in
493 the system.
Anas Nashif9463dc02016-12-17 17:36:20 -0500494
Anas Nashif429c2a42017-12-13 10:08:21 -0500495 Setting this option to 0 disables support for asynchronous
496 pipe messages.
Andrew Boie945af952017-08-22 13:15:23 -0700497
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700498config KERNEL_MEM_POOL
499 bool "Use Kernel Memory Pool"
500 default y
501 help
502 Enable the use of kernel memory pool.
503
504 Say y if unsure.
505
506if KERNEL_MEM_POOL
507
Anas Nashif9463dc02016-12-17 17:36:20 -0500508config HEAP_MEM_POOL_SIZE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200509 int "Heap memory pool size (in bytes)"
Youvedeep Singh4a8b2d22018-03-19 20:45:27 +0530510 default 0 if !POSIX_MQUEUE
511 default 1024 if POSIX_MQUEUE
Anas Nashif9463dc02016-12-17 17:36:20 -0500512 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500513 This option specifies the size of the heap memory pool used when
David Leachdb36b142020-07-23 14:13:09 -0500514 dynamically allocating memory using k_malloc(). The maximum size of
515 the memory pool is only limited to available memory. A size of zero
516 means that no heap memory pool is defined.
Pawel Dunajb87920b2019-03-11 17:28:23 +0100517
Daniel Leungb5c2ff92020-09-18 14:12:51 -0700518endif # KERNEL_MEM_POOL
519
Anas Nashif9463dc02016-12-17 17:36:20 -0500520endmenu
521
Anas Nashif9463dc02016-12-17 17:36:20 -0500522config ARCH_HAS_CUSTOM_SWAP_TO_MAIN
523 bool
Anas Nashif9463dc02016-12-17 17:36:20 -0500524 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500525 It's possible that an architecture port cannot use _Swap() to swap to
526 the _main() thread, but instead must do something custom. It must
527 enable this option in that case.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600528
Andy Ross7f42dba2019-01-04 12:47:21 -0800529config SWAP_NONATOMIC
530 bool
531 help
532 On some architectures, the _Swap() primitive cannot be made
533 atomic with respect to the irq_lock being released. That
534 is, interrupts may be received between the entry to _Swap
535 and the completion of the context switch. There are a
536 handful of workaround cases in the kernel that need to be
537 enabled when this is true. Currently, this only happens on
538 ARM when the PendSV exception priority sits below that of
539 Zephyr-handled interrupts.
540
Anas Nashif94d034d2017-12-21 18:23:34 -0500541config ARCH_HAS_CUSTOM_BUSY_WAIT
542 bool
Anas Nashif94d034d2017-12-21 18:23:34 -0500543 help
544 It's possible that an architecture port cannot or does not want to use
545 the provided k_busy_wait(), but instead must do something custom. It must
546 enable this option in that case.
547
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600548config SYS_CLOCK_TICKS_PER_SEC
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200549 int "System tick frequency (in ticks/second)"
Andy Ross669730f2019-06-11 11:18:20 -0700550 default 100 if QEMU_TARGET || SOC_POSIX
Martin Åberg612dad22021-02-03 18:24:15 +0100551 default 10000 if TICKLESS_KERNEL
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600552 default 100
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600553 help
Andy Ross669730f2019-06-11 11:18:20 -0700554 This option specifies the nominal frequency of the system clock in Hz.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600555
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700556 For asynchronous timekeeping, the kernel defines a "ticks" concept. A
557 "tick" is the internal count in which the kernel does all its internal
Anas Nashif6df44052021-04-30 09:58:20 -0400558 uptime and timeout bookkeeping. Interrupts are expected to be delivered
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700559 on tick boundaries to the extent practical, and no fractional ticks
560 are tracked.
Benjamin Walsh62092182016-12-20 14:39:08 -0500561
Spoorthy Priya Yerabolue9ef0782020-09-18 00:45:48 -0700562 The choice of tick rate is configurable by this option. Also the number
563 of cycles per tick should be chosen so that 1 millisecond is exactly
564 represented by an integral number of ticks. Defaults on most hardware
565 platforms (ones that support setting arbitrary interrupt timeouts) are
566 expected to be in the range of 10 kHz, with software emulation
567 platforms and legacy drivers using a more traditional 100 Hz value.
Benjamin Walsh62092182016-12-20 14:39:08 -0500568
Andy Ross393ec712018-09-19 11:08:19 -0700569 Note that when available and enabled, in "tickless" mode
570 this config variable specifies the minimum available timing
571 granularity, not necessarily the number or frequency of
572 interrupts delivered to the kernel.
573
Carles Cufi201fdf02019-05-09 19:48:40 +0200574 A value of 0 completely disables timer support in the kernel.
575
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600576config SYS_CLOCK_HW_CYCLES_PER_SEC
Peter Mitsisd2857402015-07-22 16:22:25 -0400577 int "System clock's h/w timer frequency"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600578 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500579 This option specifies the frequency of the hardware timer used for the
Ioannis Glaropoulos1d9bb5d2018-07-16 09:43:32 +0200580 system clock (in Hz). This option is set by the SOC's or board's Kconfig file
Anas Nashif429c2a42017-12-13 10:08:21 -0500581 and the user should generally avoid modifying it via the menu configuration.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600582
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500583config SYS_CLOCK_EXISTS
Andy Ross669730f2019-06-11 11:18:20 -0700584 bool "System clock exists and is enabled"
585 default y
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500586 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500587 This option specifies that the kernel lacks timer support.
Andy Ross669730f2019-06-11 11:18:20 -0700588 Some device configurations can eliminate significant code if
589 this is disabled. Obviously timeout-related APIs will not
590 work.
Juan Manuel Cruzc818cd22015-05-05 10:12:02 -0500591
Andy Rosscfeb07e2020-03-05 21:14:02 -0800592config TIMEOUT_64BIT
Andy Ross4d417032020-05-04 15:57:31 -0700593 bool "Store kernel timeouts in 64 bit precision"
Andy Rosscfeb07e2020-03-05 21:14:02 -0800594 default y
595 help
596 When this option is true, the k_ticks_t values passed to
597 kernel APIs will be a 64 bit quantity, allowing the use of
598 larger values (and higher precision tick rates) without fear
Andy Ross4c7b77a2020-03-09 09:35:35 -0700599 of overflowing the 32 bit word. This feature also gates the
600 availability of absolute timeout values (which require the
601 extra precision).
Andy Rosscfeb07e2020-03-05 21:14:02 -0800602
Kumar Gala9ec2f3b2016-05-24 18:17:13 -0500603config XIP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200604 bool "Execute in place"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600605 help
606 This option allows the kernel to operate with its text and read-only
David B. Kinderd7485772016-08-17 16:33:08 -0700607 sections residing in ROM (or similar read-only memory). Not all boards
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600608 support this option so it must be used with care; you must also
609 supply a linker command file when building your image. Enabling this
610 option increases both the code and data footprint of the image.
611
Anas Nashif9463dc02016-12-17 17:36:20 -0500612menu "Initialization Priorities"
Anas Nashif3d8e86c2016-12-19 18:41:17 -0500613
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400614config KERNEL_INIT_PRIORITY_OBJECTS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200615 int "Kernel objects initialization priority"
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400616 default 30
617 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500618 Kernel objects use this priority for initialization. This
619 priority needs to be higher than minimal default initialization
620 priority.
Dmitriy Korovkin4223ba72016-09-09 11:20:23 -0400621
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400622config KERNEL_INIT_PRIORITY_DEFAULT
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200623 int "Default init priority"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700624 default 40
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400625 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500626 Default minimal init priority for each init level.
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400627
628config KERNEL_INIT_PRIORITY_DEVICE
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200629 int "Default init priority for device drivers"
Daniel Leung546b8ad2016-03-28 14:05:33 -0700630 default 50
Dmitriy Korovkin57f27412015-10-26 15:56:02 -0400631 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500632 Device driver, that depends on common components, such as
633 interrupt controller, but does not depend on other devices,
634 uses this init priority.
Dirk Brandewiefeee30c2015-09-29 07:08:58 -0700635
Anas Nashif33118f92016-10-07 13:03:51 -0400636config APPLICATION_INIT_PRIORITY
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200637 int "Default init priority for application level drivers"
Anas Nashif33118f92016-10-07 13:03:51 -0400638 default 90
639 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500640 This priority level is for end-user drivers such as sensors and display
641 which have no inward dependencies.
Andy Ross53c85992017-07-24 14:59:55 -0700642
Anas Nashif8470b4d2018-02-25 22:18:17 -0500643
644endmenu
645
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600646menu "Security Options"
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600647
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600648config STACK_CANARIES
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200649 bool "Compiler stack canaries"
David Leachaa911132019-11-12 16:02:05 -0600650 depends on ENTROPY_GENERATOR || TEST_RANDOM_GENERATOR
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600651 help
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100652 This option enables compiler stack canaries.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600653
Anas Nashif429c2a42017-12-13 10:08:21 -0500654 If stack canaries are supported by the compiler, it will emit
655 extra code that inserts a canary value into the stack frame when
656 a function is entered and validates this value upon exit.
657 Stack corruption (such as that caused by buffer overflow) results
658 in a fatal error condition for the running entity.
659 Enabling this option can result in a significant increase
660 in footprint and an associated decrease in performance.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600661
Sebastian Bøe5a58da52019-01-21 14:02:55 +0100662 If stack canaries are not supported by the compiler an error
663 will occur at build time.
Leandro Pereirab007b642017-10-17 17:01:48 -0700664
665config EXECUTE_XOR_WRITE
666 bool "Enable W^X for memory partitions"
667 depends on USERSPACE
668 depends on ARCH_HAS_EXECUTABLE_PAGE_BIT
669 default y
670 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500671 When enabled, will enforce that a writable page isn't executable
672 and vice versa. This might not be acceptable in all scenarios,
673 so this option is given for those unafraid of shooting themselves
674 in the foot.
Leandro Pereirab007b642017-10-17 17:01:48 -0700675
Anas Nashif429c2a42017-12-13 10:08:21 -0500676 If unsure, say Y.
Leandro Pereirab007b642017-10-17 17:01:48 -0700677
Andrew Boie83752c12018-03-02 07:54:13 -0800678config STACK_POINTER_RANDOM
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200679 int "Initial stack pointer randomization bounds"
Andrew Boie83752c12018-03-02 07:54:13 -0800680 depends on !STACK_GROWS_UP
Flavio Ceolinfbeaa0a2020-02-25 15:32:39 -0800681 depends on MULTITHREADING
Flavio Ceolin2e0095a2019-04-30 10:45:48 -0700682 depends on TEST_RANDOM_GENERATOR || ENTROPY_HAS_DRIVER
Andrew Boie83752c12018-03-02 07:54:13 -0800683 default 0
684 help
685 This option performs a limited form of Address Space Layout
686 Randomization by offsetting some random value to a thread's
687 initial stack pointer upon creation. This hinders some types of
688 security attacks by making the location of any given stack frame
689 non-deterministic.
690
691 This feature can waste up to the specified size in bytes the stack
692 region, which is carved out of the total size of the stack region.
693 A reasonable minimum value would be around 100 bytes if this can
694 be spared.
695
696 This is currently only implemented for systems whose stack pointers
697 grow towards lower memory addresses.
698
Andrew Boie576ebf42019-03-07 15:56:55 -0800699config BOUNDS_CHECK_BYPASS_MITIGATION
700 bool "Enable bounds check bypass mitigations for speculative execution"
701 depends on USERSPACE
702 help
703 Untrusted parameters from user mode may be used in system calls to
704 index arrays during speculative execution, also known as the Spectre
705 V1 vulnerability. When enabled, various macros defined in
706 misc/speculation.h will insert fence instructions or other appropriate
707 mitigations after bounds checking any array index parameters passed
708 in from untrusted sources (user mode threads). When disabled, these
709 macros do nothing.
Juan Manuel Cruz0e301cc2015-03-11 12:44:14 -0600710endmenu
711
Chunlin Hane9c97022017-07-07 20:29:30 +0800712config MAX_DOMAIN_PARTITIONS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200713 int "Maximum number of partitions per memory domain"
Chunlin Hane9c97022017-07-07 20:29:30 +0800714 default 16
715 range 0 255
716 depends on USERSPACE
717 help
Anas Nashif429c2a42017-12-13 10:08:21 -0500718 Configure the maximum number of partitions per memory domain.
Chunlin Hane9c97022017-07-07 20:29:30 +0800719
Andrew Boiebc35b0b2020-08-19 13:11:47 -0700720config ARCH_MEM_DOMAIN_DATA
721 bool
722 depends on USERSPACE
723 help
724 This hidden option is selected by the target architecture if
725 architecture-specific data is needed on a per memory domain basis.
726 If so, the architecture defines a 'struct arch_mem_domain' which is
727 embedded within every struct k_mem_domain. The architecture
728 must also define the arch_mem_domain_init() function to set this up
729 when a memory domain is created.
730
731 Typical uses might be a set of page tables for that memory domain.
732
Andrew Boie00f71b02020-08-25 17:02:38 -0700733config ARCH_MEM_DOMAIN_SYNCHRONOUS_API
734 bool
735 depends on USERSPACE
736 help
737 This hidden option is selected by the target architecture if
738 modifying a memory domain's partitions at runtime, or changing
739 a memory domain's thread membership requires synchronous calls
740 into the architecture layer.
741
742 If enabled, the architecture layer must implement the following
743 APIs:
744
745 arch_mem_domain_thread_add
746 arch_mem_domain_thread_remove
747 arch_mem_domain_partition_remove
748 arch_mem_domain_partition_add
Andrew Boie00f71b02020-08-25 17:02:38 -0700749
750 It's important to note that although supervisor threads can be
751 members of memory domains, they have no implications on supervisor
752 thread access to memory. Memory domain APIs may only be invoked from
753 supervisor mode.
754
755 For these reasons, on uniprocessor systems unless memory access
756 policy is managed in separate software constructions like page
757 tables, these APIs don't need to be implemented as the underlying
758 memory management hardware will be reprogrammed on context switch
759 anyway.
760
Anas Nashifee9bebf2018-02-25 22:12:35 -0500761menu "SMP Options"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100762
Andy Ross042d8ec2017-12-09 08:37:20 -0800763config USE_SWITCH
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800764 bool "Use new-style _arch_switch instead of arch_swap"
Sebastian Bøef42ed322018-12-27 18:20:56 +0100765 depends on USE_SWITCH_SUPPORTED
Andy Ross042d8ec2017-12-09 08:37:20 -0800766 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500767 The _arch_switch() API is a lower level context switching
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800768 primitive than the original arch_swap mechanism. It is required
Anas Nashifee9bebf2018-02-25 22:12:35 -0500769 for an SMP-aware scheduler, or if the architecture does not
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800770 provide arch_swap. In uniprocess situations where the
Anas Nashifee9bebf2018-02-25 22:12:35 -0500771 architecture provides both, _arch_switch incurs more somewhat
772 overhead and may be slower.
Andy Ross042d8ec2017-12-09 08:37:20 -0800773
Sebastian Bøef42ed322018-12-27 18:20:56 +0100774config USE_SWITCH_SUPPORTED
775 bool
776 help
777 Indicates whether _arch_switch() API is supported by the
778 currently enabled platform. This option should be selected by
779 platforms that implement it.
780
Andy Rossd3376f22018-01-25 14:03:02 -0800781config SMP
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200782 bool "Enable symmetric multithreading support"
Sebastian Bøe21d69572018-12-27 18:08:24 +0100783 depends on USE_SWITCH
Andy Rossd3376f22018-01-25 14:03:02 -0800784 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500785 When true, kernel will be built with SMP support, allowing
786 more than one CPU to schedule Zephyr tasks at a time.
Andy Rossd3376f22018-01-25 14:03:02 -0800787
Guennadi Liakhovetski8d07b772021-04-01 13:46:57 +0200788config SMP_BOOT_DELAY
789 bool "Delay booting secondary cores"
790 depends on SMP
791 help
792 By default Zephyr will boot all available CPUs during start up.
793 Select this option to skip this and allow architecture code boot
794 secondary CPUs at a later time.
795
Andy Rossd3376f22018-01-25 14:03:02 -0800796config MP_NUM_CPUS
Ulf Magnusson8cf8db32018-08-14 16:19:20 +0200797 int "Number of CPUs/cores"
Andy Rossd3376f22018-01-25 14:03:02 -0800798 default 1
Charles E. Youse64300a72019-09-24 13:29:41 -0400799 range 1 4
Andy Rossd3376f22018-01-25 14:03:02 -0800800 help
Anas Nashifee9bebf2018-02-25 22:12:35 -0500801 Number of multiprocessing-capable cores available to the
802 multicpu API and SMP features.
803
Andy Ross42ed12a2019-02-19 16:03:39 -0800804config SCHED_IPI_SUPPORTED
Ulf Magnusson40b49e22020-01-17 23:14:54 +0100805 bool
Andy Ross42ed12a2019-02-19 16:03:39 -0800806 help
807 True if the architecture supports a call to
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800808 arch_sched_ipi() to broadcast an interrupt that will call
Andy Ross42ed12a2019-02-19 16:03:39 -0800809 z_sched_ipi() on other CPUs in the system. Required for
810 k_thread_abort() to operate with reasonable latency
811 (otherwise we might have to wait for the other thread to
812 take an interrupt, which can be arbitrarily far in the
813 future).
814
Enjia Mai7ac40aa2020-05-28 11:29:50 +0800815config TRACE_SCHED_IPI
816 bool "Enable Test IPI"
817 help
818 When true, it will add a hook into z_sched_ipi(), in order
819 to check if schedule IPI has called or not, for testing
820 purpose.
821 depends on SCHED_IPI_SUPPORTED
822 depends on MP_NUM_CPUS>1
823
Andy Rossf6d32ab2020-05-13 15:34:04 +0000824config KERNEL_COHERENCE
825 bool "Place all shared data into coherent memory"
Anas Nashife1d42722020-12-07 14:28:53 -0500826 depends on ARCH_HAS_COHERENCE
827 default y if SMP && MP_NUM_CPUS > 1
Andy Rossf6d32ab2020-05-13 15:34:04 +0000828 select THREAD_STACK_INFO
829 help
830 When available and selected, the kernel will build in a mode
831 where all shared data is placed in multiprocessor-coherent
832 (generally "uncached") memory. Thread stacks will remain
833 cached, as will application memory declared with
834 __incoherent. This is intended for Zephyr SMP kernels
835 running on cache-incoherent architectures only. Note that
836 when this is selected, there is an implicit API change that
837 assumes cache coherence to any memory passed to the kernel.
838 Code that creates kernel data structures in uncached regions
839 may fail strangely. Some assertions exist to catch these
840 mistakes, but not all circumstances can be tested.
841
Anas Nashifee9bebf2018-02-25 22:12:35 -0500842endmenu
Andy Rossd3376f22018-01-25 14:03:02 -0800843
Andy Ross08397272018-10-01 11:13:55 -0700844config TICKLESS_KERNEL
845 bool "Tickless kernel"
Andy Rossc0a184c2018-10-12 06:58:21 -0700846 default y if TICKLESS_CAPABLE
Flavio Ceolind6d4a832021-01-06 12:14:45 -0800847 depends on TICKLESS_CAPABLE
Andy Ross08397272018-10-01 11:13:55 -0700848 help
849 This option enables a fully event driven kernel. Periodic system
Sebastian Bøe204f05b2018-12-27 19:09:09 +0100850 clock interrupt generation would be stopped at all times.
Andy Ross08397272018-10-01 11:13:55 -0700851
Daniel Leung2d152ab2020-10-27 10:50:10 -0700852config TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
853 bool
854 default y if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"
855 help
856 Hidden option to signal that toolchain supports generating code
857 with thread local storage.
858
Daniel Leung240beb42020-09-28 11:03:52 -0700859config THREAD_LOCAL_STORAGE
860 bool "Thread Local Storage (TLS)"
Daniel Leung2d152ab2020-10-27 10:50:10 -0700861 depends on ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE
Daniel Leung38872582020-09-29 12:16:01 -0700862 select NEED_LIBC_MEM_PARTITION if (CPU_CORTEX_M && USERSPACE)
Daniel Leung240beb42020-09-28 11:03:52 -0700863 help
864 This option enables thread local storage (TLS) support in kernel.
865
Anas Nashif9463dc02016-12-17 17:36:20 -0500866endmenu