mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Ming Lin <minggr@gmail.com>
Cc: Sean Christopherson <seanjc@google.com>,
	kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: pvclock time drifting backward
Date: Thu, 27 Mar 2025 08:10:47 +0000	[thread overview]
Message-ID: <830d2e06c064e24bd143650ce97522c2bc470a90.camel@infradead.org> (raw)
In-Reply-To: <CAF1ivSbVZVSibZq+=VaDrETP_hEurCyyftCCaDEMa5r7HAV67A@mail.gmail.com>

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

On Wed, 2025-03-26 at 08:54 -0700, Ming Lin wrote:
> I applied the patch series on top of 6.9 cleanly and tested it with my
> debug tool patch.
> But it seems the time drift still increased monotonically.
> 
> Would you help take a look if the tool patch makes sense?
> https://github.com/minggr/linux/commit/5284a211b6bdc9f9041b669539558a6a858e88d0
> 
> The tool patch adds a KVM debugfs entry to trigger time calculations
> and print the results.
> See my first email for more detail.

Your first message seemed to say that the problem occurred with live
migration. This message says "the time drift still increased
monotonically". 

Trying to make sure I fully understand... the time drift between the
host's CLOCK_MONOTONIC_RAW and the guest's kvmclock increases
monotonically *but* the guest only observes the change when its
master_kernel_ns/master_cycle_now are updated (e.g. on live migration)
and its kvmclock is reset back to the host's CLOCK_MONOTONIC_RAW?

Is this live migration from one VMM to another on the same host, so we
don't have to worry about the accuracy of the TSC itself? The guest TSC
remains consistent? And presumably your host does *have* a stable TSC,
and the guest's test case really ought to be checking the
PVCLOCK_TSC_STABLE_BIT to make sure of that?

If all the above assumptions/interpretations of mine are true, I still
think it's expected that your clock will jump on live migration
*unless* you also taught your VMM to use the new KVM_[GS]ET_CLOCK_GUEST
ioctls which were added in my patch series, specifically to preserve
the mathematical relationship between guest TSC and kvmclock across a
migration.



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

  reply	other threads:[~2025-03-27  8:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20  5:38 Ming Lin
2025-03-24 22:54 ` Sean Christopherson
2025-03-25 11:07   ` David Woodhouse
2025-03-26 15:54     ` Ming Lin
2025-03-27  8:10       ` David Woodhouse [this message]
2025-03-28 18:30         ` Ming Lin
2025-03-29  8:20           ` David Woodhouse
2026-04-20 17:26             ` 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=830d2e06c064e24bd143650ce97522c2bc470a90.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minggr@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /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®