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

Penny Zheng posted 24 patches 3 weeks, 1 day ago
There is a newer version of this series
[PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when MGMT_HYPERCALLS=y
Posted by Penny Zheng 3 weeks, 1 day ago
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@suse.com>
Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
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
Re: [PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when MGMT_HYPERCALLS=y
Posted by Jan Beulich 2 weeks, 3 days ago
On 21.11.2025 11:57, Penny Zheng wrote:
> 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@suse.com>
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

I'd like to note though that ...

> ---
> v3 -> v4:
> - new commit
> ---
>  xen/arch/x86/hvm/hvm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

... with this diffstat the subject prefix is pretty misleading once again. I may
take the liberty and convert it to x86/hvm: (and then also add parentheses to
domctl_lock()).

Jan
RE: [PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when MGMT_HYPERCALLS=y
Posted by Penny, Zheng 1 week, 6 days ago
[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Wednesday, November 26, 2025 5:21 PM
> To: Penny, Zheng <penny.zheng@amd.com>
> Cc: Huang, Ray <Ray.Huang@amd.com>; grygorii_strashko@epam.com; Andrew
> Cooper <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>;
> xen-devel@lists.xenproject.org
> Subject: Re: [PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when
> MGMT_HYPERCALLS=y
>
> On 21.11.2025 11:57, Penny Zheng wrote:
> > 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@suse.com>
> > Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thx

>
> I'd like to note though that ...
>
> > ---
> > v3 -> v4:
> > - new commit
> > ---
> >  xen/arch/x86/hvm/hvm.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
>
> ... with this diffstat the subject prefix is pretty misleading once again. I may take
> the liberty and convert it to x86/hvm: (and then also add parentheses to
> domctl_lock()).
>

Will fix

> Jan
Re: [PATCH v4 22/24] xen/domctl: domctl_lock synchronization only when MGMT_HYPERCALLS=y
Posted by Jan Beulich 2 weeks, 3 days ago
On 26.11.2025 10:20, Jan Beulich wrote:
> On 21.11.2025 11:57, Penny Zheng wrote:
>> 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@suse.com>
>> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> I'd like to note though that ...
> 
>> ---
>> v3 -> v4:
>> - new commit
>> ---
>>  xen/arch/x86/hvm/hvm.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> ... with this diffstat the subject prefix is pretty misleading once again. I may
> take the liberty and convert it to x86/hvm: (and then also add parentheses to
> domctl_lock()).

Actually, the series looks to be in need of a full re-submission anyway. I.e. I
can't sensibly cherry-pick parts to put in early.

Jan