[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19cdf9362d469ac6de8503aa335b864ab5fc2553.camel@infradead.org>
Date: Tue, 31 Oct 2023 19:45:02 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
"Griffoul, Fred" <fgriffo@...zon.com>
Cc: Paul Durrant <paul@....org>,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] KVM: x86/xen: improve accuracy of Xen timers
On Mon, 2023-10-30 at 15:50 +0000, David Woodhouse wrote:
>
> +static int do_monotonic(s64 *t, u64 *tsc_timestamp)
> +{
> + struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
> + unsigned long seq;
> + int mode;
> + u64 ns;
> +
> + do {
> + seq = read_seqcount_begin(>od->seq);
> + ns = gtod->clock.base_cycles;
> + ns += vgettsc(>od->clock, tsc_timestamp, &mode);
> + ns >>= gtod->clock.shift;
> + ns += ktime_to_ns(ktime_add(gtod->clock.offset,
> gtod->offs_boot));
> + } while (unlikely(read_seqcount_retry(>od->seq, seq)));
> + *t = ns;
> +
> + return mode;
> +}
> +
Hrm, that's basically cargo-culted from do_monotonic_raw() immediately
above it. Should it be adding gtod->offs_boot?
Empirically the answer would appear to be 'no'. When gtod->offs_boot is
non-zero, I see kvm_get_monotonic_and_clockread() returning values
which are precisely that far in advance of what ktime_get() reports.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists