lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250624145807.GA14878@nxa18884-linux>
Date: Tue, 24 Jun 2025 22:58:07 +0800
From: Peng Fan <peng.fan@....nxp.com>
To: Sudeep Holla <sudeep.holla@....com>
Cc: Peng Fan <peng.fan@....com>, Dhruva Gole <d-gole@...com>,
	Cristian Marussi <cristian.marussi@....com>,
	"arm-scmi@...r.kernel.org" <arm-scmi@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Ranjani Vaidyanathan <ranjani.vaidyanathan@....com>,
	Chuck Cannon <chuck.cannon@....com>
Subject: Re: [PATCH 2/2] firmware: arm_scmi: power_control: Set
 SCMI_SYSPOWER_IDLE in pm resume

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ