[PATCH 2/2] firmware: arm_scmi: power_control: Set SCMI_SYSPOWER_IDLE in pm resume
Peng Fan
peng.fan at oss.nxp.com
Tue Jun 24 07:58:07 PDT 2025
On Tue, Jun 24, 2025 at 11:21:52AM +0100, Sudeep Holla wrote:
>On Tue, Jun 24, 2025 at 01:23:10AM +0000, Peng Fan wrote:
>> >
>> > Just to summarise my understanding here at very high level, the issue
>> > exists as the second notification by an agent to the Linux to suspend
>> > the system wakes up the system from suspend state. Since the
>> > interrupts are enabled before the thaw_processes() (which eventually
>> > continues the execution of scmi_suspend_work_func() to set the state
>> > to SCMI_SYSPOWER_IDLE, the scmi_userspace_notifier() is executed
>> > much before and ends up ignoring the request as the state is still not
>> > set to SCMI_SYSPOWER_IDLE. There is a race which your patch is
>> > addressing.
>>
>> Thanks for writing this down, It is very correct and clear.
>>
>
>While I am not against adding bus PM ops as it can be useful elsewhere,
>just wonder if this usecase is a good use of it. Does setting the state
>before the pm_suspend() call suffice. I still need to think through the
>possible race with that solution, but just asking you to check if that
There is race condition if setting the state to SCMI_SYSPOWER_IDLE before
pm_suspend.
The 2nd suspend notification could runs into pm_suspend again
before pm_suspend update system_state to SYSTEM_SUSPEND, if my understanding
is correct.
Per pm_suspend->enter_state,
"Make sure that no one else is trying to put the system into a sleep state",
not sure, but I think better not let pm_suspend to handle the race condition.
Since syspower only has one per system(linux), the other approach is to
use syscore, but need a global variable for state in scmi_power_control.c,
because syscore_suspend/resume does not have parameter.
we need to set state back to IDLE after linux wakeup and before kernel
thread scheduling. I only see two interfaces to achieve:
PM ops or syscore ops.
Thanks,
Peng
>helps.
>
>--
>Regards,
>Sudeep
More information about the linux-arm-kernel
mailing list