Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f4e123c authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian Committed by Gerrit - the friendly Code Review server
Browse files

qos: Pass the list of cpus with affected qos to notifer



Send the list of cpus whose qos has been affected along with the changed
value. Driver listening in for notifier can use this to apply the qos
value for the respective cpus.

Wakeup cpus even if the aggregated qos value does not change
but the cpumask changes.

Change-Id: I8f3c2ea624784c806c55de41cc7c7fcf8ebf02da
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: default avatarMaulik Shah <mkshah@codeaurora.org>
parent be6924f0
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -265,7 +265,8 @@ static const struct file_operations pm_qos_debug_fops = {
	.release        = single_release,
};

static inline void pm_qos_set_value_for_cpus(struct pm_qos_constraints *c)
static inline void pm_qos_set_value_for_cpus(struct pm_qos_constraints *c,
		struct cpumask *cpus)
{
	struct pm_qos_request *req = NULL;
	int cpu;
@@ -288,9 +289,12 @@ static inline void pm_qos_set_value_for_cpus(struct pm_qos_constraints *c)
		}
	}

	for_each_possible_cpu(cpu)
	for_each_possible_cpu(cpu) {
		if (c->target_per_cpu[cpu] != qos_val[cpu])
			cpumask_set_cpu(cpu, cpus);
		c->target_per_cpu[cpu] = qos_val[cpu];
	}
}

/**
 * pm_qos_update_target - manages the constraints list and calls the notifiers
@@ -308,6 +312,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
{
	unsigned long flags;
	int prev_value, curr_value, new_value;
	struct cpumask cpus;
	int ret;

	spin_lock_irqsave(&pm_qos_lock, flags);
@@ -339,18 +344,24 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
	}

	curr_value = pm_qos_get_value(c);
	cpumask_clear(&cpus);
	pm_qos_set_value(c, curr_value);
	pm_qos_set_value_for_cpus(c);
	pm_qos_set_value_for_cpus(c, &cpus);

	spin_unlock_irqrestore(&pm_qos_lock, flags);

	trace_pm_qos_update_target(action, prev_value, curr_value);
	if (prev_value != curr_value) {

	/*
	 * if cpu mask bits are set, call the notifier call chain
	 * to update the new qos restriction for the cores
	 */

	if (!cpumask_empty(&cpus)) {
		ret = 1;
		if (c->notifiers)
			blocking_notifier_call_chain(c->notifiers,
						     (unsigned long)curr_value,
						     NULL);
				     (unsigned long)curr_value, &cpus);
	} else {
		ret = 0;
	}