Skip to content

Commit fdba46f

Browse files
committed
x86/apic: Get rid of multi CPU affinity
Setting the interrupt affinity of a single interrupt to multiple CPUs has a dubious value. 1) This only works on machines where the APIC uses logical destination mode. If the APIC uses physical destination mode then it is already restricted to a single CPU 2) Experiments have shown, that the benefit of multi CPU affinity is close to zero and in some test even worse than setting the affinity to a single CPU. The reason for this is that the delivery targets the APIC with the lowest ID first and only if that APIC is busy (servicing an interrupt, i.e. ISR is not empty) it hands it over to the next APIC. In the conducted tests the vast majority of interrupts ends up on the APIC with the lowest ID anyway, so there is no natural spreading of the interrupts possible. Supporting multi CPU affinities adds a lot of complexity to the code, which can turn the allocation search into a worst case of nr_vectors * nr_online_cpus * nr_bits_in_target_mask As a first step disable it by restricting the vector search to a single CPU. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juergen Gross <[email protected]> Tested-by: Yu Chen <[email protected]> Acked-by: Juergen Gross <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Tony Luck <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Alok Kataria <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Rui Zhang <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Dan Williams <[email protected]> Cc: Len Brown <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 7854f82 commit fdba46f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/x86/kernel/apic/vector.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ static int __assign_irq_vector(int irq, struct apic_chip_data *d,
136136
while (cpu < nr_cpu_ids) {
137137
int new_cpu, offset;
138138

139-
/* Get the possible target cpus for @mask/@cpu from the apic */
140-
apic->vector_allocation_domain(cpu, vector_cpumask, mask);
139+
cpumask_copy(vector_cpumask, cpumask_of(cpu));
141140

142141
/*
143142
* Clear the offline cpus from @vector_cpumask for searching
@@ -367,17 +366,11 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq,
367366
irq_data->chip = &lapic_controller;
368367
irq_data->chip_data = data;
369368
irq_data->hwirq = virq + i;
369+
irqd_set_single_target(irq_data);
370370
err = assign_irq_vector_policy(virq + i, node, data, info,
371371
irq_data);
372372
if (err)
373373
goto error;
374-
/*
375-
* If the apic destination mode is physical, then the
376-
* effective affinity is restricted to a single target
377-
* CPU. Mark the interrupt accordingly.
378-
*/
379-
if (!apic->irq_dest_mode)
380-
irqd_set_single_target(irq_data);
381374
}
382375

383376
return 0;
@@ -434,7 +427,7 @@ static void __init init_legacy_irqs(void)
434427
BUG_ON(!data);
435428

436429
data->cfg.vector = ISA_IRQ_VECTOR(i);
437-
cpumask_setall(data->domain);
430+
cpumask_copy(data->domain, cpumask_of(0));
438431
irq_set_chip_data(i, data);
439432
}
440433
}

0 commit comments

Comments
 (0)