Skip to content

schedule: cancel a task before freeing it - #8451

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
lyakh:chain-dma
Nov 9, 2023
Merged

kv2019i merged 1 commit into
thesofproject:mainfrom
lyakh:chain-dma

Conversation

@lyakh

@lyakh lyakh commented Nov 6, 2023

Copy link
Copy Markdown
Collaborator

When a chain DMA stream is the only one running, stopping it currently takes 100ms. The reason is that the chain DMA driver is trying to stop the task directly from the IPC context instead of letting the task exit on its next scheduling event. The IPC thread is indeed trying to wait on a semaphore for the task to exit, but that doesn't work either, because zephyr_domain_unregister() terminates the thread before it signals the semaphore. To fix this we swap the order and signal the semaphore before terminating the thread. Fixes #8445

@lyakh
lyakh marked this pull request as ready for review November 7, 2023 07:15

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lyakh Minor note on the commit prefix, but otherwise looks good.

Comment thread src/schedule/zephyr_ll.c
When a chain DMA stream is the only one running, stopping it
currently takes 100ms. The reason is that the chain DMA driver is
trying to stop the task directly from the IPC context instead of
letting the task exit on its next scheduling event. The IPC thread is
indeed trying to wait on a semaphore for the task to exit, but that
doesn't work either, because zephyr_domain_unregister() terminates
the thread before it signals the semaphore. To fix this we swap the
order and signal the semaphore before terminating the thread.

Link: thesofproject#8445
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh lyakh changed the title chain-dma: cancel a task before freeing it schedule: cancel a task before freeing it Nov 9, 2023
@kv2019i
kv2019i merged commit b7d7fb0 into thesofproject:main Nov 9, 2023
@lyakh
lyakh deleted the chain-dma branch November 9, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stopping/Pausing a CHAIN_DMA stream takes 100ms

4 participants