All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, Haozhong Zhang <haozhong.zhang@intel.com>
Subject: Re: [PATCH 2/4] kvm: Allow invtsc migration if tsc-khz is set explicitly
Date: Wed, 4 Jan 2017 11:45:36 -0200	[thread overview]
Message-ID: <20170104134534.GA21361@amt.cnet> (raw)
In-Reply-To: <20170104134017.GH3315@thinpad.lan.raisama.net>

On Wed, Jan 04, 2017 at 11:40:17AM -0200, Eduardo Habkost wrote:
> On Wed, Jan 04, 2017 at 09:44:06AM -0200, Marcelo Tosatti wrote:
> > On Tue, Dec 27, 2016 at 05:21:18PM -0200, Eduardo Habkost wrote:
> > > We can safely allow a VM to be migrated with invtsc enabled if
> > > tsc-khz is set explicitly, because QEMU already refuses to start
> > > if it can't set the TSC frequency to the configured value.
> > 
> > On the source host, yes, but on the destination it does not.
> > 
> > SOURCE: -cpu kvm64,tsc-frequency=2660001000
> > DESTINATION: -cpu kvm64
> 
> This is invalid usage. Management software is responsible for
> keeping the same configuration on source and destination.

Fine. Just to confirm: you do not expect libvirt to 
use

        -cpu XXX,tsc-frequency=ZZZZZ

On both source and destination, correct?

> > Only prints:
> > 
> > qemu-system-x86_64: warning: TSC frequency mismatch between VM (2660001
> > kHz) and host (2893428 kHz), and TSC scaling unavailable
> > qemu-system-x86_64: warning: TSC frequency mismatch between VM (2660001
> > kHz) and host (2893428 kHz), and TSC scaling unavailable
> > 
> > And allows migration.
> > 
> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > > ---
> > >  target/i386/kvm.c | 19 ++++++++++---------
> > >  1 file changed, 10 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> > > index a26290f..6a51399 100644
> > > --- a/target/i386/kvm.c
> > > +++ b/target/i386/kvm.c
> > > @@ -962,15 +962,16 @@ int kvm_arch_init_vcpu(CPUState *cs)
> > >          has_msr_mcg_ext_ctl = has_msr_feature_control = true;
> > >      }
> > >  
> > > -    if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> > > -        invtsc_mig_blocker == NULL) {
> > > -        /* for migration */
> > > -        error_setg(&invtsc_mig_blocker,
> > > -                   "State blocked by non-migratable CPU device"
> > > -                   " (invtsc flag)");
> > > -        migrate_add_blocker(invtsc_mig_blocker);
> > > -        /* for savevm */
> > > -        vmstate_x86_cpu.unmigratable = 1;
> > > +    if (!env->user_tsc_khz) {
> > > +        if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> > > +            invtsc_mig_blocker == NULL) {
> > > +            /* for migration */
> > > +            error_setg(&invtsc_mig_blocker,
> > > +                       "State blocked by non-migratable CPU device"
> > > +                       " (invtsc flag)");
> > > +            migrate_add_blocker(invtsc_mig_blocker);
> > > +            /* for savevm */
> > > +            vmstate_x86_cpu.unmigratable = 1;
> > >      }
> > >  
> > >      cpuid_data.cpuid.padding = 0;
> > > -- 
> > > 2.7.4
> 
> -- 
> Eduardo
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, Haozhong Zhang <haozhong.zhang@intel.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] kvm: Allow invtsc migration if tsc-khz is set explicitly
Date: Wed, 4 Jan 2017 11:45:36 -0200	[thread overview]
Message-ID: <20170104134534.GA21361@amt.cnet> (raw)
In-Reply-To: <20170104134017.GH3315@thinpad.lan.raisama.net>

On Wed, Jan 04, 2017 at 11:40:17AM -0200, Eduardo Habkost wrote:
> On Wed, Jan 04, 2017 at 09:44:06AM -0200, Marcelo Tosatti wrote:
> > On Tue, Dec 27, 2016 at 05:21:18PM -0200, Eduardo Habkost wrote:
> > > We can safely allow a VM to be migrated with invtsc enabled if
> > > tsc-khz is set explicitly, because QEMU already refuses to start
> > > if it can't set the TSC frequency to the configured value.
> > 
> > On the source host, yes, but on the destination it does not.
> > 
> > SOURCE: -cpu kvm64,tsc-frequency=2660001000
> > DESTINATION: -cpu kvm64
> 
> This is invalid usage. Management software is responsible for
> keeping the same configuration on source and destination.

Fine. Just to confirm: you do not expect libvirt to 
use

        -cpu XXX,tsc-frequency=ZZZZZ

On both source and destination, correct?

> > Only prints:
> > 
> > qemu-system-x86_64: warning: TSC frequency mismatch between VM (2660001
> > kHz) and host (2893428 kHz), and TSC scaling unavailable
> > qemu-system-x86_64: warning: TSC frequency mismatch between VM (2660001
> > kHz) and host (2893428 kHz), and TSC scaling unavailable
> > 
> > And allows migration.
> > 
> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > > ---
> > >  target/i386/kvm.c | 19 ++++++++++---------
> > >  1 file changed, 10 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> > > index a26290f..6a51399 100644
> > > --- a/target/i386/kvm.c
> > > +++ b/target/i386/kvm.c
> > > @@ -962,15 +962,16 @@ int kvm_arch_init_vcpu(CPUState *cs)
> > >          has_msr_mcg_ext_ctl = has_msr_feature_control = true;
> > >      }
> > >  
> > > -    if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> > > -        invtsc_mig_blocker == NULL) {
> > > -        /* for migration */
> > > -        error_setg(&invtsc_mig_blocker,
> > > -                   "State blocked by non-migratable CPU device"
> > > -                   " (invtsc flag)");
> > > -        migrate_add_blocker(invtsc_mig_blocker);
> > > -        /* for savevm */
> > > -        vmstate_x86_cpu.unmigratable = 1;
> > > +    if (!env->user_tsc_khz) {
> > > +        if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> > > +            invtsc_mig_blocker == NULL) {
> > > +            /* for migration */
> > > +            error_setg(&invtsc_mig_blocker,
> > > +                       "State blocked by non-migratable CPU device"
> > > +                       " (invtsc flag)");
> > > +            migrate_add_blocker(invtsc_mig_blocker);
> > > +            /* for savevm */
> > > +            vmstate_x86_cpu.unmigratable = 1;
> > >      }
> > >  
> > >      cpuid_data.cpuid.padding = 0;
> > > -- 
> > > 2.7.4
> 
> -- 
> Eduardo
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-01-04 13:45 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27 19:21 [PATCH 0/4] Allow migration with invtsc if there's no frequency mismatch Eduardo Habkost
2016-12-27 19:21 ` [Qemu-devel] " Eduardo Habkost
2016-12-27 19:21 ` [PATCH 1/4] kvm: Simplify invtsc check Eduardo Habkost
2016-12-27 19:21   ` [Qemu-devel] " Eduardo Habkost
2016-12-29 18:57   ` Marcelo Tosatti
2016-12-29 18:57     ` [Qemu-devel] " Marcelo Tosatti
2016-12-27 19:21 ` [PATCH 2/4] kvm: Allow invtsc migration if tsc-khz is set explicitly Eduardo Habkost
2016-12-27 19:21   ` [Qemu-devel] " Eduardo Habkost
2017-01-04 11:44   ` Marcelo Tosatti
2017-01-04 11:44     ` [Qemu-devel] " Marcelo Tosatti
2017-01-04 11:57     ` Marcelo Tosatti
2017-01-04 11:57       ` [Qemu-devel] " Marcelo Tosatti
2017-01-04 13:40     ` Eduardo Habkost
2017-01-04 13:40       ` [Qemu-devel] " Eduardo Habkost
2017-01-04 13:45       ` Marcelo Tosatti [this message]
2017-01-04 13:45         ` Marcelo Tosatti
2017-01-04 13:51         ` Eduardo Habkost
2017-01-04 13:51           ` [Qemu-devel] " Eduardo Habkost
2016-12-27 19:21 ` [PATCH 3/4] pc: Add 2.9 machine-types Eduardo Habkost
2016-12-27 19:21   ` [Qemu-devel] " Eduardo Habkost
2016-12-30 13:38   ` Igor Mammedov
2016-12-30 13:38     ` [Qemu-devel] " Igor Mammedov
2017-01-04 14:01   ` Laszlo Ersek
2017-01-04 14:20     ` Eduardo Habkost
2017-01-04 14:20       ` [Qemu-devel] " Eduardo Habkost
2017-01-04 16:40       ` Laszlo Ersek
2017-01-04 16:40         ` [Qemu-devel] " Laszlo Ersek
2017-01-04 17:46         ` Eduardo Habkost
2016-12-27 19:21 ` [PATCH 4/4] kvm: Allow migration with invtsc Eduardo Habkost
2016-12-27 19:21   ` [Qemu-devel] " Eduardo Habkost
2017-01-04 11:56   ` Marcelo Tosatti
2017-01-04 11:56     ` [Qemu-devel] " Marcelo Tosatti
2017-01-04 13:39     ` Eduardo Habkost
2017-01-04 13:39       ` [Qemu-devel] " Eduardo Habkost
2017-01-04 19:59       ` [libvirt] TSC frequency configuration & invtsc migration (was Re: [PATCH 4/4] kvm: Allow migration with invtsc) Eduardo Habkost
2017-01-04 19:59         ` [Qemu-devel] " Eduardo Habkost
2017-01-04 22:26         ` Marcelo Tosatti
2017-01-04 22:26           ` [Qemu-devel] " Marcelo Tosatti
2017-01-05  1:36           ` Eduardo Habkost
2017-01-05  1:36             ` [Qemu-devel] " Eduardo Habkost
2017-01-05 10:48             ` Marcelo Tosatti
2017-01-05 10:48               ` [Qemu-devel] " Marcelo Tosatti
2017-01-05 10:50               ` Marcelo Tosatti
2017-01-05 10:50                 ` [Qemu-devel] " Marcelo Tosatti
2017-01-05 12:19               ` Eduardo Habkost
2017-01-05 12:19                 ` [Qemu-devel] " Eduardo Habkost
2017-01-05 12:33                 ` [libvirt] " Daniel P. Berrange
2017-01-05 12:33                   ` [Qemu-devel] " Daniel P. Berrange
2017-01-05 12:48                   ` Eduardo Habkost
2017-01-05 12:48                     ` [Qemu-devel] " Eduardo Habkost
2017-01-05 13:00                     ` Daniel P. Berrange
2017-01-05 13:00                       ` [Qemu-devel] " Daniel P. Berrange
2017-01-05 13:11                       ` Eduardo Habkost
2017-01-05 13:11                         ` [Qemu-devel] " Eduardo Habkost
2017-01-10 16:38                       ` Paolo Bonzini
2017-01-10 16:38                         ` [Qemu-devel] " Paolo Bonzini
2017-01-06 10:31                 ` Marcelo Tosatti
2017-01-06 10:31                   ` [Qemu-devel] " Marcelo Tosatti
2017-01-08 15:49                   ` How to make dest host abort migration safely " Eduardo Habkost
2017-01-08 15:49                     ` [Qemu-devel] " Eduardo Habkost
2017-01-09 10:04                     ` [libvirt] " Dr. David Alan Gilbert
2017-01-09 10:04                       ` [Qemu-devel] " Dr. David Alan Gilbert
2017-01-08 20:28                   ` Exporting kvm_max_guest_tsc_khz to userspace " Eduardo Habkost
2017-01-08 20:28                     ` [Qemu-devel] " Eduardo Habkost
2017-01-09 14:58                     ` Paolo Bonzini
2017-01-09 14:58                       ` [Qemu-devel] " Paolo Bonzini
2017-01-11 13:26                       ` Eduardo Habkost
2017-01-11 13:26                         ` [Qemu-devel] " Eduardo Habkost
2017-01-11 14:06                         ` Paolo Bonzini
2017-01-11 14:06                           ` [Qemu-devel] " Paolo Bonzini
2017-01-10 16:36               ` TSC frequency configuration & invtsc migration " Paolo Bonzini
2017-01-10 16:36                 ` [Qemu-devel] " Paolo Bonzini
2017-01-11 11:58                 ` Eduardo Habkost
2017-01-11 11:58                   ` [Qemu-devel] " Eduardo Habkost
2017-01-18 11:55                 ` Marcelo Tosatti
2017-01-18 11:55                   ` [Qemu-devel] " Marcelo Tosatti
2017-01-18 12:43                   ` Eduardo Habkost
2017-01-18 12:43                     ` [Qemu-devel] " Eduardo Habkost

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=20170104134534.GA21361@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.