Browse Source

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 <luisf@croxel.com>
pull/85900/head
Luis Ubieda 5 months ago committed by Benjamin Cabé
parent
commit
ec45b29ea3
  1. 10
      lib/os/Kconfig
  2. 4
      lib/os/p4wq.c

10
lib/os/Kconfig

@ -106,6 +106,16 @@ config MPSC_CLEAR_ALLOCATED @@ -106,6 +106,16 @@ config MPSC_CLEAR_ALLOCATED
When enabled packet space is zeroed before returning from allocation.
endif
if SCHED_DEADLINE
config P4WQ_INIT_STAGE_EARLY
bool "Early initialization of P4WQ threads"
help
Initialize P4WQ threads early so that the P4WQ can be used on devices
initialization sequence.
endif
config REBOOT
bool "Reboot functionality"
help

4
lib/os/p4wq.c

@ -218,7 +218,11 @@ void k_p4wq_enable_static_thread(struct k_p4wq *queue, struct k_thread *thread, @@ -218,7 +218,11 @@ void k_p4wq_enable_static_thread(struct k_p4wq *queue, struct k_thread *thread,
* so they can initialize in parallel instead of serially on the main
* CPU.
*/
#if defined(CONFIG_P4WQ_INIT_STAGE_EARLY)
SYS_INIT(static_init, POST_KERNEL, 1);
#else
SYS_INIT(static_init, APPLICATION, 99);
#endif
void k_p4wq_submit(struct k_p4wq *queue, struct k_p4wq_work *item)
{

Loading…
Cancel
Save