From nobody Mon Nov 25 05:52:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1715345474; cv=none; d=zohomail.com; s=zohoarc; b=ABBirA2/0C/gvJ+2klYa6JWzPqqsLef5VNMurMpbmqDG8WLgU5NVFFSNlnM4H6SwIR1vFBQEzVbIKtfiqCwy9/SDTBL+hYxpQKaqwxJ3aIS+P0Gj1N0hnX3ID3tZq2pH0C1vLNedF8EnorNDeV1HuoX4LechcYNQTCjfubRrH0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715345474; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mdAQL6LWUhcHd+2TKy01L2FyMVtjyGGs4TMnOgqrMqU=; b=K0GRhL+oJfwXPd/F0LBtSEAZsgY2qbgF7lL7HPl7alw++iuTO5aWkrqfr7jRfiqYz8shPPTAKUwNjbaW8AZv4mAh23yvJpN+S/bL9ws5A/Xc4kkTHUC1/fmtqNY1E/dSeUiXefn/ZaTLLlFE47BXU44ZIMNAZDSAwduMW2vizpo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715345474734639.6578195533909; Fri, 10 May 2024 05:51:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.719864.1122716 (Exim 4.92) (envelope-from ) id 1s5Pi4-0001av-Qk; Fri, 10 May 2024 12:50:48 +0000 Received: by outflank-mailman (output) from mailman id 719864.1122716; Fri, 10 May 2024 12:50:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s5Pi4-0001ao-O6; Fri, 10 May 2024 12:50:48 +0000 Received: by outflank-mailman (input) for mailman id 719864; Fri, 10 May 2024 12:50:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s5Pi3-0001ad-SA for xen-devel@lists.xenproject.org; Fri, 10 May 2024 12:50:47 +0000 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [2607:f8b0:4864:20::f31]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id eb6c1511-0ecb-11ef-909d-e314d9c70b13; Fri, 10 May 2024 14:50:46 +0200 (CEST) Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6a073f10e8eso8098416d6.2 for ; Fri, 10 May 2024 05:50:46 -0700 (PDT) Received: from localhost ([213.195.114.223]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6a15f195018sm17144226d6.74.2024.05.10.05.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:50:44 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eb6c1511-0ecb-11ef-909d-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1715345445; x=1715950245; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mdAQL6LWUhcHd+2TKy01L2FyMVtjyGGs4TMnOgqrMqU=; b=IcRehdOAu2vk84PoQP+HmqLn5Yoao4CQBH1GB6Yu49QvM/OKvros10XRrZr9r1HRGO WzIEJO/RQxD7kX4fVm3zjADXznOnGFfFbyUjwgS+7kHAwe8kUDZgWoEg8MWwR0ELrjqt W2NH6nMctJ/KiaABQUEYaSMbRxnVKECNC+XgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715345445; x=1715950245; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mdAQL6LWUhcHd+2TKy01L2FyMVtjyGGs4TMnOgqrMqU=; b=i2FOaTyAG7EQ7t76MCKC5VUycCBDORccWQVTGr+x3nw9iofhv9n/b24E9m3xiDJoLa 0mwePhYHFbafp9CtZn27qELu1s3zL1ZB9RWQqDVxWeEWtSeMc3XEevkAjqQn6+TFWHOl 9SATQwQXCVQW80IWxrWpSN05yesutgcbLTjb18RlWNOAuHoHUKtIpQ92uZ/EIGBqUzFm 0bo48RrYHGWHtziDrEpV/k1IxeJC7PZwzsI8zxLi8b0q9POjFGkYMNlwflOE4PxgmFE8 bmwyvMopuISyIPNILc8prx2OHOTL9j8ajgGHVVNfRc9K58SCEH7o79AC+s0sRJBZZsY1 GxDg== X-Gm-Message-State: AOJu0YxkwZtdq9uZuBoyimmFyQaOU3uo4lJmMkcsjQcVfC1/AqGrdMQk CsDjWBmjI1IyfqDQE/c9gzwOwlT0mMPPHHoplSvYmN6e2SmNhtlGeiZNOR27a+TMkbln0Sk4ni7 q X-Google-Smtp-Source: AGHT+IEYrRMn6RljjSD/DkKmMC+boUrUg/gIAaIUrqGnt1xLnLi86R/xTvCv6GEu4L6bi+EBeV+EuA== X-Received: by 2002:a05:6214:3906:b0:6a0:ab13:e058 with SMTP id 6a1803df08f44-6a168160125mr25512216d6.16.1715345444981; Fri, 10 May 2024 05:50:44 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Anthony PERARD , Juergen Gross , "Oleksii K ." , Arthur Borsboom , Leigh Brown Subject: [PATCH for-4.19] libxl: fix population of the online vCPU bitmap for PVH Date: Fri, 10 May 2024 14:49:13 +0200 Message-ID: <20240510124913.49945-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1715345476290100001 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 vC= PUs is different than maximum vCPUs. Fix by copying the internal libxl bitmap that's populated based on the vCPUs parameter. Reported-by: Arthur Borsboom Link: https://gitlab.com/libvirt/libvirt/-/issues/399 Reported-by: Leigh Brown Fixes: 14c0d328da2b ('libxl/acpi: Build ACPI tables for HVMlite guests') Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Andrew Cooper Tested-by: Leigh Brown --- Note that the setup of hvm_info_table could be shared between PVH and HVM, = as the fields are very limited, see hvm_build_set_params() for the HVM side. However this late in the release it's safer to just adjust the PVH path. Also note the checksum is not provided when hvm_info_table is built for PVH. This is fine so far because such checksum is only consumed by hvmloader and= not libacpi itself. It's a bugfix, so should be considered for 4.19. --- 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 620f3c700c3e..5cf261bd6794 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 =3D dom->guest_domid; xc_domaininfo_t info; struct hvm_info_table *hvminfo; - int i, r, rc; + int r, rc; =20 config->dsdt_anycpu =3D config->dsdt_15cpu =3D dsdt_pvh; config->dsdt_anycpu_len =3D config->dsdt_15cpu_len =3D dsdt_pvh_len; @@ -138,8 +138,8 @@ static int init_acpi_config(libxl__gc *gc, hvminfo->nr_vcpus =3D info.max_vcpu_id + 1; } =20 - for (i =3D 0; i < hvminfo->nr_vcpus; i++) - hvminfo->vcpu_online[i / 8] |=3D 1 << (i & 7); + memcpy(hvminfo->vcpu_online, b_info->avail_vcpus.map, + b_info->avail_vcpus.size); =20 config->hvminfo =3D hvminfo; =20 --=20 2.44.0