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: <871po18wg1.wl-tiwai@suse.de>
Date: Sat, 20 Sep 2025 08:33:34 +0200
From: Takashi Iwai <tiwai@...e.de>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Takashi Iwai <tiwai@...e.de>,
	linux-pm@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] PCI: Use PM runtime class macro for the auto cleanup

On Fri, 19 Sep 2025 20:39:04 +0200,
Rafael J. Wysocki wrote:
> 
> On Fri, Sep 19, 2025 at 6:32 PM Takashi Iwai <tiwai@...e.de> wrote:
> >
> > Use the newly introduced class macro to simplify the code.
> > Also, add the proper error handling for the PM runtime get errors,
> > too.
> >
> > Signed-off-by: Takashi Iwai <tiwai@...e.de>
> > ---
> >  drivers/pci/pci-sysfs.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> > index 5eea14c1f7f5..08e5cf2ba73e 100644
> > --- a/drivers/pci/pci-sysfs.c
> > +++ b/drivers/pci/pci-sysfs.c
> > @@ -1475,8 +1475,9 @@ static ssize_t reset_method_store(struct device *dev,
> >                 return count;
> >         }
> >
> > -       pm_runtime_get_sync(dev);
> > -       struct device *pmdev __free(pm_runtime_put) = dev;
> > +       CLASS(pm_runtime_resume_and_get, pmdev)(dev);
> > +       if (IS_ERR(pmdev))
> > +               return -ENXIO;
> >
> >         if (sysfs_streq(buf, "default")) {
> >                 pci_init_reset_methods(pdev);
> > --
> 
> I've just realized that this patch won't work and the reason why is
> that __pm_runtime_resume() returns an error if runtime PM is disabled
> for a device, so pmdev above will be an error pointer in that case.

Good catch, this was completely forgotten...

> One possible approach may be to make pm_runtime_resume_and_get_dev()
> return 0 and bump up the usage counter for devices with runtime PM
> disabled.

Sounds reasonable.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ