diff mbox series

KVM: xen: ignore the VCPU_SSHOTTMR_future flag

Message ID 20231004171102.2073141-1-paul@xen.org (mailing list archive)
State New, archived
Headers show
Series KVM: xen: ignore the VCPU_SSHOTTMR_future flag | expand

Commit Message

Paul Durrant Oct. 4, 2023, 5:11 p.m. UTC
From: Paul Durrant <pdurrant@amazon.com>

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@amazon.com>
---
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/x86/kvm/xen.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

David Woodhouse Oct. 4, 2023, 5:19 p.m. UTC | #1
On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> 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@amazon.com>

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@amazon.co.uk>

> ---
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> ---
>  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;
Sean Christopherson Oct. 4, 2023, 5:34 p.m. UTC | #2
On Wed, Oct 04, 2023, David Woodhouse wrote:
> On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote:
> nit: I think the commit title should probably be 'KVM: x86:' and then
> mention Xen somewhere in the rest of the line?

I would also be ok if we start doing "KVM: x86/xen:", because it seems like y'all
are sending enough Xen specific changes that differentiating would be useful.
Paul Durrant Oct. 4, 2023, 5:43 p.m. UTC | #3
On 04/10/2023 18:34, Sean Christopherson wrote:
> On Wed, Oct 04, 2023, David Woodhouse wrote:
>> On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote:
>> nit: I think the commit title should probably be 'KVM: x86:' and then
>> mention Xen somewhere in the rest of the line?
> 
> I would also be ok if we start doing "KVM: x86/xen:", because it seems like y'all
> are sending enough Xen specific changes that differentiating would be useful.

Ok, I'll send a v2 with an amended subject line.

   Paul
diff mbox series

Patch

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;