[PATCH v2] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases

Teddy Astie posted 1 patch 2 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/10315bf1a012edf4821f7386b3142e56b6c23e34.1776332054.git.teddy.astie@vates.tech
xen/arch/x86/hvm/hvm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH v2] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases
Posted by Teddy Astie 2 weeks, 1 day ago
When settings HVM_PARAM_IDENT_PT, skip domain pausing when :
- there is no vcpu
- unrestricted guest capability is used

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
v2:
 - rebased patches with staging

 xen/arch/x86/hvm/hvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4a81afce02..61871dbd3e 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4237,11 +4237,13 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
             rc = -EINVAL;
         break;
     case HVM_PARAM_IDENT_PT:
+        v = domain_vcpu(d, 0);
+
         /*
          * Only actually required for VT-x lacking unrestricted_guest
          * capabilities.  Short circuit the pause if possible.
          */
-        if ( paging_mode_shadow(d) || !using_vmx() )
+        if ( paging_mode_shadow(d) || !using_vmx() || !v || vmx_unrestricted_guest(v)  )
         {
             d->arch.hvm.params[index] = value;
             break;
-- 
2.52.0



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH v2] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases
Posted by Jan Beulich 1 week, 2 days ago
On 16.04.2026 11:36, Teddy Astie wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4237,11 +4237,13 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
>              rc = -EINVAL;
>          break;
>      case HVM_PARAM_IDENT_PT:
> +        v = domain_vcpu(d, 0);
> +
>          /*
>           * Only actually required for VT-x lacking unrestricted_guest
>           * capabilities.  Short circuit the pause if possible.
>           */
> -        if ( paging_mode_shadow(d) || !using_vmx() )
> +        if ( paging_mode_shadow(d) || !using_vmx() || !v || vmx_unrestricted_guest(v)  )
>          {
>              d->arch.hvm.params[index] = value;
>              break;

Btw, considering the use in vmx_update_guest_cr(), why not also when
!hvm_paging_enabled(v)?

Jan
Re: [PATCH v2] x86/vmx: Avoid pausing on HVM_PARAM_IDENT_PT in additional cases
Posted by Jan Beulich 1 week, 2 days ago
On 16.04.2026 11:36, Teddy Astie wrote:
> When settings HVM_PARAM_IDENT_PT, skip domain pausing when :
> - there is no vcpu
> - unrestricted guest capability is used
> 
> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
> ---
> v2:
>  - rebased patches with staging

The main open issue, however, is that Andrew didn't indicate yet whether the
concern he raised on v1 was addressed. I can't very well ack the change with
a pending objection (and we still haven't settled on how to deal with
effectively abandoned ones, i.e. when one was responded to but the response
was never acknowledged).

And then surely you could have noticed yourself that ...

> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4237,11 +4237,13 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
>              rc = -EINVAL;
>          break;
>      case HVM_PARAM_IDENT_PT:
> +        v = domain_vcpu(d, 0);
> +
>          /*
>           * Only actually required for VT-x lacking unrestricted_guest
>           * capabilities.  Short circuit the pause if possible.
>           */
> -        if ( paging_mode_shadow(d) || !using_vmx() )
> +        if ( paging_mode_shadow(d) || !using_vmx() || !v || vmx_unrestricted_guest(v)  )

... this line is now too long, and there's a stray blank being added ahead
of the final closing parenthesis.

>          {
>              d->arch.hvm.params[index] = value;

Tangential: We don't need this, do we?

Jan