Skip to content

Commit 5e6362b

Browse files
ubiedanashif
authored andcommitted
p4wq: Add Kconfig to perform early init on threads
In order to make them functional for devices during init. Default behavior is to keep late initialization, as before. Signed-off-by: Luis Ubieda <[email protected]> (cherry picked from commit ec45b29)
1 parent 8912bb4 commit 5e6362b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/os/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ config MPSC_CLEAR_ALLOCATED
106106
When enabled packet space is zeroed before returning from allocation.
107107
endif
108108

109+
if SCHED_DEADLINE
110+
111+
config P4WQ_INIT_STAGE_EARLY
112+
bool "Early initialization of P4WQ threads"
113+
help
114+
Initialize P4WQ threads early so that the P4WQ can be used on devices
115+
initialization sequence.
116+
117+
endif
118+
109119
config REBOOT
110120
bool "Reboot functionality"
111121
help

lib/os/p4wq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ void k_p4wq_enable_static_thread(struct k_p4wq *queue, struct k_thread *thread,
221221
* so they can initialize in parallel instead of serially on the main
222222
* CPU.
223223
*/
224+
#if defined(CONFIG_P4WQ_INIT_STAGE_EARLY)
225+
SYS_INIT(static_init, POST_KERNEL, 1);
226+
#else
224227
SYS_INIT(static_init, APPLICATION, 99);
228+
#endif
225229

226230
void k_p4wq_submit(struct k_p4wq *queue, struct k_p4wq_work *item)
227231
{

0 commit comments

Comments
 (0)