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

[PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when MGMT_HYPERCALLS=y


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Fri, 21 Nov 2025 18:57:59 +0800
  • 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=fD9kW6Mt2h6oTqu5hKCaJHPDlQEFB90rWIR9p7g5wLU=; b=BnFl7d34GzvCEU2K/Sznq1ynbAKS881m2VEe26xn4eDeJhT7oseN3gFDDvUAfK9uIZU2oeGWVSsvIq5adhGy2R2i437lyLv4d3nTVckJst6LT5qTYr0SihxlNLIGxaLa1guTnCa8PE3ZmKHzgxDRwhqSlyRyHaIJuEs3eR07iW5E3mjOj+7A3HUQfm68T6kNZC0AQvEFxeu+Oq4nwExSOHeimbfnz5+TGkZ1QfFvMSt/PrxGTM7g3KqC8/zHt5rCxs3p/asM5wNKpUxVcWmDDow6VS3kUMAfeH7KTW684Cy6xTGwG6EESRKu7hR5UCYoTZuSFmpRLGzlQQxNT7ZQ1w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X/Dc5AUUoxY1rqC0Dv4KynBxYJutBlyR9I0r+lu3JJymWtr7k/c29c3IShSDccw2zyT/YLX73MfT2v3Ko4FBP1KEHEdMQrSG7OxvITzKNf8rq4ogNCv+lwRx5pvirUXweRy99shzjQH4HlVzT2h40QyHGbNuMsvmBLzGo2dzwvqvtetjPbpLhjJWux0vTdw48vNFU99NFcjxz3YJTVHIcLee+WvA+va6vkI+Py+zmpk+dJCLQZTk42gFmdVIFskDgTY+G7QCK4crvMvF9b+sYgPQb5WQ7mmWtHSSUDTnDRfYHIwYFrPYKHqcc+wErHu+jX69VvJVVG4ldYjR+t2cRA==
  • Cc: <ray.huang@xxxxxxx>, <grygorii_strashko@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 21 Nov 2025 11:01:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Helper domctl_lock_{acquire,release} is domctl_lock, which HVM_PARAM_IDENT_PT
uses to ensure synchronization on potential domctl-op altering guest state.
So it is only needed when MGMT_HYPERCALLS=y.

Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
v3 -> v4:
- new commit
---
 xen/arch/x86/hvm/hvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b03f7dfcf6..8afd0d9d7d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4268,7 +4268,7 @@ static int hvm_set_param(struct domain *d, uint32_t 
index, uint64_t value)
          * the domctl_lock.
          */
         rc = -ERESTART;
-        if ( !domctl_lock_acquire() )
+        if ( IS_ENABLED(CONFIG_MGMT_HYPERCALLS) && !domctl_lock_acquire() )
             break;
 
         rc = 0;
@@ -4278,7 +4278,8 @@ static int hvm_set_param(struct domain *d, uint32_t 
index, uint64_t value)
             paging_update_cr3(v, false);
         domain_unpause(d);
 
-        domctl_lock_release();
+        if ( IS_ENABLED(CONFIG_MGMT_HYPERCALLS) )
+            domctl_lock_release();
         break;
     case HVM_PARAM_DM_DOMAIN:
         /* The only value this should ever be set to is DOMID_SELF */
-- 
2.34.1




 


Rackspace

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