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

[PATCH] tools/init-dom0less: Fix cpus > 1 and xenstore entries


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 5 Mar 2025 16:58:32 -0500
  • 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=mtN8LAMSLKrzMZRkrMqqXoo6UMhlxLA34QH/NmYxzK4=; b=qL9uM/VoV8PDnZdG9/QdLNtUztR3e34rcS+rEyd9UccZkb85bgFWQiTXuPymSA72luDQb5daBjFB9FFtGmy+4T6ja+9nutsWlsdlk8clmn0qhCWQtHIT5VNy0acuUCvUdyv/gvQCV6nqhcxgaI5VjtUsMddoBP3XIMeOB157UIp//nBXouPSmiKpAzOPLGvUHaSlPn6lx0Tew3D6KrYb1ZGVpIwym4t5TPPYFxPm2gFx1aoqz7t/VXX5KvqNemj6eR1c+uQq+scsk8zLiBh9o3IJtRYPc7V7UuSDbX3gHkq+VbP7ZWqCC5okHfjTSef5iqYZx6JFiwIOfSdCccc9+g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VR94V9YC/EWS5qxLjA1AXa3S3Jo92Mfl3fxLaV4os/xGbN+WdZYN2A8V2L5g/5tTuOwEfOE8+xfkFrc1f/ObPFhCk0KTPWygF8M9Empa2v6DqWmXZG7KkzP9WHa/qyFsExtWy/UEZITHgWpW4+W7pykP5fH20PNpe88xWJioNwhAfEdQBtU0YAv2XhTr8MaynKxO3dwMA7ETlcesmdxyFDR6En80hWW3h0g0WwCeP/Xc/8lrHxtSNucHBVNnZ2eGJdP99vwimGpFzM6153Su4RsV7C/pZKaYkRFZDXXoAJkziD3HTANh9S8m1agNUkrisPhEMAAEfBB/H/rbh8gbmQ==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 05 Mar 2025 21:58:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The trailing / in the path is incorrect and generates an error when
writing to xenstore:
Checking domid: 1
Init dom0less domain: 1
init-dom0less: writing to xenstore: No error information

init-dom0less exits without finishing initialization.

vcpu_max_id is an inclusive value, so it should be included in the
loop's range to include all vcpus.  Without this, no xenstore entries
are created for a 1 vcpu domain.

Finally, use vcpu_online, the count of online vcpus, to determine online
vs. offline.  info->cpupool is a cpupool id and not a bitmask.

Fixes: ec53e0c4ea ("tools: add example application to initialize dom0less PV 
drivers")
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 tools/helpers/init-dom0less.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 17579fe2e8..c569a890a0 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -182,13 +182,13 @@ retry_transaction:
     if (!do_xs_write_dom(xsh, t, domid, "vm", vm_val_str)) goto err;
     if (!do_xs_write_dom(xsh, t, domid, "name", dom_name_str)) goto err;
     if (!do_xs_write_dom(xsh, t, domid, "cpu", "")) goto err;
-    for (i = 0; i < info->vcpu_max_id; i++) {
-        rc = snprintf(cpu_str, STR_MAX_LENGTH, "cpu/%u/availability/", i);
+    for (i = 0; i <= info->vcpu_max_id; i++) {
+        rc = snprintf(cpu_str, STR_MAX_LENGTH, "cpu/%u/availability", i);
         if (rc < 0 || rc >= STR_MAX_LENGTH)
             goto err;
         rc = -EIO;
         if (!do_xs_write_dom(xsh, t, domid, cpu_str,
-                             (info->cpupool & (1 << i)) ? "online" : 
"offline"))
+                             i < info->vcpu_online ? "online" : "offline"))
             goto err;
     }
 
-- 
2.48.1




 


Rackspace

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