diff mbox series

[v2,6/6] x86/irq: do not set nr_irqs based on nr_irqs_gsi in APIC mode

Message ID 20220630085439.83193-7-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series x86/irq: switch x2APIC default destination mode | expand

Commit Message

Roger Pau Monné June 30, 2022, 8:54 a.m. UTC
When using an APIC do not set nr_irqs based on a factor of nr_irqs_gsi
(currently x8), and instead do so exclusively based on the amount of
available vectors on the system.

There's no point in setting nr_irqs to a value higher than the
available set of vectors, as vector allocation will fail anyway.

Fixes: e99d45da8a ('x86/x2apic: properly implement cluster mode')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/irq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jan Beulich July 5, 2022, 2:22 p.m. UTC | #1
On 30.06.2022 10:54, Roger Pau Monne wrote:
> When using an APIC do not set nr_irqs based on a factor of nr_irqs_gsi
> (currently x8), and instead do so exclusively based on the amount of
> available vectors on the system.
> 
> There's no point in setting nr_irqs to a value higher than the
> available set of vectors, as vector allocation will fail anyway.

Only if in the earlier calculation you include hotplug CPUs.

> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -426,8 +426,7 @@ int __init init_irq_data(void)
>              (x2apic_enabled && !x2apic_phys) ? x2apic_max_cluster_id + 1
>                                               : num_present_cpus();
>  
> -        nr_irqs = cpu_has_apic ? max(vec_spaces * NR_DYNAMIC_VECTORS,
> -                                     8 * nr_irqs_gsi)
> +        nr_irqs = cpu_has_apic ? vec_spaces * NR_DYNAMIC_VECTORS
>                                 : nr_irqs_gsi;

I wonder how useful it is to retain the !cpu_has_apic case here. I
don't have much hope for Xen to work properly if APIC use was
suppressed, and I'm unaware of x86-64 CPUs without APIC.

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 7f75ec8bcc..e3b0bee527 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -426,8 +426,7 @@  int __init init_irq_data(void)
             (x2apic_enabled && !x2apic_phys) ? x2apic_max_cluster_id + 1
                                              : num_present_cpus();
 
-        nr_irqs = cpu_has_apic ? max(vec_spaces * NR_DYNAMIC_VECTORS,
-                                     8 * nr_irqs_gsi)
+        nr_irqs = cpu_has_apic ? vec_spaces * NR_DYNAMIC_VECTORS
                                : nr_irqs_gsi;
     }
     else if ( nr_irqs < 16 )