Skip to content

Commit

Permalink
kernel: Don't allow IRQ affinity masks to have more than one CPU
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: celtare21 <[email protected]>
  • Loading branch information
kerneltoast authored and celtare21 committed Dec 16, 2022
1 parent f33472a commit 321dd8d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 321dd8d

Please sign in to comment.