QoS: Modify data structures and function arguments for scalability.
QoS add requests uses a handle to the priority list that is used internally to save the request, but this does not extend well. Also, dev_pm_qos structure definition seems to use a list object directly. The 'derivative' relationship seems to be broken. Use pm_qos_request objects instead of passing around the protected priority list object. Change-Id: Ie4c9c22dd4ea13265fe01f080ba68cf77d9d484d Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org> [mattw@codeaurora.org: resolve context conflicts and extend struct modifications to additional affected users] Signed-off-by: Matt Wagantall <mattw@codeaurora.org> Conflicts: include/linux/pm_qos.h
This commit is contained in:
parent
e46cd379b5
commit
259672e3c7
3 changed files with 20 additions and 17 deletions
|
@ -147,7 +147,7 @@ static int apply_constraint(struct dev_pm_qos_request *req,
|
||||||
switch(req->type) {
|
switch(req->type) {
|
||||||
case DEV_PM_QOS_RESUME_LATENCY:
|
case DEV_PM_QOS_RESUME_LATENCY:
|
||||||
ret = pm_qos_update_target(&qos->resume_latency,
|
ret = pm_qos_update_target(&qos->resume_latency,
|
||||||
&req->data.pnode, action, value);
|
&req->data.lat, action, value);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
value = pm_qos_read_value(&qos->resume_latency);
|
value = pm_qos_read_value(&qos->resume_latency);
|
||||||
blocking_notifier_call_chain(&dev_pm_notifiers,
|
blocking_notifier_call_chain(&dev_pm_notifiers,
|
||||||
|
@ -157,7 +157,7 @@ static int apply_constraint(struct dev_pm_qos_request *req,
|
||||||
break;
|
break;
|
||||||
case DEV_PM_QOS_LATENCY_TOLERANCE:
|
case DEV_PM_QOS_LATENCY_TOLERANCE:
|
||||||
ret = pm_qos_update_target(&qos->latency_tolerance,
|
ret = pm_qos_update_target(&qos->latency_tolerance,
|
||||||
&req->data.pnode, action, value);
|
&req->data.lat, action, value);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
value = pm_qos_read_value(&qos->latency_tolerance);
|
value = pm_qos_read_value(&qos->latency_tolerance);
|
||||||
req->dev->power.set_latency_tolerance(req->dev, value);
|
req->dev->power.set_latency_tolerance(req->dev, value);
|
||||||
|
@ -258,7 +258,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
|
||||||
|
|
||||||
/* Flush the constraints lists for the device. */
|
/* Flush the constraints lists for the device. */
|
||||||
c = &qos->resume_latency;
|
c = &qos->resume_latency;
|
||||||
plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
|
plist_for_each_entry_safe(req, tmp, &c->list, data.lat.node) {
|
||||||
/*
|
/*
|
||||||
* Update constraints list and call the notification
|
* Update constraints list and call the notification
|
||||||
* callbacks if needed
|
* callbacks if needed
|
||||||
|
@ -267,7 +267,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
|
||||||
memset(req, 0, sizeof(*req));
|
memset(req, 0, sizeof(*req));
|
||||||
}
|
}
|
||||||
c = &qos->latency_tolerance;
|
c = &qos->latency_tolerance;
|
||||||
plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
|
plist_for_each_entry_safe(req, tmp, &c->list, data.lat.node) {
|
||||||
apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
|
apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
|
||||||
memset(req, 0, sizeof(*req));
|
memset(req, 0, sizeof(*req));
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req,
|
||||||
switch(req->type) {
|
switch(req->type) {
|
||||||
case DEV_PM_QOS_RESUME_LATENCY:
|
case DEV_PM_QOS_RESUME_LATENCY:
|
||||||
case DEV_PM_QOS_LATENCY_TOLERANCE:
|
case DEV_PM_QOS_LATENCY_TOLERANCE:
|
||||||
curr_value = req->data.pnode.prio;
|
curr_value = req->data.lat.node.prio;
|
||||||
break;
|
break;
|
||||||
case DEV_PM_QOS_FLAGS:
|
case DEV_PM_QOS_FLAGS:
|
||||||
curr_value = req->data.flr.flags;
|
curr_value = req->data.flr.flags;
|
||||||
|
@ -835,7 +835,7 @@ s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev)
|
||||||
ret = IS_ERR_OR_NULL(dev->power.qos)
|
ret = IS_ERR_OR_NULL(dev->power.qos)
|
||||||
|| !dev->power.qos->latency_tolerance_req ?
|
|| !dev->power.qos->latency_tolerance_req ?
|
||||||
PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT :
|
PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT :
|
||||||
dev->power.qos->latency_tolerance_req->data.pnode.prio;
|
dev->power.qos->latency_tolerance_req->data.lat.node.prio;
|
||||||
mutex_unlock(&dev_pm_qos_mtx);
|
mutex_unlock(&dev_pm_qos_mtx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ enum dev_pm_qos_req_type {
|
||||||
struct dev_pm_qos_request {
|
struct dev_pm_qos_request {
|
||||||
enum dev_pm_qos_req_type type;
|
enum dev_pm_qos_req_type type;
|
||||||
union {
|
union {
|
||||||
struct plist_node pnode;
|
struct pm_qos_request lat;
|
||||||
struct pm_qos_flags_request flr;
|
struct pm_qos_flags_request flr;
|
||||||
} data;
|
} data;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -115,8 +115,9 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
|
||||||
return req->dev != NULL;
|
return req->dev != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
|
int pm_qos_update_target(struct pm_qos_constraints *c,
|
||||||
enum pm_qos_req_action action, int value);
|
struct pm_qos_request *req,
|
||||||
|
enum pm_qos_req_action action, int value);
|
||||||
bool pm_qos_update_flags(struct pm_qos_flags *pqf,
|
bool pm_qos_update_flags(struct pm_qos_flags *pqf,
|
||||||
struct pm_qos_flags_request *req,
|
struct pm_qos_flags_request *req,
|
||||||
enum pm_qos_req_action action, s32 val);
|
enum pm_qos_req_action action, s32 val);
|
||||||
|
@ -166,7 +167,7 @@ void dev_pm_qos_hide_latency_tolerance(struct device *dev);
|
||||||
|
|
||||||
static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
|
static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
|
||||||
{
|
{
|
||||||
return dev->power.qos->resume_latency_req->data.pnode.prio;
|
return dev->power.qos->resume_latency_req->data.lat.node.prio;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline s32 dev_pm_qos_requested_flags(struct device *dev)
|
static inline s32 dev_pm_qos_requested_flags(struct device *dev)
|
||||||
|
|
|
@ -263,18 +263,20 @@ static const struct file_operations pm_qos_debug_fops = {
|
||||||
* pm_qos_update_target - manages the constraints list and calls the notifiers
|
* pm_qos_update_target - manages the constraints list and calls the notifiers
|
||||||
* if needed
|
* if needed
|
||||||
* @c: constraints data struct
|
* @c: constraints data struct
|
||||||
* @node: request to add to the list, to update or to remove
|
* @req: request to add to the list, to update or to remove
|
||||||
* @action: action to take on the constraints list
|
* @action: action to take on the constraints list
|
||||||
* @value: value of the request to add or update
|
* @value: value of the request to add or update
|
||||||
*
|
*
|
||||||
* This function returns 1 if the aggregated constraint value has changed, 0
|
* This function returns 1 if the aggregated constraint value has changed, 0
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
|
int pm_qos_update_target(struct pm_qos_constraints *c,
|
||||||
enum pm_qos_req_action action, int value)
|
struct pm_qos_request *req,
|
||||||
|
enum pm_qos_req_action action, int value)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int prev_value, curr_value, new_value;
|
int prev_value, curr_value, new_value;
|
||||||
|
struct plist_node *node = &req->node;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
spin_lock_irqsave(&pm_qos_lock, flags);
|
spin_lock_irqsave(&pm_qos_lock, flags);
|
||||||
|
@ -412,7 +414,7 @@ static void __pm_qos_update_request(struct pm_qos_request *req,
|
||||||
if (new_value != req->node.prio)
|
if (new_value != req->node.prio)
|
||||||
pm_qos_update_target(
|
pm_qos_update_target(
|
||||||
pm_qos_array[req->pm_qos_class]->constraints,
|
pm_qos_array[req->pm_qos_class]->constraints,
|
||||||
&req->node, PM_QOS_UPDATE_REQ, new_value);
|
req, PM_QOS_UPDATE_REQ, new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -457,7 +459,7 @@ void pm_qos_add_request(struct pm_qos_request *req,
|
||||||
INIT_DELAYED_WORK(&req->work, pm_qos_work_fn);
|
INIT_DELAYED_WORK(&req->work, pm_qos_work_fn);
|
||||||
trace_pm_qos_add_request(pm_qos_class, value);
|
trace_pm_qos_add_request(pm_qos_class, value);
|
||||||
pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints,
|
pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints,
|
||||||
&req->node, PM_QOS_ADD_REQ, value);
|
req, PM_QOS_ADD_REQ, value);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pm_qos_add_request);
|
EXPORT_SYMBOL_GPL(pm_qos_add_request);
|
||||||
|
|
||||||
|
@ -511,7 +513,7 @@ void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value,
|
||||||
if (new_value != req->node.prio)
|
if (new_value != req->node.prio)
|
||||||
pm_qos_update_target(
|
pm_qos_update_target(
|
||||||
pm_qos_array[req->pm_qos_class]->constraints,
|
pm_qos_array[req->pm_qos_class]->constraints,
|
||||||
&req->node, PM_QOS_UPDATE_REQ, new_value);
|
req, PM_QOS_UPDATE_REQ, new_value);
|
||||||
|
|
||||||
schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us));
|
schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us));
|
||||||
}
|
}
|
||||||
|
@ -539,7 +541,7 @@ void pm_qos_remove_request(struct pm_qos_request *req)
|
||||||
|
|
||||||
trace_pm_qos_remove_request(req->pm_qos_class, PM_QOS_DEFAULT_VALUE);
|
trace_pm_qos_remove_request(req->pm_qos_class, PM_QOS_DEFAULT_VALUE);
|
||||||
pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints,
|
pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints,
|
||||||
&req->node, PM_QOS_REMOVE_REQ,
|
req, PM_QOS_REMOVE_REQ,
|
||||||
PM_QOS_DEFAULT_VALUE);
|
PM_QOS_DEFAULT_VALUE);
|
||||||
memset(req, 0, sizeof(*req));
|
memset(req, 0, sizeof(*req));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue