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

Commit 0778b03a authored by Neil Leeder's avatar Neil Leeder Committed by Stephen Boyd
Browse files

Perf: bring CPU online if needed when disabling irq



When disabling an irq, check that the CPU is online
before trying to run on that CPU. Bring the CPU
online if necessary.

This fixes a problem where a CPU that was not online
when disabling the irq caused the disable and the
free to fail. A subsequent attempt to request the irq
also failed because it had not been freed.

Change-Id: Ib873b5ded83ab843ea4e609f196a31ef0083a213
Signed-off-by: default avatarNeil Leeder <nleeder@codeaurora.org>
parent 41635ccc
Loading
Loading
Loading
Loading
+26 −4
Original line number Diff line number Diff line
@@ -408,12 +408,34 @@ static int multicore_request_irq(int irq, irq_handler_t *handle_irq, void *dev_i
	return err;
}

static void multicore_free_irq(int irq, void *dev_id)
#ifdef CONFIG_SMP
static __ref int armpmu_cpu_up(int cpu)
{
	int ret = 0;

	if (!cpumask_test_cpu(cpu, cpu_online_mask)) {
		ret = cpu_up(cpu);
		if (ret)
			pr_err("Failed to bring up CPU: %d, ret: %d\n",
			       cpu, ret);
	}
	return ret;
}
#else
static inline int armpmu_cpu_up(int cpu)
{
	return 0;
}
#endif

static void __ref multicore_free_irq(int irq, void *dev_id)
{
	int cpu;
	struct irq_desc *desc = irq_to_desc(irq);

	if (irq >= 0) {
		for_each_cpu(cpu, cpu_online_mask) {
		for_each_cpu(cpu, desc->percpu_enabled) {
			if (!armpmu_cpu_up(cpu))
				smp_call_function_single(cpu,
						disable_irq_callback, &irq, 1);
		}
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ static char *descriptions =
	" 0 msm: perf: add debug patch logging framework\n"
	" 1 Perf: port perf-events to 3.10 kernel\n"
	" 2 Perf: keep events across hotplug\n"
	" 3 Perf: bring CPU online if needed when disabling irq\n"
;

static ssize_t desc_read(struct file *fp, char __user *buf,