qos: Don't disable interrupts while holding pm_qos_lock

None of the pm_qos functions actually run in interrupt context; if some
driver calls pm_qos_update_target in interrupt context then it's already
broken. There's no need to disable interrupts while holding pm_qos_lock,
so don't do it.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2020-05-01 15:58:43 -07:00 committed by Ksawlii
parent 27fe6f89a2
commit 07a5ef1eeb

View file

@ -45,7 +45,7 @@
/*
* locking rule: all changes to constraints or notifiers lists
* or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock
* held, taken with _irqsave. One lock to rule them all
* held. One lock to rule them all
*/
static DEFINE_SPINLOCK(pm_qos_lock);
@ -102,9 +102,8 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
enum pm_qos_req_action action, int value)
{
int prev_value, curr_value, new_value;
unsigned long flags;
spin_lock_irqsave(&pm_qos_lock, flags);
spin_lock(&pm_qos_lock);
prev_value = pm_qos_get_value(c);
if (value == PM_QOS_DEFAULT_VALUE)
@ -135,7 +134,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
curr_value = pm_qos_get_value(c);
pm_qos_set_value(c, curr_value);
spin_unlock_irqrestore(&pm_qos_lock, flags);
spin_unlock(&pm_qos_lock);
trace_pm_qos_update_target(action, prev_value, curr_value);
@ -178,10 +177,9 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
struct pm_qos_flags_request *req,
enum pm_qos_req_action action, s32 val)
{
unsigned long irqflags;
s32 prev_value, curr_value;
spin_lock_irqsave(&pm_qos_lock, irqflags);
spin_lock(&pm_qos_lock);
prev_value = list_empty(&pqf->list) ? 0 : pqf->effective_flags;
@ -205,7 +203,7 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
curr_value = list_empty(&pqf->list) ? 0 : pqf->effective_flags;
spin_unlock_irqrestore(&pm_qos_lock, irqflags);
spin_unlock(&pm_qos_lock);
trace_pm_qos_update_flags(action, prev_value, curr_value);
@ -365,15 +363,14 @@ static ssize_t cpu_latency_qos_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos)
{
struct pm_qos_request *req = filp->private_data;
unsigned long flags;
s32 value;
if (!req || !cpu_latency_qos_request_active(req))
return -EINVAL;
spin_lock_irqsave(&pm_qos_lock, flags);
spin_lock(&pm_qos_lock);
value = pm_qos_get_value(&cpu_latency_constraints);
spin_unlock_irqrestore(&pm_qos_lock, flags);
spin_unlock(&pm_qos_lock);
return simple_read_from_buffer(buf, count, f_pos, &value, sizeof(s32));
}