qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	libvir-list@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Haozhong Zhang <haozhong.zhang@intel.com>
Subject: Re: [Qemu-devel] [libvirt] TSC frequency configuration & invtsc migration (was Re: [PATCH 4/4] kvm: Allow migration with invtsc)
Date: Thu, 5 Jan 2017 13:00:32 +0000	[thread overview]
Message-ID: <20170105130032.GJ3292@redhat.com> (raw)
In-Reply-To: <20170105124857.GQ3315@thinpad.lan.raisama.net>

On Thu, Jan 05, 2017 at 10:48:57AM -0200, Eduardo Habkost wrote:
> On Thu, Jan 05, 2017 at 12:33:51PM +0000, Daniel P. Berrange wrote:
> > On Thu, Jan 05, 2017 at 10:19:50AM -0200, Eduardo Habkost wrote:
> > > On Thu, Jan 05, 2017 at 08:48:32AM -0200, Marcelo Tosatti wrote:
> > > > On Wed, Jan 04, 2017 at 11:36:31PM -0200, Eduardo Habkost wrote:
> [...]
> > > > > Scenario 2:
> > > > > 
> > > > > Host A has TSC scaling, host B doesn't have TSC scaling. We want
> > > > > to be able to start the VM on host A, and migrate to B. In this
> > > > > case, the only possible solution is to use B's frequency when
> > > > > starting the VM. The QEMU process doesn't have enough information
> > > > > to make that decision.
> > > > 
> > > > That is a good point. But again, its a special case and 
> > > > should be supported by -cpu xxx,tsc-frequency=zzzz.
> > > > 
> > > > However, for the vast majority of 99.999% cases, the issue
> > > > can be handled entirely in QEMU, without libvirt involvement,
> > > > and without adding extra steps to the management software.
> > > 
> > > I agree it should cover most cases. The only problem here is that
> > > it can break migration in unexpected ways.
> > > 
> > > Then my point is: assuming that libvirt will prefer to require
> > > explicit TSC frequency configuration to enable invtsc migration
> > > (instead of getting unpredictable migration compatibility), is
> > > the added complexity to migration code worth the effort, if
> > > choosing an explicit frequency is safer and more predictable? I
> > > believe this is where we disagree.
> > 
> > I believe that if libvirt detects that QEMU supports the 'tsc-frequency'
> > option, then libvirt should set it by default in the XML, if not already
> > set by the mgmt app. That way, libvirt can validate TSC freq comapt
> > for migration before it even launches QEMU in the target host.
> 
> If you do this unconditionally, you have another problem: if
> tsc-frequency is set explicitly, migration is only possible if
> TSC frequency of the destination matches[1], or if TSC scaling is
> supported by the destination. It's a good idea to set a TSC
> frequency only if invtsc is enabled explicitly in the config.

If we don't set tsc-frequency and the TSC frequency doesn't
match, does that mean the guest migration succeed, but suddenly
sees different TSC frequency ?

I guess we we allowed that historically we can't break that
now, so setting it only if invtsc is set seems reasonable.

> 
> [1] Currently the frequency needs to match exactly. That's a
> separate issue: we should probably add a knob to allow a slight
> variation in TSC frequency (e.g. <1% difference).

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

  reply	other threads:[~2017-01-05 13:00 UTC|newest]

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