Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipc4: Add preeption guard to bind/unbind #8205

Conversation

serhiy-katsyuba-intel
Copy link
Contributor

This is a workaround to protect bind/unbind operations to be preempted by LL scheduler.

* This is intendent to be a temporary workaround and should be replaced with some
* proper robust guard solution.
*/
k_sched_lock();
irq_local_disable(flags);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still need irq_disable than?

Even if - we need to use irq_lock instead of "local disable"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without irq_local_disable(), timer interrupt may come and increase LL scheduler semaphore. That will not start LL scheduler because of k_shed_lock(), however, if inside comp_buffer_connect() somebody calls sleep(), then LL scheduler will start. Having irq_local_disable() will not allow timer interrupt to increase semaphore. So, its better to have irq_local_disable() at least for duration of two com_buffer_connect(). However, we cannot have interrupts disabled during comp_bind_remote() as we rely of k_shed_lock() and that nobody uses sleep() inside .bind() handler.
So k_shed_lock() is not 100% replacement for irq_local_disable() but just a good enough workaround we can quickly introduce.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if - we need to use irq_lock instead of "local disable"

irq_local_disable(), despite its name, disables interrupts globally :)

Anyway, we'll need at some future to replace this workaround with proper guard and fix other critical bind related issues, like lack of .params() and .prepare() calls if binding to running pipeline.

@keqiaozhang
Copy link
Collaborator

SOFCI TEST

This is a workaround to protect bind/unbind operations to be preempted
by LL scheduler but still enabling IDC interrupt.

Signed-off-by: Serhiy Katsyuba <[email protected]>
@marcinszkudlinski marcinszkudlinski merged commit 0a8d12b into thesofproject:mtl-006-drop-stable Sep 15, 2023
27 of 41 checks passed
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.

3 participants