public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, pl@dlh.net
Subject: Re: [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC
Date: Fri, 24 May 2013 06:01:24 -0400 (EDT)	[thread overview]
Message-ID: <882546901.7038361.1369389684409.JavaMail.root@redhat.com> (raw)
In-Reply-To: <20130523134746.GA14101@amt.cnet>



----- Original Message -----
From: "Marcelo Tosatti" <mtosatti@redhat.com>
To: "Vadim Rozenfeld" <vrozenfe@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com, pl@dlh.net
Sent: Thursday, May 23, 2013 11:47:46 PM
Subject: Re: [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC

On Thu, May 23, 2013 at 08:21:29AM -0400, Vadim Rozenfeld wrote:
> > > @@ -1848,6 +1847,11 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data)
> > >  				HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT);
> > >  		if (kvm_is_error_hva(addr))
> > >  			return 1;
> > > +		tsc_ref.TscSequence =
> > > +				boot_cpu_has(X86_FEATURE_CONSTANT_TSC) ? 1 : 0;
> > 
> > 1) You want NONSTOP_TSC (see 40fb1715 commit) which matches INVARIANT TSC.
> > [VR]
> > Thank you for reviewing. Will fix it.
> > 2) TscSequence should increase? 
> > "This field serves as a sequence number that is incremented whenever..."
> > [VR]
> > Yes, on every VM resume, including migration. After migration we also need
> > to recalculate scale and adjust offset. 
> > 3) 0xFFFFFFFF is the value for invalid source of reference time?
> > [VR] Yes, on boot-up. In this case guest will go with PMTimer (not sure about HPET
> > but I can check). But if we set sequence to 0xFFFFFFFF after migration - it's probably will not work.
> 
> "Reference TSC during Save and Restore and Migration
> 
> To address migration scenarios to physical platforms that do not support
> iTSC, the TscSequence field is used. In the event that a guest partition
> is  migrated from an iTSC capable host to a non-iTSC capable host, the
> hypervisor sets TscSequence to the special value of 0xFFFFFFFF, which
> directs the guest operating system to fall back to a different clock
> source (for example, the virtual PM timer)."
> 
> Why it would not/does not work after migration?
> 
> [VR]
> Because of different frequencies, I think. 
> Hyper-V reference counters and iTSC report
> performance frequency equal to 10MHz,
> which is obviously is not true for PM and HPET timers.

Windows has to convert from the native hardware clock frequency to
internal system frequency, so i don't believe this is a problem.

> Windows calibrates timers on boot-up and you probably 
> have no chance to do it after or during resume.  

It is documented as such, it has been designed to fallback
to other hardware clock devices. Is there evidence for any 
problem on fallback?

Earlier you said:

"> What if you put 0xFFFFFFFF as a sequence? Or is this another case where
> the spec is wrong.
>
it will use PMTimer (maybe HPET if you have it) if you specify it on
VM's start up. But I'm not sure if it will work if you migrate from TSC
or reference counter to 0xFFFFFFFF
"
On startup, not after migration, when you migrate to host w/o iTSC and/or 
reference counters support.



  reply	other threads:[~2013-05-24 10:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19  7:06 [RFC PATCH v2 0/2] Hyper-V timers Vadim Rozenfeld
2013-05-19  7:06 ` [RFC PATCH v2 1/2] add support for Hyper-V reference time counter Vadim Rozenfeld
2013-05-19 13:47   ` Gleb Natapov
2013-05-19 14:37   ` Paolo Bonzini
2013-05-22  0:46   ` Marcelo Tosatti
2013-05-22  3:28     ` Gleb Natapov
2013-05-22  3:32       ` Marcelo Tosatti
2013-05-22  3:38         ` Gleb Natapov
2013-05-22 14:31           ` Marcelo Tosatti
2013-05-22  7:32     ` Vadim Rozenfeld
2013-05-22 21:55       ` Paolo Bonzini
2013-05-23  6:17         ` Peter Lieven
2013-05-23  9:54           ` Paolo Bonzini
2013-05-23 10:45             ` Peter Lieven
2013-05-23 12:25           ` Vadim Rozenfeld
2013-05-23 13:18             ` Paolo Bonzini
2013-05-23 13:20               ` Peter Lieven
2013-05-23 13:23                 ` Paolo Bonzini
2013-05-23 13:30                   ` Peter Lieven
2013-05-23 13:40                     ` Paolo Bonzini
2013-05-19  7:06 ` [RFC PATCH v2 2/2] add support for Hyper-V invariant TSC Vadim Rozenfeld
2013-05-22  0:50   ` Marcelo Tosatti
2013-05-22  7:22     ` Vadim Rozenfeld
2013-05-22 21:23       ` Marcelo Tosatti
2013-05-23  6:18         ` Peter Lieven
2013-05-23  9:13           ` Gleb Natapov
2013-05-23 13:35             ` Marcelo Tosatti
2013-05-23 15:14               ` Gleb Natapov
2013-05-24  9:57               ` Vadim Rozenfeld
2013-05-23 12:33           ` Vadim Rozenfeld
2013-05-23 12:44             ` Peter Lieven
2013-05-23 12:45               ` Gleb Natapov
2013-05-23 12:54               ` Vadim Rozenfeld
2013-05-23  9:12         ` Gleb Natapov
2013-05-23 13:53           ` Marcelo Tosatti
2013-05-23 15:31             ` Gleb Natapov
2013-05-24 10:11               ` Vadim Rozenfeld
2013-05-24 19:41                 ` Marcelo Tosatti
2013-05-27 12:33                   ` Vadim Rozenfeld
2013-05-23 12:21         ` Vadim Rozenfeld
2013-05-23 13:47           ` Marcelo Tosatti
2013-05-24 10:01             ` Vadim Rozenfeld [this message]
2013-05-23 16:44   ` Paolo Bonzini
2013-05-24 10:16     ` Vadim Rozenfeld

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=882546901.7038361.1369389684409.JavaMail.root@redhat.com \
    --to=vrozenfe@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pl@dlh.net \
    /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