[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/hvm: Add x2APIC topology
- To: Julian Vetter <julian.vetter@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Mon, 9 Feb 2026 11:58:43 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- 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=r0DGAXHGXIXNsUsKpRHhHiF6pi8tCfQWKCvvhDIEBNo=; b=ouJ3rv029do76cBDqFJMSm5xUai8dIZVAdBfeomvEIXu3QZQOsfreMzFXQynMpy0q7VSnTtJFnCZAqacxuLjoLGPJ0EXhQtKIeqHU/vUiJUsFk1Ym3OeLmTTzEIdRYQokF0SbsLVYI6TK2BnLn5G8wZ4jMtgi448o/SChrrcDGO5s3y01QmKXp5d24pt9O5pGq4SlD+xzq398er4zpBMndbG4W5kbe5yOBZH3HF+c/L/F32RbLxxOHbCvU4wRo3o9OmXMcCIfLBApfWSXQhvgaQH7EhtRS9AvEG4vrRX2D0siVhr+lakhx5e17dhzqYyWo5lTEZi5XT4FCNOCmQYaQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jVYs5eoRAAWVxiCDoSc77mL4lbPBcDEcLdW9npQDKTcGl94vFFZAToDKWFwij8l+2KQ1AMvVD/Iwfxh22s4RAGGVx0aFrjSddlNnq6AGRechPhACgkAjodLKk/Q9z3UAeVTvJ354FoS18lvD3fJKiTnj+kujJtfQDoJ4xN0UMfCg+Nk/oGyV3lu/2jd4tEEUtEPoD69STtqpnjL1PwC+zoIMoEs5LsZNIc+ljqWtSTGNXvBIz9SOtyWlTwSk74Jx8jq0caHok+d0eOnR2MIgfLlO/eN1PyuKsFPPsnzop6xBtnjjZFqXsPU0+ZJSasiz8eJyHRPQSWvXtapzu5yaWA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Mon, 09 Feb 2026 11:58:54 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 09/02/2026 11:37 am, Julian Vetter wrote:
> HVM guests with more than 128 vCPUs require APIC IDs above 255 (since
> APIC ID = vcpu_id * 2), which exceeds the 8-bit xAPIC limit. Currently,
> CPUID leaf 0xB returns EBX=0, making firmware (OVMF/EDK2) fall back to
> CPUID leaf 1 for APIC ID discovery, which is limited to 8 bits and
> cannot distinguish vCPUs with APIC IDs greater than 256.
> To address this, implement proper CPUID leaf 0xB x2APIC topology
> enumeration. Present all vCPUs as cores in a single package with correct
> shift values based on the maximum APIC ID, and non-zero EBX so that
> firmware uses the 32-bit x2APIC ID from EDX. Moreover, set CPUID leaf 1
> EBX[23:16] (max addressable logical processor IDs) to the appropriate
> power-of-2 value, but capped at 255.
>
> Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
This may work for cleanly booted VMs, but it's unsafe and will cause VMs
to crash on migrate.
The toolstack needs to choose the APIC IDs and topology. Alejandro had
a series working on this problem, which needs picking back up.
https://lore.kernel.org/xen-devel/20241021154600.11745-1-alejandro.vallejo@xxxxxxxxx
~Andrew
|