Skip to content

zephyr: fix race in secondary core power-up#5455

Merged
lgirdwood merged 2 commits into
thesofproject:mainfrom
kv2019i:topic/zfix-core-powerup-race
Mar 1, 2022
Merged

zephyr: fix race in secondary core power-up#5455
lgirdwood merged 2 commits into
thesofproject:mainfrom
kv2019i:topic/zfix-core-powerup-race

Conversation

@kv2019i
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i commented Mar 1, 2022

z_wrapper_cpu_enable_secondary_core() may be called
repeatedly on a core that is already running. Add a check
to ensure we do not try to restart a core that is already
running.

Also add a check for ready_flag as done in upstream Zephyr
kernel/smp.c to ensure z_wrapper_cpu_enable_secondary_core()
does not return until the target core has finished its
startup and arch_cpu_active() returns true.

BugLink: #5446
Signed-off-by: Kai Vehmanen kai.vehmanen@linux.intel.com

z_wrapper_cpu_enable_secondary_core() may be called
repeatedly on a core that is already running. Add a check
to ensure we do not try to restart a core that is already
running.

Also add a check for ready_flag as done in upstream Zephyr
kernel/smp.c to ensure z_wrapper_cpu_enable_secondary_core()
does not return until the target core has finished its
startup and arch_cpu_active() returns true.

BugLink: thesofproject#5446
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Use the new interface to initialize non-primary cores before
enabling them with arch_start_cpu(). This interface is not
available in Zephyr 3.0.0, but is mandatory in later release.

Depends on Zephyr commit 2b210cb3db05 ("kernel: Refactor SMP cpu
initialization a bit").

BugLink: thesofproject#5456
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copy link
Copy Markdown
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

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

Looks correct to me.

@lgirdwood lgirdwood merged commit f1e3c93 into thesofproject:main Mar 1, 2022
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