Skip to content

Conversation

@andrew-mtk
Copy link
Contributor

@andrew-mtk andrew-mtk commented Apr 2, 2025

Fix crash thesofproject#9933 in DEBUG build on MTK platform.
ipc_init() must be called after scheduler_init_ll().

@sofci
Copy link
Collaborator

sofci commented Apr 2, 2025

Can one of the admins verify this patch?

reply test this please to run this test once

@andrew-mtk andrew-mtk force-pushed the fix-null-deref branch 2 times, most recently from 5d6cc52 to d6286c8 Compare April 2, 2025 02:01
struct zephyr_domain *zephyr_domain;

if (!ll_sch_dom)
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this patch adds a few checks to a function that's called frequently, albeit on paths that shouldn't be time-critical. Still I'm curious how is it possible to get NULL in _schedulers[] array - you don't register schedulers on all cores?

Copy link
Member

Choose a reason for hiding this comment

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

@andrew-mtk might be worth checking if this is being created correctly and not clobbered. This could be why its failing on your platform ?

Copy link
Contributor Author

@andrew-mtk andrew-mtk Apr 3, 2025

Choose a reason for hiding this comment

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

@lgirdwood, I did more tests and found that platform_init() for MTK platforms calls ipc_init() before scheduler_init_ll(). If I reverse the order, there is no crash.

@marcinszkudlinski
Copy link
Contributor

What is a background of this change? Has it ever crashed at null at one of those points?
If not, better use ASSERT that works in debug mode only and does not pull any additional load in production.

Fix crash thesofproject#9933 in DEBUG
build on MTK platform.
ipc_init() must be called after scheduler_init_ll().

Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
@andrew-mtk andrew-mtk changed the title schedule: Add check for a NULL pointers before deref platform: mtk: Fix crash in DEBUG build on MTK platform Apr 3, 2025
@lgirdwood lgirdwood merged commit 72de8b6 into thesofproject:main Apr 4, 2025
42 of 44 checks passed
@andrew-mtk andrew-mtk deleted the fix-null-deref branch April 21, 2025 19:49
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.

6 participants