[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] amend 'cmdline: document and enforce "extra_guest_irqs" upper bounds'



commit 1f56accba33ffea0abf7d1c6384710823d10cbd6
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jul 3 14:03:27 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 3 14:03:27 2024 +0200

    amend 'cmdline: document and enforce "extra_guest_irqs" upper bounds'
    
    Address late review comments for what is now commit 17f6d398f765:
    - bound max_irqs right away against nr_irqs
    - introduce a #define for a constant used twice
    
    Requested-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/arch/x86/io_apic.c | 7 ++++---
 xen/common/domain.c    | 6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index adcc9b2ff3..d2b29143d1 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2663,15 +2663,16 @@ void __init ioapic_init(void)
 unsigned int __hwdom_init arch_hwdom_irqs(const struct domain *d)
 {
     unsigned int n = fls(num_present_cpus());
-    /* Bounded by the domain pirq EOI bitmap gfn. */
-    const unsigned int max_irqs = PAGE_SIZE * BITS_PER_BYTE;
+    /* Bounding by the domain pirq EOI bitmap capacity. */
+    const unsigned int max_irqs = min_t(unsigned int, nr_irqs,
+                                        PAGE_SIZE * BITS_PER_BYTE);
 
     if ( is_system_domain(d) )
         return max_irqs;
 
     if ( !d->domain_id )
         n = min(n, dom0_max_vcpus());
-    n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, min(nr_irqs, max_irqs));
+    n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs);
 
     printk("%pd has maximum %u PIRQs\n", d, n);
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 23a73d953c..fb262dcec9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -353,7 +353,8 @@ static int late_hwdom_init(struct domain *d)
 #ifdef CONFIG_HAS_PIRQ
 
 static unsigned int __read_mostly extra_hwdom_irqs;
-static unsigned int __read_mostly extra_domU_irqs = 32;
+#define DEFAULT_EXTRA_DOMU_IRQS 32U
+static unsigned int __read_mostly extra_domU_irqs = DEFAULT_EXTRA_DOMU_IRQS;
 
 static int __init cf_check parse_extra_guest_irqs(const char *s)
 {
@@ -839,7 +840,8 @@ void __init setup_system_domains(void)
             extra_hwdom_irqs = n - nr_static_irqs;
             printk(XENLOG_WARNING "hwdom IRQs bounded to %u\n", n);
         }
-        if ( extra_domU_irqs > max(32U, n - nr_static_irqs) )
+        if ( extra_domU_irqs >
+             max(DEFAULT_EXTRA_DOMU_IRQS, n - nr_static_irqs) )
         {
             extra_domU_irqs = n - nr_static_irqs;
             printk(XENLOG_WARNING "domU IRQs bounded to %u\n", n);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.