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] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNaGOgGm7QRWEJ1m@kekkonen.localdomain>
Date: Fri, 26 Sep 2025 15:25:30 +0300
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Brian Norris <briannorris@...omium.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
	Pavel Machek <pavel@...nel.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	Len Brown <lenb@...nel.org>, linux-kernel@...r.kernel.org,
	kunit-dev@...glegroups.com, linux-pm@...r.kernel.org,
	Dhruva Gole <d-gole@...com>
Subject: Re: [PATCH v2 2/3] PM: runtime: Make put{,_sync}() return 1 when
 already suspended

Hi Brian,

Thanks for the update.

On Thu, Sep 25, 2025 at 12:42:15PM -0700, Brian Norris wrote:
> The pm_runtime.h docs say pm_runtime_put() and pm_runtime_put_sync()
> return 1 when already suspended, but this is not true -- they return
> -EAGAIN. On the other hand, pm_runtime_put_sync_suspend() and
> pm_runtime_put_sync_autosuspend() *do* return 1.
> 
> This is an artifact of the fact that the former are built on rpm_idle(),
> whereas the latter are built on rpm_suspend().
> 
> There are precious few pm_runtime_put()/pm_runtime_put_sync() callers
> that check the return code at all, but most of them only log errors, and
> usually only for negative error codes. None of them should be treating
> this as an error, so:
> 
>  * at best, this may fix some case where a driver treats this condition
>    as an error, when it shouldn't;
> 
>  * at worst, this should make no effect; and
> 
>  * somewhere in between, we could potentially clear up non-fatal log
>    messages.
> 
> Fix the pm_runtime_already_suspended_test() while tweaking the behavior.
> The test makes a lot more sense when these all return 1 when the device
> is already suspended:
> 
>     pm_runtime_put_sync(dev);
>     pm_runtime_suspend(dev);
>     pm_runtime_autosuspend(dev);
>     pm_request_autosuspend(dev);
>     pm_runtime_put_sync_autosuspend(dev);
> 
> Notably, I've avoided testing the return codes for these, since they
> really should be ignored by callers, and we may make them 'void'
> altogether:
> 
>     pm_runtime_put(dev);
>     pm_runtime_put_autosuspend(dev);
> 
> Signed-off-by: Brian Norris <briannorris@...omium.org>
> Reviewed-by: Dhruva Gole <d-gole@...com>

Reviewed-by: Sakari Ailus <sakari.ailus@...ux.intel.com>

-- 
Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ