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

[PATCH] x86: Prefer d->max_vcpus to dom0_max_vcpus()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 16 Jul 2025 16:18:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x+dS+gGFYh+0y0l5HzA5QO+FaghGWW+JGVVzEqQoMVE=; b=hPTlSadmNiu/RjgcgeSgRyUTnlivdPwKn+aPoBn2jl7/SUhXt6qJseIakOTihaeNaWthyInYct8OM3Ae4g0yTTnP4WauSPA7Oa19QXXdF7PYfdhWxfe8htUQG3tW+kOlhytUFH62I4qToctLjCzvg4dA33VFLDej7bTXFZWRkCZGn+/pKTeMG5O71+C8r7x/FOWpKPCAhQ7H97TSPaJT/iJcuoOxpqriF04wB6JKDJ1+oaTCh/5EvRGammOxiOq0jnLCE/cZWNgBP8sVUIIUphOfZGgvdq+B6xUgy2MHGKCxe0Cs+c1TFpwRP50kNXRyx3uEWqIagwjYFQ/nSIpiNw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kKDiZ+WRHQqnuPVhVXelNqnTcaZKQPChi2HDTBQ0XZkD/NGsNlupHNjrxvxPouZFV0q0D3N4+GxnXIabLOXeMx3MoqxWunlGI10QBTykus9FMdtLOX5oSpzIG8eoIAjX+2NTw0ZP8q4yjtCLtNCaUEtaZOqtFJaSjHqATea7yCfwzbnLimG7ljQo1fFbv+oSRDcjVQXcFRFeIIpx3Nbp4/BGFvDFZeFGcJlYMbOJA10o5kuRxfkRiQp0HmObdB7wKGNJE31CqFsl/fBzLWIPJPgSal0aQ8Cscz4hGAFsuHGpt+BZPegD6FEohwBhkXB8zxghImXQHSmGicw3Bgfxtg==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 16 Jul 2025 14:18:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

These days d->max_vcpus is populated on domain_create(), so use that instead and
avoid a function call.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
pipeline: 
https://gitlab.com/xen-project/people/agvallejo/xen/-/pipelines/1930259234
---
 xen/arch/x86/hvm/dom0_build.c | 7 +++----
 xen/arch/x86/io_apic.c        | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index a038e58c11..9964068387 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -890,19 +890,18 @@ static int __init pvh_setup_acpi_madt(struct domain *d, 
paddr_t *addr)
     struct acpi_madt_local_x2apic *x2apic;
     acpi_status status;
     unsigned long size;
-    unsigned int i, max_vcpus;
+    unsigned int i;
     int rc;
 
     /* Count number of interrupt overrides in the MADT. */
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
                           acpi_count_intr_ovr, UINT_MAX);
 
-    max_vcpus = dom0_max_vcpus();
     /* Calculate the size of the crafted MADT. */
     size = sizeof(*madt);
     size += sizeof(*io_apic) * nr_ioapics;
     size += sizeof(*intsrcovr) * acpi_intr_overrides;
-    size += sizeof(*x2apic) * max_vcpus;
+    size += sizeof(*x2apic) * d->max_vcpus;
 
     madt = xzalloc_bytes(size);
     if ( !madt )
@@ -942,7 +941,7 @@ static int __init pvh_setup_acpi_madt(struct domain *d, 
paddr_t *addr)
     }
 
     x2apic = (void *)io_apic;
-    for ( i = 0; i < max_vcpus; i++ )
+    for ( i = 0; i < d->max_vcpus; i++ )
     {
         x2apic->header.type = ACPI_MADT_TYPE_LOCAL_X2APIC;
         x2apic->header.length = sizeof(*x2apic);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 84bd87a5e4..1816e1c0b9 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2758,7 +2758,7 @@ unsigned int __hwdom_init arch_hwdom_irqs(const struct 
domain *d)
     else
     {
         if ( !d->domain_id )
-            n = min(n, dom0_max_vcpus());
+            n = min(n, d->max_vcpus);
         n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs);
     }
 

base-commit: dff462313fe0bfa273c54ffc9bff71f054c365af
-- 
2.43.0




 


Rackspace

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