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

[for-4.22][PATCH v2] xen/arm: Fail domain construction if a secondary vCPU cannot be created


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 9 Jul 2026 08:36:43 +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=Zhdxdf5zL6a+U1/hrk4aLT3C9PkcV0JvLE8J6lvzQu4=; b=GWfhkpVl0/G1lfJxS1Vr7ENsKxYDa2ke6tOl97R3yeO6wd1n20zdITnZljJshO3hjVOADTw78r/LmksqkUAnQszrjJryH8IF9hUvTQAAdJmTIiJvkSMBnzJyNO77n/RcvnzA1CpEPtovv1o3n5nhPQ9qeQD+ixkp9YyYUT1pFU8uR2xp+lwikoihREG9ln6Zf6X6PPdtiPIZCxbMvWFFQ1VB0l39ckyKCpnsXpaIraYpyWV+36AYwcQCJWCn+0Ddj3ZiuSS7nJwQWnEfRzdquXKjlMGIdhloBiVhoS/26NY4pdpNIOeX1nHbDzVnJ+J1a+d2O5r9NWlmj6l9QHiJxw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z7opmmPBM6q3apAlse3NxuqMuCHd82Z+qNIWB/nMO3a/43mCpBUdUAFC3k8x3GNATV7nBG9E8rtsBo2KcZriwqCHl4lotZmSdMLtA8Z4Ld5YbeNfM3H7qMZXN23aVOIev0TU3y6ZLtoykzKEsDE3XmVKENlPrEJ0thpm1Tx5eLFFc9bKfea1vfUQzOaD8za8z/MAFWqcawoa+giXQBnbsno0HYKZLY8DT0wpiGew7HezJwfNavS4Cyb1k5xLDx4mCXoGA5gfbXQvxVAOAly/eqO/v8ot6o9Ql3DwGSkwsiJCzivUF9IVsouFgL2nkN/whw+MEVlOhJQjakAPyluPSg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, <ayan.kumar.halder@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Thu, 09 Jul 2026 06:37:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

construct_domain() creates the secondary vCPUs in a loop, but on a
vcpu_create() failure it only prints a message and breaks out of the
loop returning success. As a result the domain can be partially
constructed with fewer vCPUs than d->max_vcpus. This causes two contract
violations:
 - Xen-Guest: domain's FDT is generated before vCPU creation - Xen exposes
   incorrect information (e.g. two vCPUs listed in a device tree while only
   one is actually created),
 - User-Xen: unlike x86, on Arm port we try to bail out as soon as
   possible on unsatisfied user requests (e.g. user requested two vCPUs
   for a domain but it was created with only one).

Return an error instead of breaking out of the loop. Both callers
(construct_domU() and construct_hwdom()) already propagate a negative
return value and fail domain construction.

Fixes: 6b0e8e43348a ("xen/arm: allocate secondaries dom0 vcpus")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
Changes in v2:
 - return ENOMEM as allocation failure is most frequent cause of failure
 - update commit msg to focus on unmet contracts
---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 550617f152bb..72d531618045 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1847,7 +1847,7 @@ int __init construct_domain(struct domain *d, struct 
kernel_info *kinfo)
         if ( vcpu_create(d, i) == NULL )
         {
             printk("Failed to allocate d%dv%d\n", d->domain_id, i);
-            break;
+            return -ENOMEM;
         }
 
         if ( is_64bit_domain(d) )
-- 
2.43.0




 


Rackspace

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