From 321dd8d484dc26cbbffa5d4d354efd7f9068705a Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Sat, 25 May 2019 22:48:20 -0700 Subject: [PATCH] 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 Signed-off-by: celtare21 --- kernel/irq/manage.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 147c5de13da7..4537c02f1628 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -228,6 +228,9 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, if (!chip || !chip->irq_set_affinity) return -EINVAL; + /* IRQs only run on the first CPU in the affinity mask; reflect that */ + mask = cpumask_of(cpumask_first(mask)); + /* * If this is a managed interrupt and housekeeping is enabled on * it check whether the requested affinity mask intersects with