Skip to content

Commit c48c8b8

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
genirq: Take the proposed affinity at face value if force==true
Although setting the affinity of an interrupt to a set of CPUs that doesn't have any online CPU is generally frowned apon, there are a few limited cases where such affinity is set from a CPUHP notifier, setting the affinity to a CPU that isn't online yet. The saving grace is that this is always done using the 'force' attribute, which gives a hint that the affinity setting can be outside of the online CPU mask and the callsite set this flag with the knowledge that the underlying interrupt controller knows to handle it. This restores the expected behaviour on Marek's system. Fixes: 33de0aa ("genirq: Always limit the affinity to online CPUs") Reported-by: Marek Szyprowski <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 0de61d7 commit c48c8b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

kernel/irq/manage.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,16 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
266266
prog_mask = mask;
267267
}
268268

269-
/* Make sure we only provide online CPUs to the irqchip */
269+
/*
270+
* Make sure we only provide online CPUs to the irqchip,
271+
* unless we are being asked to force the affinity (in which
272+
* case we do as we are told).
273+
*/
270274
cpumask_and(&tmp_mask, prog_mask, cpu_online_mask);
271-
if (!cpumask_empty(&tmp_mask))
275+
if (!force && !cpumask_empty(&tmp_mask))
272276
ret = chip->irq_set_affinity(data, &tmp_mask, force);
277+
else if (force)
278+
ret = chip->irq_set_affinity(data, mask, force);
273279
else
274280
ret = -EINVAL;
275281

0 commit comments

Comments
 (0)