Re: [PATCH v6 0/6] PM QoS: implement the OMAP low level constraints management code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,

On Mon, Jan 16, 2012 at 9:04 PM, Paul Walmsley <paul@xxxxxxxxx> wrote:
> Hi
>
> On Mon, 16 Jan 2012, Jean Pihet wrote:
>
>> Speaking of the locking, currently a spinlock is used and it could be
>> replaced by a more efficient mutex. This is ok at the condition that
>> this code is not called from interrupt context?
>>
>> Kevin,
>> Do you know if the per-device constraint code can be called from
>> interrupt context?
>
> It can't be.  It uses a mutex itself.  So a mutex is what we want.  Take a
> look at drivers/base/power/qos.c:dev_pm_qos_update_request() (included
> below)
Ok thanks for checking, I should have done it before asking ;-|

Jean

>
>
> - Paul
>
>
> /**
>  * dev_pm_qos_update_request - modifies an existing qos request
>  * @req : handle to list element holding a dev_pm_qos request to use
>  * @new_value: defines the qos request
>  *
>  * Updates an existing dev PM qos request along with updating the
>  * target value.
>  *
>  * Attempts are made to make this code callable on hot code paths.
>  *
>  * Returns 1 if the aggregated constraint value has changed,
>  * 0 if the aggregated constraint value has not changed,
>  * -EINVAL in case of wrong parameters, -ENODEV if the device has been
>  * removed from the system
>  */
> int dev_pm_qos_update_request(struct dev_pm_qos_request *req,
>                              s32 new_value)
> {
>        int ret = 0;
>
>        if (!req) /*guard against callers passing in null */
>                return -EINVAL;
>
>        if (WARN(!dev_pm_qos_request_active(req),
>                 "%s() called for unknown object\n", __func__))
>                return -EINVAL;
>
>        mutex_lock(&dev_pm_qos_mtx);
>
>        if (req->dev->power.constraints) {
>                if (new_value != req->node.prio)
>                        ret = apply_constraint(req, PM_QOS_UPDATE_REQ,
>                                               new_value);
>        } else {
>                /* Return if the device has been removed */
>                ret = -ENODEV;
>        }
>
>        mutex_unlock(&dev_pm_qos_mtx);
>        return ret;
> }
>
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm



[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux