-
Notifications
You must be signed in to change notification settings - Fork 325
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
[FEATURE] stop using the internal kernel API on the SOF side when enabling secondary cores. #7593
Comments
FYI @nashif |
@lgirdwood @kv2019i @tmleman I investigate this issue. Let's first review our last state: Given this is an open-coded of z_smp_start_cpu() (see comment above), I don't fully understand why we have a different implementation here, and if this is correct, why this is not needed in the Zephyr kernel/smp.c version. Wouldn't the same problem be there? Or is this specific to a configuration where state is saved to persistant memory? If yes, this would need to be ifdef'ed out so this applies only to applicable platforms. I don't know how zephyr is handling it but right now it's not working properly. After secondary core exits D3 it will repeat the path that led him to this state. Power will not be shut off so eventually it will return to the Idle state but this is not correct behavior. Maybe zephyr doesn't support situation in which each core can be turned off and on multiple times. My conclusion: (2) z_smp_start_cpu will initialized the cpu context for each core power-up stage, so our context save can't work. I agree with tmleman, current zephyr implementation doesn't support our design. But what's the gain of our design ? I find sys_cache_data_flush_and_invd_all and xthal_window_spill. these two operations maybe consume more time than skipping z_init_cpu. Booting from clean environment may be less bug. To use z_smp_start_cpu, we need to first disable context saving &restore for SOFT_OFF state and then do effort to debug it. It is very a struggling decision. |
@dcpleung are you working on this feature ? (zephyrproject-rtos/zephyr#64755) If so, can you take over it ? Thanks! |
@RanderWang @dcpleung is working on the cleanup on the zephyr side of things and provided a patch to be applied on SOF: zephyrproject-rtos#32. So it would be great if you can collaborate on this and help test the change from an SOF perspective. |
I don't have a test rig to verify that the changes work correctly on all supported platforms, especially where secondary cores are going into power saving mode and then being brought back up. It would be great if you can test this. |
great! let's work together |
@kv2019i probably a v2.9 unless you think it can land soon ? |
Ack, this was very close (the PR set passes most tests, but a few iterations are still needed). So I'll push to v2.9, we can consider a cherry-pick if needed. |
This is now done and merged to SOF main. |
SOF should use the public zephyr API for power management of CPU cores. The currently used functions are internal kernel functions and should not be used from within the application. The code in file zephyr/lib/cpu.c needs to be refactored.
soc: intel_adsp: call framework callback function for restore zephyrproject-rtos/zephyr#65394
kernel: introduce
k_smp_cpu_start()
andk_smp_cpu_resume()
zephyrproject-rtos/zephyr#64755zephyr: use
k_smp_cpu_start()
/k_smp_cpu_resume()
for secondary core power up zephyrproject-rtos/sof#32EDIT updated 4th Dec with latest tracking.
The text was updated successfully, but these errors were encountered: