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: <aNWLnxtxS1tqiqbC@google.com>
Date: Thu, 25 Sep 2025 11:36:15 -0700
From: Brian Norris <briannorris@...omium.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Pavel Machek <pavel@...nel.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	kunit-dev@...glegroups.com, Len Brown <lenb@...nel.org>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] PM: runtime: Add basic kunit tests for API contracts

On Wed, Sep 24, 2025 at 07:34:31PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 24, 2025 at 7:32 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
> > On Tue, Sep 23, 2025 at 11:51 PM Brian Norris <briannorris@...omium.org> wrote:
> > > On Fri, Sep 19, 2025 at 06:58:50PM +0200, Rafael J. Wysocki wrote:
> > > > Yeah, so I'd prefer to change this particular thing entirely,
> > > > especially in the face of
> > > >
> > > > https://lore.kernel.org/linux-pm/5049058.31r3eYUQgx@rafael.j.wysocki/
> > > >
> > > > which quite obviously doesn't take the return value of
> > > > pm_runtime_put() and pm_runtime_put_sutosuspend() into account.
> > > >
> > > > I would like these two functions to be void.
> > >
> > > Sure, I think inspecting put() return codes is generally a bad idea.
> > > 'void' would be cool with me, although maybe a bit impractical now,
> > > considering how many users look at the current return code.
> >
> > For pm_runtime_put() it's not that bad.  I have ~20 patches changing
> > all of the code looking at its return value to stop doing that.
> >
> > Interestingly enough, there's only one piece of that code (USB core)
> > doing anything remotely useful with that return value.  Everything
> > else is just garbage IMV.
> >
> > > So at a minimum, I'd separate "make 'em void" from my "document and test the
> > > API" work.
> >
> > But you can just skip them.
> >
> > > Really, I'm mostly looking at this area because I have to support driver
> > > developers trying to learn how to use the runtime PM API, and they
> > > wonder about the return codes. So if they exist, I'd at least like them
> > > to make sense.
> >
> > Sure.
> >
> > That said, as far as pm_runtime_put() and pm_runtime_put_autosuspend()
> > are concerned, you may as well just say "discard their return values,
> > you don't want to have to deal with them, and never ever pass them
> > verbatim to the callers of your code".

Sounds reasonable.

I'll drop any unit test expectations for pm_runtime_put() and
pm_runtime_put_autosuspend() return codes. But I'll leave
pm_runtime_put_sync().

> > > Anyway, for the particulars of this test: I can try to adapt the comment
> > > language a bit. But are you suggesting I shouldn't even try patch 2,
> > > which fixes the pm_runtime_put() return codes?
> >
> > Not really.
> >
> > > > Of course, there are existing users that check their return values,
> > > > but I'm not sure how much of a real advantage from doing that is.
> >
> > Well, see above. :-)
> >
> > >  At least some of those users appear to not exactly know what they are
> > > doing.
> >
> > Almost none of them do nonsense.
> 
> s/none/all/ (sorry)

Ha, thanks for the clarification :)

Brian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ