Skip to content

Commit 4b49d7c

Browse files
kv2019inashif
authored andcommitted
lib: os: p4wq: fix K_P4WQ_DELAYED_START mode
When the PRESTART thread state was removed, this changed the semantics of k_thread_start() when thread was created with a K_FOREVER timeout, suspended and then started with k_thread_start(). This sequence is used in p4wq to implement K_P4WQ_DELAYED_START (which again is needed by K_P4WQ_USER_CPU_MASK). With PRESTART removed, the following sequence: z_mark_thread_as_not_suspended(thread); k_thread_start(thread); .. no longer starts the thread. As a result, p4wq users like SOF multicore configurations, hit errors as p4wq threads never start. Fix the implementation by removing the calls to change thread suspended state explicitly, but rather rely on the new k_thread_create() and k_thread_start() semantics. Fixes: 7cdf405 ("kernel/sched: Eliminate PRESTART thread state") Signed-off-by: Kai Vehmanen <[email protected]>
1 parent b895769 commit 4b49d7c

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

lib/os/p4wq.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@ static int static_init(void)
168168
&pp->stacks[ssz * i],
169169
pp->stack_size);
170170

171-
if (pp->flags & K_P4WQ_DELAYED_START) {
172-
z_mark_thread_as_suspended(&pp->threads[i]);
173-
}
174-
175171
#ifdef CONFIG_SCHED_CPU_MASK
176172
if (pp->flags & K_P4WQ_USER_CPU_MASK) {
177173
int ret = k_thread_cpu_mask_clear(&pp->threads[i]);
@@ -206,7 +202,6 @@ void k_p4wq_enable_static_thread(struct k_p4wq *queue, struct k_thread *thread,
206202
#endif
207203

208204
if (queue->flags & K_P4WQ_DELAYED_START) {
209-
z_mark_thread_as_not_suspended(thread);
210205
k_thread_start(thread);
211206
}
212207
}

0 commit comments

Comments
 (0)