All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag
@ 2023-10-04 17:11 Paul Durrant
  2023-10-04 17:19 ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Durrant @ 2023-10-04 17:11 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: Paul Durrant, David Woodhouse, Sean Christopherson, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, x86

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(-)

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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag
  2023-10-04 17:11 [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag Paul Durrant
@ 2023-10-04 17:19 ` David Woodhouse
  2023-10-04 17:34   ` Sean Christopherson
  0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2023-10-04 17:19 UTC (permalink / raw)
  To: Paul Durrant, kvm, linux-kernel
  Cc: Paul Durrant, Sean Christopherson, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin, x86

[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]

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;


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag
  2023-10-04 17:19 ` David Woodhouse
@ 2023-10-04 17:34   ` Sean Christopherson
  2023-10-04 17:43     ` Paul Durrant
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2023-10-04 17:34 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Paul Durrant, kvm, linux-kernel, Paul Durrant, Paolo Bonzini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, x86

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag
  2023-10-04 17:34   ` Sean Christopherson
@ 2023-10-04 17:43     ` Paul Durrant
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Durrant @ 2023-10-04 17:43 UTC (permalink / raw)
  To: Sean Christopherson, David Woodhouse
  Cc: kvm, linux-kernel, Paul Durrant, Paolo Bonzini, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin, x86

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-04 17:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 17:11 [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag Paul Durrant
2023-10-04 17:19 ` David Woodhouse
2023-10-04 17:34   ` Sean Christopherson
2023-10-04 17:43     ` Paul Durrant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.