Uh oh!
There was an error while loading. Please reload this page.
[DNM]cpu: fix cpu_disable_core for primary core - #10036
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the core disable logic to speed up the DSP D3 transition by performing suspend/disable actions in the IPC context and adjusts board configurations for proper poweroff functionality.
- Updated cpu_disable_core() to call sys_poweroff() on the primary core.
- Modified IPC powerdown sequence to suspend devices before disabling the core.
- Added CONFIG_POWEROFF=y to multiple board configuration files.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/lib/cpu.c | Updated core disable logic for primary core using sys_poweroff. |
| src/ipc/ipc-zephyr.c | Adjusted IPC shutdown sequence to trigger device suspend. |
| app/boards/intel_adsp_cavs25.conf | Enabled poweroff configuration. |
| app/boards/intel_adsp_ace30_wcl.conf | Enabled poweroff configuration. |
| app/boards/intel_adsp_ace30_ptl.conf | Enabled poweroff configuration. |
| app/boards/intel_adsp_ace20_lnl.conf | Enabled poweroff configuration. |
| app/boards/intel_adsp_ace15_mtpm.conf | Enabled poweroff configuration. |
| /* Primary core will be turned off by the host. This does not return. */ | ||
| if (cpu_is_primary(id)) { | ||
| cpu_notify_state_entry(PM_STATE_SOFT_OFF); | ||
| sys_poweroff(); |
There was a problem hiding this comment.
Since sys_poweroff() is not expected to return, consider adding an unreachable marker (e.g., an assertion or a __builtin_unreachable()) immediately after the call to clarify the control flow in case it unexpectedly returns.
| sys_poweroff(); | |
| sys_poweroff(); | |
| __builtin_unreachable(); |
| * IPC thread during idle. | ||
| */ | ||
| /* force device suspend */ | ||
| ipc_device_suspend_handler(NULL, ipc); |
There was a problem hiding this comment.
The return value of ipc_device_suspend_handler() is not checked. Consider verifying the result and handling any errors to ensure device suspend completes successfully.
| ipc_device_suspend_handler(NULL, ipc); | |
| intret=ipc_device_suspend_handler(NULL, ipc); | |
| if (ret<0) { | |
| LOG_ERR("Device suspend failed with error: %d", ret); | |
| /* Handle error appropriately, e.g., abort further operations */ | |
| returnSOF_TASK_STATE_ERROR; | |
| } |
lgirdwood
commented
May 30, 2025
@abonislawski pls take a look. |
Uh oh!
There was an error while loading. Please reload this page.
abonislawski
commented
Jun 4, 2025
Good direction and transition time reduction, AFAIK it will be more aligned with Intel reference now. |
tmleman
left a comment
There was a problem hiding this comment.
Currently, we can utilize POWEROFF when CONFIG_ADSP_IMR_CONTEXT_SAVE is disabled. This approach makes sense, as it enables us to skip unnecessary power management operations, thus reducing the D3 entry time. However, it is crucial to separate these two cases in the code.
| if (cpu_is_primary(id)) { | ||
| cpu_notify_state_entry(PM_STATE_SOFT_OFF); | ||
| sys_poweroff(); | ||
| } |
There was a problem hiding this comment.
This flow, in its current implementation, makes sense only in configurations with IMR context save disabled. The current context save implementation expects us to return to the function that was the entry point for power down. Therefore, in this case, we should return from sys_poweroff(). Consequently, we need to reinitialize all devices that were suspended and send a FW ready ipc, essentially implementing the following change:
--- a/zephyr/lib/cpu.c+++ b/zephyr/lib/cpu.c@@ -268,6 +268,8 @@ void cpu_disable_core(int id)
if (cpu_is_primary(id)) {
cpu_notify_state_entry(PM_STATE_SOFT_OFF);
sys_poweroff();
+ cpu_notify_state_exit(PM_STATE_SOFT_OFF);+ return;
}ranj063
commented
Jun 9, 2025
SOFCI TEST |
ranj063
commented
Jun 9, 2025
SOFCI TEST |
ranj063
commented
Jun 23, 2025
SOFCI TEST |
ranj063
commented
Jun 24, 2025
SOFCI TEST |
Nodify the logic for DSP D3 transition to invoke the sys_poweroff() call to speed up the transition by performing the suspend/disable actions in the IPC context instead of idle context. This results in a reduction of the D3 transition time from 100ms on the ACE1.5 based MTL laptop to ~1ms. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
test Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
Some GH actions failing due to disk usage over 14G limit. Unrelated to this PR.
| * IPC thread during idle. | ||
| */ | ||
| /* force device suspend */ | ||
| ipc_device_suspend_handler(NULL, ipc); |
| /* Primary core will be turned off by the host. This does not return. */ | ||
| if (cpu_is_primary(id)) { | ||
| cpu_notify_state_entry(PM_STATE_SOFT_OFF); | ||
| sys_poweroff(); |
ranj063
commented
Jun 26, 2025
dropping this PR as #10028 reduces the D3 transition times to just about ~2ms without full context save/restore. |
Nodify the logic for DSP D3 transition to invoke the sys_poweroff() call to speed up the transition by performing the suspend/disable actions in the IPC context instead of idle context. This results in a reduction of the D3 transition time from 100ms on the ACE1.5 based MTL laptop to ~1ms.
Depends on zephyr PR: zephyrproject-rtos/zephyr#90821