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: <20250702-apricot-anteater-of-fertility-92ebc2@sudeepholla>
Date: Wed, 2 Jul 2025 16:26:18 +0100
From: Sudeep Holla <sudeep.holla@....com>
To: Peng Fan <peng.fan@....nxp.com>
Cc: Peng Fan <peng.fan@....com>, Dhruva Gole <d-gole@...com>,
	Cristian Marussi <cristian.marussi@....com>,
	Sudeep Holla <sudeep.holla@....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, Jul 01, 2025 at 11:07:35PM +0800, Peng Fan wrote:
> Hi Sudeep,
> 
> On Tue, Jun 24, 2025 at 10:58:07PM +0800, Peng Fan wrote:
> >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.
> 
> Not sure you have time to give a look. I plan to post V2 later this
> week. In V2, I would still use pm ops.
> 

Sure, please go ahead and post. I didn't get time to look at it in depth.
I agree with your comment for now, will take a look at it again with your v2.

-- 
Regards,
Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ