summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorJerome Forissier <[email protected]>2025-04-18 16:09:34 +0200
committerTom Rini <[email protected]>2025-04-23 13:19:44 -0600
commitf9384796179abcc7e5796815c79b2137f5f83b12 (patch)
tree2254c00b727719c904ffdbd9cc9ca0fbcaa066fa /doc/api
parentb989f9ed9fe13be2cb168d2d45c235f011104f38 (diff)
uthread: add cooperative multi-tasking interface
Add a new internal API called uthread (Kconfig symbol: UTHREAD) which provides cooperative multi-tasking. The goal is to be able to improve the performance of some parts of U-Boot by overlapping lengthy operations, and also implement background jobs in the U-Boot shell. Each uthread has its own stack allocated on the heap. The default stack size is defined by the UTHREAD_STACK_SIZE symbol and is used when uthread_create() receives zero for the stack_sz argument. The implementation is based on context-switching via initjmp()/setjmp()/ longjmp() and is inspired from barebox threads [1]. A notion of thread group helps with dependencies, such as when a thread needs to block until a number of other threads have returned. The name "uthread" comes from "user-space threads" because the scheduling happens with no help from a higher privileged mode, contrary to more complex models where kernel threads are defined. But the 'u' may as well stand for 'U-Boot' since the bootloader may actually be running at any privilege level and the notion of user vs. kernel may not make much sense in this context. [1] https://github.com/barebox/barebox/blob/master/common/bthread.c Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/index.rst1
-rw-r--r--doc/api/uthread.rst7
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/api/index.rst b/doc/api/index.rst
index 0dc9ad45d41..506843ed74a 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -29,3 +29,4 @@ U-Boot API documentation
sysreset
timer
unicode
+ uthread
diff --git a/doc/api/uthread.rst b/doc/api/uthread.rst
new file mode 100644
index 00000000000..21233ff6b22
--- /dev/null
+++ b/doc/api/uthread.rst
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Uthread API
+===========
+
+.. kernel-doc:: include/uthread.h
+ :internal: