From: Jiri Denemark <jdenemar@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: libvir-list@redhat.com, "Igor Mammedov" <imammedo@redhat.com>,
qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] libvirt<->QEMU interfaces for CPU models
Date: Fri, 1 Mar 2013 23:56:00 +0100 [thread overview]
Message-ID: <20130301225600.GA3461802@orkuz.home> (raw)
In-Reply-To: <20130301150207.GV8494@otherpad.lan.raisama.net>
On Fri, Mar 01, 2013 at 12:02:07 -0300, Eduardo Habkost wrote:
> On Fri, Mar 01, 2013 at 02:12:38PM +0100, Jiri Denemark wrote:
> > Definitely, we plan to start using "enforce" flag as soon as we have
> > better CPU probing interface with QEMU. Since libvirt does not currently
> > consult CPU specs with QEMU, some configurations in fact rely on QEMU
> > dropping features it can't provide. Of course, that's bad for several
> > reasons but we don't want such configurations to suddenly stop working.
> > We want to first fix the CPU specs libvirt creates so that we know they
> > will work with "enforce".
>
> Also: more important than fixing the CPU definitions from libvirt, is to
> ask QEMU for host capabilities and CPU model definitions. The whole
> point of this is to solve the CPU model data duplication/synchronization
> problems between libvirt and QEMU.
>
> Once you are able to query CPU model definitions on runtime, you don't
> even need to make cpu_map.xml agree with QEMU. You can simply ask QEMU
> how each model looks like, and remove/add features from the command-line
> as necessary, so the resulting VM matches what the user asked for.
Right, that's what I had in mind. By libvirt providing correct CPU
definitions (probably better called the right -cpu command line option)
I meant that we need to actually probe QEMU rather than making the
definitions on our own from cpu_map.xml and host CPUID.
> > > Limitation: no proper machine-friendly interface to report which features
> > > are missing.
> > >
> > > Workaround: See "querying for host capabilities" below.
> >
> > I doubt we will be ready to start using "enforce" before the machine
> > friendly interface is available...
>
> If you query for the "-cpu host" capabilities first and ensure all
> features from a CPU model is available, enforce is supposed to not fail.
>
> I understand that a machine-friendly error reporting for "enforce" would
> be very useful, but note that if "enforce" fails, it is probably already
> too late for libvirt, and that means that what libvirt thinks about host
> capabilities and CPU models is already incorrect.
But we still need to know details about each CPU model so that we
can choose the right one. I was trying to say that by the time we have
this probing and can start using enforce, the machine friendly reporting
could be available as well and the limitation will be gone.
> > > == Future plans ==
> > >
> > > It would be interesting to get rid of the requirement for a live QEMU process
> > > (with a complete machine being created) to be already running.
> >
> > Hmm, so is this complete machine needed even for getting CPU models from
> > qom-list-types or only for querying exact definitions using
> > query-cpu-definitions command?
>
> Maybe "complete machine" isn't the right expression, here. What I mean is:
> AFAIK, it is not possible to get a QMP monitor without actually having a
> machine being created by QEMU (even if it is a machine that will never run).
OK, I thought there was something special needed. We already start QEMU
in such a way that we can communicate with it using QMP monitor. So this
is just a question of using the right machine if we need to know the
details about given CPU model.
> > > = Getting information about CPU models =
> > >
> > > Requirement: libvirt uses the predefined CPU models from QEMU, but it needs to
> > > be able to query for CPU model details, to find out how it can create a VM that
> > > matches what was requested by the user.
> > >
> > > Current problem: libvirt has a copy of the CPU model definitions on its
> > > cpu_map.xml file, and the copy can be out of sync in case CPU models in QEMU
> > > change. libvirt also assumes that the set of features on each model is always
> > > the same on all machine-types, which is not true.
> > >
> > > Challenge: the resulting CPU features depend on lots of factors, including
> > > the machine-type.
> > >
> > > Workaround: start a paused VM and query for the CPU device information
> > > after the CPU was created.
>
> I just noticed another problem here, but this gave me an idea that would
> help solve the "enforce" error reporting problem:
>
> Problem: "qemu -machine <M> -cpu <model>" will create CPU objects
> where the CPU features are _already_ filtered based on host
> capabilities.
Ah, it seems logical now that you mention it :-)
> * Using "enforce" wouldn't solve it, because then QEMU would abort, and
> QMP would be unavailable.
>
> Solution: we could have a CPU object property like
> "removed-features" that would have the list of features that were
> disabled because they are not supported by the host (and would make
> "enforce" fail).
>
> * This would solve the problem above and also be a machine-friendly
> way to check for possible "enforce" errors.
>
> * In other words: instead of "enforce", libvirt could use "check"
> instead of "enforce", and before unpausing the VM (or even starting
> migration), it should first check if the "removed-features" property is
> empty.
>
> Would that work for you?
Yes, that seems like it could work. In fact, it seems much better than
using enforce and trying to deal with aborted QEMU.
Jirka
next prev parent reply other threads:[~2013-03-01 22:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130221145818.GK16618@otherpad.lan.raisama.net>
2013-03-01 13:12 ` [Qemu-devel] libvirt<->QEMU interfaces for CPU models Jiri Denemark
2013-03-01 15:02 ` Eduardo Habkost
2013-03-01 22:56 ` Jiri Denemark [this message]
2013-03-25 20:37 ` Eduardo Habkost
2013-03-01 18:31 ` Andreas Färber
2013-03-01 18:34 ` Daniel P. Berrange
2013-03-01 19:01 ` Eduardo Habkost
2013-03-01 18:58 ` Eduardo Habkost
2013-03-04 10:33 ` Daniel P. Berrange
2013-03-01 13:28 ` Jiri Denemark
2013-03-01 15:31 ` 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=20130301225600.GA3461802@orkuz.home \
--to=jdenemar@redhat.com \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=libvir-list@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).