All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	libvir-list@redhat.com
Subject: Re: [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration
Date: Tue, 29 Sep 2015 15:02:07 -0300	[thread overview]
Message-ID: <20150929180207.GK4130@thinpad.lan.raisama.net> (raw)
In-Reply-To: <20150929034334.GI3583@hzzhang-OptiPlex-9020.sh.intel.com>

On Tue, Sep 29, 2015 at 11:43:34AM +0800, Haozhong Zhang wrote:
> On Mon, Sep 28, 2015 at 01:37:34PM -0300, Eduardo Habkost wrote:
> > On Mon, Sep 28, 2015 at 01:38:31PM +0800, Haozhong Zhang wrote:
[...]
> > >  static void do_kvm_cpu_synchronize_post_init(void *arg)
> > >  {
> > >      CPUState *cpu = arg;
> > > +    CPUX86State *env = &X86_CPU(cpu)->env;
> > > +    int r;
> > > +
> > > +    /*
> > > +     * XXX: KVM_SET_TSC_KHZ must be done before kvm_arch_put_registers().
> > 
> > Could you explain where this requirement comes from?
> >
> 
> kvm_arch_put_registers() below will setup vcpu's MSR_IA32_TSC through
> KVM ioctl KVM_SET_MSRS. KVM needs to know vcpu's TSC rate so as to
> correctly scale the TSC value given by QEMU, especially when vcpu's
> TSC rate is different than the host TSC rate (e.g. it's migrated from
> another machine w/ different host TSC rate than the current one).

Thanks. The comment above could contain a short version of this
explanation, e.g.: "KVM needs KVM_SET_TSC_KHZ to be done before
KVM_SET_MSRS sets MSR_IA32_TSC (done by kvm_arch_put_registers())".

> 
[...]
> > Or maybe we shouldn't treat this as VM state, but as configuration, and
> > let management configure the TSC frequency explicitly if the user really
> > needs it to stay the same during migration.
> >
> > (CCing libvir-list to see if they have feedback)
> >
> 
> Thanks for CC. I'll consider to add a command line option to control
> the configuration of guest TSC fequency.

It already exists, -cpu has a "tsc-freq" option.

-- 
Eduardo

WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	libvir-list@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration
Date: Tue, 29 Sep 2015 15:02:07 -0300	[thread overview]
Message-ID: <20150929180207.GK4130@thinpad.lan.raisama.net> (raw)
In-Reply-To: <20150929034334.GI3583@hzzhang-OptiPlex-9020.sh.intel.com>

On Tue, Sep 29, 2015 at 11:43:34AM +0800, Haozhong Zhang wrote:
> On Mon, Sep 28, 2015 at 01:37:34PM -0300, Eduardo Habkost wrote:
> > On Mon, Sep 28, 2015 at 01:38:31PM +0800, Haozhong Zhang wrote:
[...]
> > >  static void do_kvm_cpu_synchronize_post_init(void *arg)
> > >  {
> > >      CPUState *cpu = arg;
> > > +    CPUX86State *env = &X86_CPU(cpu)->env;
> > > +    int r;
> > > +
> > > +    /*
> > > +     * XXX: KVM_SET_TSC_KHZ must be done before kvm_arch_put_registers().
> > 
> > Could you explain where this requirement comes from?
> >
> 
> kvm_arch_put_registers() below will setup vcpu's MSR_IA32_TSC through
> KVM ioctl KVM_SET_MSRS. KVM needs to know vcpu's TSC rate so as to
> correctly scale the TSC value given by QEMU, especially when vcpu's
> TSC rate is different than the host TSC rate (e.g. it's migrated from
> another machine w/ different host TSC rate than the current one).

Thanks. The comment above could contain a short version of this
explanation, e.g.: "KVM needs KVM_SET_TSC_KHZ to be done before
KVM_SET_MSRS sets MSR_IA32_TSC (done by kvm_arch_put_registers())".

> 
[...]
> > Or maybe we shouldn't treat this as VM state, but as configuration, and
> > let management configure the TSC frequency explicitly if the user really
> > needs it to stay the same during migration.
> >
> > (CCing libvir-list to see if they have feedback)
> >
> 
> Thanks for CC. I'll consider to add a command line option to control
> the configuration of guest TSC fequency.

It already exists, -cpu has a "tsc-freq" option.

-- 
Eduardo

  reply	other threads:[~2015-09-29 18:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28  5:38 [PATCH 0/3] target-i386: save/restore vcpu's TSC rate during migration Haozhong Zhang
2015-09-28  5:38 ` [Qemu-devel] " Haozhong Zhang
2015-09-28  5:38 ` [PATCH 1/3] target-i386: add a subsection of vcpu's TSC rate in vmstate_x86_cpu Haozhong Zhang
2015-09-28  5:38   ` [Qemu-devel] " Haozhong Zhang
2015-09-29 19:00   ` Dr. David Alan Gilbert
2015-09-29 19:00     ` Dr. David Alan Gilbert
2015-09-30  1:17     ` Haozhong Zhang
2015-09-30  1:17       ` Haozhong Zhang
2015-09-30  8:07       ` Dr. David Alan Gilbert
2015-10-06  1:24         ` Haozhong Zhang
2015-10-06  1:24           ` Haozhong Zhang
2015-09-28  5:38 ` [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the value from KVM Haozhong Zhang
2015-09-28  5:38   ` [Qemu-devel] " Haozhong Zhang
2015-09-28 16:17   ` Eduardo Habkost
2015-09-28 16:17     ` [Qemu-devel] " Eduardo Habkost
2015-09-29  1:23     ` Haozhong Zhang
2015-09-29  1:23       ` [Qemu-devel] " Haozhong Zhang
2015-09-29  1:46       ` Haozhong Zhang
2015-09-29  1:46         ` [Qemu-devel] " Haozhong Zhang
2015-09-28  5:38 ` [PATCH 3/3] kvm-all: notice KVM of vcpu's TSC rate after migration Haozhong Zhang
2015-09-28  5:38   ` [Qemu-devel] " Haozhong Zhang
2015-09-28 16:37   ` Eduardo Habkost
2015-09-28 16:37     ` [Qemu-devel] " Eduardo Habkost
2015-09-29  3:43     ` Haozhong Zhang
2015-09-29  3:43       ` [Qemu-devel] " Haozhong Zhang
2015-09-29 18:02       ` Eduardo Habkost [this message]
2015-09-29 18:02         ` Eduardo Habkost
2015-09-30  0:32         ` Haozhong Zhang
2015-09-30  0:32           ` [Qemu-devel] " Haozhong Zhang
2015-09-30 20:36           ` Eduardo Habkost
2015-09-30 20:36             ` [Qemu-devel] " Eduardo Habkost
2015-10-06  1:20             ` Haozhong Zhang
2015-10-06  1:20               ` [Qemu-devel] " Haozhong Zhang

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=20150929180207.GK4130@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=libvir-list@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.