Skip to contentSkip to conversation

KVM: xen: ignore the VCPU_SSHOTTMR_future flag

PATCH Superseded Paul Durrant 4 participants 4 messages Oct 4, 2023

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Paul Durrant

author maintainer
#0 lore raw

PATCH 1/1 KVM: xen: ignore the VCPU_SSHOTTMR_future flag

From: Paul Durrant <[email protected]>

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

---
Cc: David Woodhouse <[email protected]>
Cc: Sean Christopherson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]

---
 arch/x86/kvm/xen.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/kvm/xen.c +1 -5
index 40edf4d1974c..8f1d46df0f3b 100644
@@ -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;
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Paul Durrant

From: Paul Durrant <[email protected]>

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

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

Quoted 32 lines

---
Cc: David Woodhouse <[email protected]>
Cc: Sean Christopherson <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
---
 arch/x86/kvm/xen.c | 6 +-----

 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/kvm/xen.c +0 -0
index 40edf4d1974c..8f1d46df0f3b 100644
@@ -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;

#2 lore raw
Quoted 3 lines · David Woodhouse

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.

#3 lore raw
Quoted 7 lines · Sean Christopherson
Quoted 3 lines · David Woodhouse

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