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

[xen staging-4.17] libxl: fix population of the online vCPU bitmap for PVH



commit 3020a20cd9de092c71bfac49a6f018a7502df31f
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Tue May 21 12:00:09 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue May 21 12:00:09 2024 +0200

    libxl: fix population of the online vCPU bitmap for PVH
    
    libxl passes some information to libacpi to create the ACPI table for a PVH
    guest, and among that information it's a bitmap of which vCPUs are online
    which can be less than the maximum number of vCPUs assigned to the domain.
    
    While the population of the bitmap is done correctly for HVM based on the
    number of online vCPUs, for PVH the population of the bitmap is done based 
on
    the number of maximum vCPUs allowed.  This leads to all local APIC entries 
in
    the MADT being set as enabled, which contradicts the data in xenstore if 
vCPUs
    is different than maximum vCPUs.
    
    Fix by copying the internal libxl bitmap that's populated based on the vCPUs
    parameter.
    
    Reported-by: Arthur Borsboom <arthurborsboom@xxxxxxxxx>
    Link: https://gitlab.com/libvirt/libvirt/-/issues/399
    Reported-by: Leigh Brown <leigh@xxxxxxxxxxxxx>
    Fixes: 14c0d328da2b ('libxl/acpi: Build ACPI tables for HVMlite guests')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Tested-by: Leigh Brown <leigh@xxxxxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 5cc7347b04b2d0a3133754c7a9b936f614ec656a
    master date: 2024-05-11 00:13:43 +0100
---
 tools/libs/light/libxl_x86_acpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_x86_acpi.c 
b/tools/libs/light/libxl_x86_acpi.c
index 57a6b63790..3b16c1e70f 100644
--- a/tools/libs/light/libxl_x86_acpi.c
+++ b/tools/libs/light/libxl_x86_acpi.c
@@ -89,7 +89,7 @@ static int init_acpi_config(libxl__gc *gc,
     uint32_t domid = dom->guest_domid;
     xc_dominfo_t info;
     struct hvm_info_table *hvminfo;
-    int i, r, rc;
+    int r, rc;
 
     config->dsdt_anycpu = config->dsdt_15cpu = dsdt_pvh;
     config->dsdt_anycpu_len = config->dsdt_15cpu_len = dsdt_pvh_len;
@@ -138,8 +138,8 @@ static int init_acpi_config(libxl__gc *gc,
         hvminfo->nr_vcpus = info.max_vcpu_id + 1;
     }
 
-    for (i = 0; i < hvminfo->nr_vcpus; i++)
-        hvminfo->vcpu_online[i / 8] |= 1 << (i & 7);
+    memcpy(hvminfo->vcpu_online, b_info->avail_vcpus.map,
+           b_info->avail_vcpus.size);
 
     config->hvminfo = hvminfo;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17



 


Rackspace

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