From 447af8c70bc86873ea9161224ef3c71553406a06 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. Change-Id: I12d28a061b6dc0dca0d04f703fbd77a6f0024d3d Signed-off-by: Sultan Alsawaf Signed-off-by: SamarV-121 --- kernel/irq/manage.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 9e9acb05b..2a26f0273 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -214,6 +214,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, struct irq_chip *chip = irq_data_get_irq_chip(data); int ret; + /* IRQs only run on the first CPU in the affinity mask; reflect that */ + mask = cpumask_of(cpumask_first(mask)); ret = chip->irq_set_affinity(data, mask, force); switch (ret) { case IRQ_SET_MASK_OK: