mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Durrant <xadimgnik@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Paul Durrant <xadimgnik@gmail.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] KVM: x86/xen: improve accuracy of Xen timers
Date: Tue, 31 Oct 2023 12:22:08 +0000	[thread overview]
Message-ID: <a2a13598-6d37-47a2-8a13-9963acb0f1e5@xen.org> (raw)
In-Reply-To: <1DCDC3DB-81E8-426C-AF4B-AA7CA2C1271E@infradead.org>

On 31/10/2023 12:11, David Woodhouse wrote:
> 
> 
> On 31 October 2023 12:06:17 GMT, Paul Durrant <xadimgnik@gmail.com> wrote:
>> On 31/10/2023 11:42, David Woodhouse wrote:
>>> Secondly, it's also wrong thing to do in the general case. Let's say KVM does its thing and snaps the kvmclock backwards in time on a KVM_REQ_CLOCK_UPDATE... do we really want to reinterpret existing timers against the new kvmclock? They were best left alone, I think.
>>
>> Do we not want to do exactly that? If the master clock is changed, why would we not want to re-interpret the guest's idea of time? That update will be visible to the guest when it re-reads the PV clock source.
> 
> Well no, because the guest set that timer *before* we yanked the clock from under it, and probably wants it interpreted in the time scale which was in force at the time it was set.
> 
> But more to the point, KVM shouldn't be doing that! We need to *fix* the kvmclock brokenness, not design further band-aids around it.

Ok, fair enough.

> 
> As I said, this patch stands even *after* we fix kvmclock, because it handles the timer delta calculation from an single TSC read.
> 
> But overengineering a timer reset on KVM_REQ_CLOCK_UPDATE would not.

I'm not sure what you intend to do to kvmlock, so not sure whether we'll 
still need the __pvclock_read_cycles(&vcpu->arch.hv_clock, guest_tsc) 
but this patch (with the extra check on validity of hv_clock) does fix 
the drift so...

Reviewed-by: Paul Durrant <paul@xen.org>


  reply	other threads:[~2023-10-31 12:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 15:50 David Woodhouse
2023-10-31 10:42 ` Paul Durrant
2023-10-31 11:42   ` David Woodhouse
2023-10-31 12:06     ` Paul Durrant
2023-10-31 12:11       ` David Woodhouse
2023-10-31 12:22         ` Paul Durrant [this message]
2023-10-31 16:34           ` David Woodhouse
2023-10-31 19:45 ` David Woodhouse
2023-10-31 22:38   ` David Woodhouse
2023-10-31 23:13 ` [PATCH v2] " David Woodhouse
2023-11-07  1:44   ` Dongli Zhang
2023-11-07  8:17     ` David Woodhouse
2023-11-07 23:07       ` Dongli Zhang
2023-11-07 23:24         ` David Woodhouse
2023-11-08  1:43           ` Dongli Zhang
2023-11-08 15:25             ` David Woodhouse
2023-11-08 18:22               ` Dongli Zhang
2023-11-08 19:14                 ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2a13598-6d37-47a2-8a13-9963acb0f1e5@xen.org \
    --to=xadimgnik@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®