Re: [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag

From: David Woodhouse
Date: Wed Oct 04 2023 - 13:20:04 EST


On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@xxxxxxxxxx>
>
> Upstream Xen now ignores this flag [1], since the only guest kernel ever to
> use it was buggy. By ignoring the flag the guest will always get a callback
> if it sets a negative timeout which upstream Xen has determined not to
> cause problems for any guest setting the flag.
>
> [1] https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=19c6cbd909
>
> Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>

nit: I think the commit title should probably be 'KVM: x86:' and then
mention Xen somewhere in the rest of the line?

Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx>

> ---
> Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
> Cc: Sean Christopherson <seanjc@xxxxxxxxxx>
> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> ---
>  arch/x86/kvm/xen.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 40edf4d1974c..8f1d46df0f3b 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
> @@ -1374,12 +1374,8 @@ static bool kvm_xen_hcall_vcpu_op(struct kvm_vcpu *vcpu, bool longmode, int cmd,
>                         return true;
>                 }
>  
> +               /* A delta <= 0 results in an immediate callback, which is what we want */
>                 delta = oneshot.timeout_abs_ns - get_kvmclock_ns(vcpu->kvm);
> -               if ((oneshot.flags & VCPU_SSHOTTMR_future) && delta < 0) {
> -                       *r = -ETIME;
> -                       return true;
> -               }
> -
>                 kvm_xen_start_timer(vcpu, oneshot.timeout_abs_ns, delta);
>                 *r = 0;
>                 return true;

Attachment: smime.p7s
Description: S/MIME cryptographic signature