kernel: Don't allow IRQ affinity masks to have more than one CPU

Even with an affinity mask that has multiple CPUs set, IRQs always run
on the first CPU in their affinity mask. Drivers that register an IRQ
affinity notifier (such as pm_qos) will therefore have an incorrect
assumption of where an IRQ is affined.

Fix the IRQ affinity mask deception by forcing it to only contain one
set CPU.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2019-05-25 22:48:20 -07:00 committed by Ksawlii
parent 5d83710a9b
commit ae0839f165

View file

@ -267,6 +267,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
else
prog_mask = &tmp_mask;
} else {
/* IRQs only run on the first CPU in the affinity mask */
mask = cpumask_of(cpumask_first(mask));
prog_mask = mask;
}