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

[PATCH v3 5/8] tools/init-dom0less: Use introduced to determine no-enhanced


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 26 Aug 2025 17:08:44 -0400
  • 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=kx6d34oYfnXViK0Sv04HljBO4lYFdDa8TSdzHSfLUho=; b=Cb/LMQ0jEpvfn86xykziFoXXjU2d1AL95lv/uzrgXYo8/cj04bwPAgaFzjK76LEuw8byc6lFYDVvqWwD81QezrVAc74USoc6WNg7Zp9KCSZjyKOo0GAkFIJKvnB3VMCIRCBTQyntvzmbL10sn7S6D/yFPui6nvSHXH4dx1sZgNPQTMKuACkg8lq/v+La5Z07HkIXP8hP6awHaMCGlQ9/5aHqhB2dmx8oXrX3wLmB3sXriqf5oit1JukF/Rzwvxw0NsGMCjsl8mNiAk/zeACjnt9yW3zvdXvy9m+S06LfPm/BlRRjezZuHWDUoGCFVCHaR5dANuxIvktujmzzqtFoPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mtnb+36F+PKJCuv41WOE5CV/4oQCwPSayAGOZ8oI5Yh1OlQudsn0olfTU4QcjxXYS+cNlm58CUJ2b7HM1o9vCGceOb/AlDIQQKYHgerjfqA+dyEztwp56ood7wZq0qUaLvTa8VfuZ7yWWuMoPYp73Yi1Y6huZByLpCurvshBD0g4e8hzxEDXsym/67zoz5gJGHYiKsmhb3fSIPPpWZ0myPMDo0RtsCBEJ5oC1VEXFQX7U9Te+p1udnVmxn52dcdJ+j5vcvrczJgwkRYOfagvAizJeICStMwi1Wx4JDpC1keQqo1++6zRF+eG07ns6x4inO9gwfD5DWwAu+PJKicllQ==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Tue, 26 Aug 2025 21:09:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

A hardware+xenstore domain will not be able to read HVM params, and
init-dom0less reads HVM_PARAM_STORE_EVTCHN to determine whether or not
a domain has xenstore.

xenstored had a similar issue, and it just tries to map a domain's
reserved grant, GNTTAB_RESERVED_XENSTORE, to see if it is accessible.
If successful, xenstored introduces the domain.  Use the existing
introduced state to determine if init-dom0less should try and read the
param.  If already introduced, initialization (and reading the
HVM_PARAM) is skipped.

This allows for running init-dom0less from a xenstored+hardware domain.
It relies on the local socket xenstore connections being considered
privileged.

oxenstored has not been updated, so the exist code remains for backwards
compatibility.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
v3:
New
---
 tools/helpers/init-dom0less.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index eb793c7aab..a4de40aeac 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -309,16 +309,20 @@ static int configure_xenstore(libxl_dominfo *info,
 
 static int init_domain(libxl_dominfo *info)
 {
-    uint64_t xenstore_evtchn, xenstore_pfn = 0;
+    uint64_t xenstore_evtchn = 0, xenstore_pfn = 0;
+    bool introduced;
     libxl_uuid uuid;
     int rc;
 
-    rc = configure_xenstore(info, &xenstore_evtchn, &xenstore_pfn);
-    if (rc)
-        return rc;
+    introduced = xs_is_domain_introduced(xsh, info->domid);
+    if (!introduced) {
+        rc = configure_xenstore(info, &xenstore_evtchn, &xenstore_pfn);
+        if (rc)
+            return rc;
 
-    if (xenstore_evtchn == 0) {
-        return 0;
+        if (xenstore_evtchn == 0) {
+            return 0;
+        }
     }
 
     libxl_uuid_generate(&uuid);
@@ -332,7 +336,7 @@ static int init_domain(libxl_dominfo *info)
     if (rc)
         err(1, "writing to xenstore");
 
-    if (!xs_is_domain_introduced(xsh, info->domid)) {
+    if (!introduced) {
         rc = xs_introduce_domain(xsh, info->domid, xenstore_pfn,
                                  xenstore_evtchn);
         if (!rc)
-- 
2.50.1




 


Rackspace

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