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: [libvirt] TSC frequency configuration & invtsc migration (was Re: [PATCH 4/4] kvm: Allow migration with invtsc)
Date: Thu, 5 Jan 2017 12:33:51 +0000 [thread overview]
Message-ID: <20170105123351.GF3292@redhat.com> (raw)
In-Reply-To: <20170105121950.GP3315@thinpad.lan.raisama.net>
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:
> > > I am considering two possible scenarios below. You probably have
> > > another scenario in mind, so it would be useful if you could
> > > describe it so we can consider possible solutions.
> > >
> > >
> > > Scenario 1:
> > >
> > > You have two hosts: A and B, both with TSC scaling. They have
> > > different frequencies. The VM can be started on either one of
> > > them, and can be migrated to either one depending on the policy
> > > of management software.
> > >
> > > Maybe B is a backup host, the VM is expected to run most times on
> > > host A, and we want to use the TSC frequency from host A every
> > > time. Maybe it's the opposite and we want to use the frequency of
> > > B. Maybe we want to use the lowest frequency of both, maybe the
> > > highest one. We (QEMU developers) can recommend policy to libvirt
> > > developers, but a given QEMU process doesn't have information to
> > > decide what's best.
> >
> > I can't see any practical scenario here, you will always want
> > to start with TSC frequency of the host where the VM was started.
> >
> > If i am mistaken, please describe a practical case.
> >
> > (If a practical scenario comes up, and there is a use-case
> > for setting the TSC frequency on startup, lets say
> > a Windows VM which fails to boot if the TSC frequency
> > is too high, then it should be supported... But the
> > only known scenario to me, applying to 99.999% of cases,
> > is to expose the TSC frequency where the guest booted at).
>
> I don't have any specific case: my point is that I can't tell
> what's the best frequency if I don't know where the hosts are
> expected to be migrated to.
>
> You claim that using the starting host frequency is the best
> option on the vast majority of cases. Maybe it's true, and it
> would be a good default. The only problem is that this default
> affects migratability:
Yep, this is the same scenario as CPU model choice. While
using "host" model may be a reasonable default if all the
hosts in your cluster use identical CPUs. If you have a
mix of CPUs though, and you care about migration, you'll
want to determine a common denominator instead. The same
applies to TSC frequency choice.
So from that POV, the libvirt capabilities XML for a host
needs to have a way to report the supported TSC frequency
for the host. The mgmt app can then figure out what explicit
TSC freq to set for guests that need to be migratable to
maximise runnability across the hosts.
> > > 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.
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/ :|
next prev parent reply other threads:[~2017-01-05 12:34 UTC|newest]
Thread overview: 40+ 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 ` [PATCH 1/4] kvm: Simplify invtsc check Eduardo Habkost
2016-12-29 18:57 ` Marcelo Tosatti
2016-12-27 19:21 ` [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 ` [PATCH 3/4] pc: Add 2.9 machine-types Eduardo Habkost
2016-12-30 13:38 ` Igor Mammedov
2017-01-04 14:01 ` [Qemu-devel] " Laszlo Ersek
2017-01-04 14:20 ` Eduardo Habkost
2017-01-04 16:40 ` Laszlo Ersek
2017-01-04 17:46 ` [Qemu-devel] " Eduardo Habkost
2016-12-27 19:21 ` [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 ` [libvirt] 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 ` Daniel P. Berrange [this message]
2017-01-05 12:48 ` [libvirt] " Eduardo Habkost
2017-01-05 13:00 ` Daniel P. Berrange
2017-01-05 13:11 ` Eduardo Habkost
2017-01-10 16:38 ` Paolo Bonzini
2017-01-06 10:31 ` Marcelo Tosatti
2017-01-08 15:49 ` How to make dest host abort migration safely " Eduardo Habkost
2017-01-09 10:04 ` [libvirt] " Dr. David Alan Gilbert
2017-01-08 20:28 ` 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 ` 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=20170105123351.GF3292@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