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]
Date:	Mon, 5 Sep 2011 09:44:49 +0200
From:	Jean Pihet <jean.pihet@...oldbits.com>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	Linux PM mailing list <linux-pm@...ts.linux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux-sh list <linux-sh@...r.kernel.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Kevin Hilman <khilman@...com>
Subject: Re: [PATCH 3/5] PM / QoS: Add function dev_pm_qos_read_value()

Hi Rafael,

On Sat, Sep 3, 2011 at 1:55 AM, Rafael J. Wysocki <rjw@...k.pl> wrote:
> On Friday, September 02, 2011, Jean Pihet wrote:
>> On Fri, Sep 2, 2011 at 12:07 AM, Rafael J. Wysocki <rjw@...k.pl> wrote:
...

>> >> >  */
>> >> >  int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
>> >> >                           s32 value)
>> >> > @@ -195,28 +219,35 @@ int dev_pm_qos_add_request(struct device
>> >> >                return -EINVAL;
>> >> >        }
>> >> >
>> >> > -       mutex_lock(&dev_pm_qos_mtx);
>> >> >        req->dev = dev;
>> >> >
>> >> > -       /* Return if the device has been removed */
>> >> > -       if (req->dev->power.constraints_state == DEV_PM_QOS_NO_DEVICE) {
>> >> > -               ret = -ENODEV;
>> >> > -               goto out;
>> >> > -       }
>> >> > +       device_pm_lock();
>> >> > +       mutex_lock(&dev_pm_qos_mtx);
>> >> >
>> >> > -       /*
>> >> > -        * Allocate the constraints data on the first call to add_request,
>> >> > -        * i.e. only if the data is not already allocated and if the device has
>> >> > -        * not been removed
>> >> > -        */
>> >> > -       if (dev->power.constraints_state == DEV_PM_QOS_DEVICE_PRESENT)
>> >> > -               ret = dev_pm_qos_constraints_allocate(dev);
>> >> > +       if (dev->power.constraints) {
>> >> > +               device_pm_unlock();
>> >> > +       } else {
>> >> > +               if (list_empty(&dev->power.entry)) {
>> >> > +                       /* The device has been removed from the system. */
>> >> > +                       device_pm_unlock();
>> >> > +                       goto out;
>> >> 0 is silently returned in case the device has been removed. Is that
>> >> the intention?
>> >
>> > Pretty much it is.  Is that a problem?
>> I think the caller needs to know if the constraint has been applied
>> correctly or not.
>
> However, the removal of the device is a special case.  What would the caller
> be supposed to do when it learned that the device had been removed while it had
> been trying to add a QoS constraing for it?  Not much I guess.
When the device is removed from the system the constraints list id
flushed and the requests are zero'ed using memset.
In that case the caller needs to be aware of that otherwise the next
call to the API will throw an error.

>
> Thanks,
> Rafael
>

Thanks,
Jean
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ