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

[PATCH v5 22/24] x86/hvm: domctl_lock synchronization only when MGMT_HYPERCALLS=y


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Fri, 12 Dec 2025 12:02:07 +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=8CDjhjNeGSnpu7WULKozeSHXwJMukMwEQH7YbEo2lUA=; b=aUerMAYA4jPiclG9rauJ8U7CyfHEElt3Qy9OoiyGiOX12Oj2gu5gk/SRxXYkacw2rM03Jm/6Ba7Pk3daL+zvLT6K1wQSPNJhCmmGS5/WXOQMRlh0l6g/PP7usv4F02bBvt0b/fn0rJQn9b9dHoc5Ub4TLmVx54/M+Y2Oy8e3gqWCw2vealf4FKjy5Ez8jTSqU1KhCsfb4edF2ll0566zEB0ODD95h/V6lCkzH5R0uBZyLVV6G1vHXPgLXgDj8n/KqB5vOeNhh2rheTTkM4GRCaU1jUHXvDh2EWBORtlf9VvtLME6tRxP0EbpRRCEFNpSBQcTfokeDIoloHKQ7J9xLA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WUFHwTMtB18A/9HHDSu44CHTGVdTGTHU52FAVUDuVaQAKWhdkXdGC2t//RIrxNjcrpiQDr9oVlaHzHKeALYQ+ufISxtut9Wn6v0mNnlRTERA7U9LAzG7ykWnVFXp+F67h2ANWWhFxc3e1d9v+qNyiyT9Xkh7Jq4XM6RR65V4gnXc+V2GxLT0dAPLEqQ8UW/QTtlTdZChpphzdQI0nSoObPoEfpeE0KjjbRxeNceFOw8f6gEnI5iYqPlgv6Iaa4/pDDMSao2+Hj7NqadEYJLPFG5Cdl6Dd81CnAKcP82fb2KNk1SmRbHrKhNF+blWJbu8jIKDO38a60+oyDmbDw7dPw==
  • 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, 12 Dec 2025 04:17:46 +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>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v3 -> v4:
- new commit
---
v4 -> v5:
- refine title and commit message
---
 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 ce75fb7839..b52dd8f1c4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4272,7 +4272,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;
@@ -4282,7 +4282,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®.