Skip to content

Commit 332afa6

Browse files
Suresh SiddhaIngo Molnar
authored andcommitted
x86/irq: Update irq_cfg domain unless the new affinity is a subset of the current domain
Until now, irq_cfg domain is mostly static. Either all CPU's (used by flat mode) or one CPU (first CPU in the irq afffinity mask) to which irq is being migrated (this is used by the rest of apic modes). Upcoming x2apic cluster mode optimization patch allows the irq to be sent to any CPU in the x2apic cluster (if supported by the HW). So irq_cfg domain changes on the fly (depending on which CPU in the x2apic cluster is online). Instead of checking for any intersection between the new irq affinity mask and the current irq_cfg domain, check if the new irq affinity mask is a subset of the current irq_cfg domain. Otherwise proceed with updating the irq_cfg domain aswell as assigning vector's on all the CPUs specified in the new mask. This also cleans up a workaround in updating irq_cfg domain for legacy irq's that are handled by the IO-APIC. Signed-off-by: Suresh Siddha <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Linus Torvalds <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent f9ba717 commit 332afa6

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

arch/x86/kernel/apic/io_apic.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,7 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
11261126
old_vector = cfg->vector;
11271127
if (old_vector) {
11281128
cpumask_and(tmp_mask, mask, cpu_online_mask);
1129-
cpumask_and(tmp_mask, cfg->domain, tmp_mask);
1130-
if (!cpumask_empty(tmp_mask)) {
1129+
if (cpumask_subset(tmp_mask, cfg->domain)) {
11311130
free_cpumask_var(tmp_mask);
11321131
return 0;
11331132
}
@@ -1141,6 +1140,11 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
11411140

11421141
apic->vector_allocation_domain(cpu, tmp_mask);
11431142

1143+
if (cpumask_subset(tmp_mask, cfg->domain)) {
1144+
free_cpumask_var(tmp_mask);
1145+
return 0;
1146+
}
1147+
11441148
vector = current_vector;
11451149
offset = current_offset;
11461150
next:
@@ -1346,13 +1350,6 @@ static void setup_ioapic_irq(unsigned int irq, struct irq_cfg *cfg,
13461350

13471351
if (!IO_APIC_IRQ(irq))
13481352
return;
1349-
/*
1350-
* For legacy irqs, cfg->domain starts with cpu 0 for legacy
1351-
* controllers like 8259. Now that IO-APIC can handle this irq, update
1352-
* the cfg->domain.
1353-
*/
1354-
if (irq < legacy_pic->nr_legacy_irqs && cpumask_test_cpu(0, cfg->domain))
1355-
apic->vector_allocation_domain(0, cfg->domain);
13561353

13571354
if (assign_irq_vector(irq, cfg, apic->target_cpus()))
13581355
return;

0 commit comments

Comments
 (0)