kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH v2 2/4] KVM: x86: hyper-v: Prevent using not-yet-updated TSC page by secondary CPUs
Date: Thu, 18 Mar 2021 15:04:46 -0300	[thread overview]
Message-ID: <20210318180446.GA41953@fuller.cnet> (raw)
In-Reply-To: <20210318170208.GB36190@fuller.cnet>

On Thu, Mar 18, 2021 at 02:02:08PM -0300, Marcelo Tosatti wrote:
> On Tue, Mar 16, 2021 at 03:37:34PM +0100, Vitaly Kuznetsov wrote:
> > When KVM_REQ_MASTERCLOCK_UPDATE request is issued (e.g. after migration)
> > we need to make sure no vCPU sees stale values in PV clock structures and
> > thus all vCPUs are kicked with KVM_REQ_CLOCK_UPDATE. Hyper-V TSC page
> > clocksource is global and kvm_guest_time_update() only updates in on vCPU0
> > but this is not entirely correct: nothing blocks some other vCPU from
> > entering the guest before we finish the update on CPU0 and it can read
> > stale values from the page.
> > 
> > Invalidate TSC page in kvm_gen_update_masterclock() to switch all vCPUs
> > to using MSR based clocksource (HV_X64_MSR_TIME_REF_COUNT).
> 
> Hi Vitaly,
> 
> Not clear why this is necessary, if the choice was to not touch TSC page
> at all, when invariant TSC is supported on the host...
	
	s/invariant TSC/TSC scaling/

> Ah, OK, this is not for the migration with iTSC on destination case,
> but any call to kvm_gen_update_masterclock, correct?


  reply	other threads:[~2021-03-18 18:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 14:37 [PATCH v2 0/4] KVM: x86: hyper-v: TSC page fixes Vitaly Kuznetsov
2021-03-16 14:37 ` [PATCH v2 1/4] KVM: x86: hyper-v: Limit guest to writing zero to HV_X64_MSR_TSC_EMULATION_STATUS Vitaly Kuznetsov
2021-03-16 14:37 ` [PATCH v2 2/4] KVM: x86: hyper-v: Prevent using not-yet-updated TSC page by secondary CPUs Vitaly Kuznetsov
2021-03-18 17:02   ` Marcelo Tosatti
2021-03-18 18:04     ` Marcelo Tosatti [this message]
2021-03-18 18:05       ` Paolo Bonzini
2021-03-18 18:30         ` Marcelo Tosatti
2021-03-19  9:29           ` Vitaly Kuznetsov
2021-03-16 14:37 ` [PATCH v2 3/4] KVM: x86: hyper-v: Track Hyper-V TSC page status Vitaly Kuznetsov
2021-03-17  8:07   ` Paolo Bonzini
2021-03-17 11:19     ` [PATCH v2 5/4] KVM: x86: hyper-v: Briefly document enum hv_tsc_page_status Vitaly Kuznetsov
2021-03-16 14:37 ` [PATCH v2 4/4] KVM: x86: hyper-v: Don't touch TSC page values when guest opted for re-enlightenment Vitaly Kuznetsov
2021-03-18 14:09 ` [PATCH v2 6/4] selftests: kvm: Add basic Hyper-V clocksources tests Vitaly Kuznetsov
2021-03-18 14:26   ` Paolo Bonzini
2021-03-18 14:52     ` Vitaly Kuznetsov
2021-03-18 15:01       ` Paolo Bonzini
2021-03-18 15:23         ` Vitaly Kuznetsov
2021-03-18 15:27   ` Paolo Bonzini
2021-03-18 16:57   ` Marcelo Tosatti
2021-03-18 17:50     ` Paolo Bonzini
2021-03-18 17:55       ` Marcelo Tosatti
2021-03-19  9:35         ` Vitaly Kuznetsov

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=20210318180446.GA41953@fuller.cnet \
    --to=mtosatti@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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;
as well as URLs for NNTP newsgroup(s).