All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Jiri Denemark <jdenemar@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 0/2] i386: "unavailable-features" QOM property
Date: Thu, 9 May 2019 13:08:25 -0300	[thread overview]
Message-ID: <20190509160825.GL4189@habkost.net> (raw)
In-Reply-To: <20190509152616.GL7181@orkuz.int.mamuti.net>

On Thu, May 09, 2019 at 05:26:16PM +0200, Jiri Denemark wrote:
> On Thu, May 09, 2019 at 10:56:17 -0300, Eduardo Habkost wrote:
> > On Thu, May 09, 2019 at 03:35:37PM +0200, Jiri Denemark wrote:
> > > Would this unavailable-features property contain only canonical names of
> > > the features or all possible aliases of all features? For example,
> > > "tsc-adjust" can also be spelled as "tsc_adjust". When calling
> > > query-cpu-model-expansion, we have a way to request all variants by
> > > running full expansion on the result of a previous static expansion. Can
> > > we get something like this for unavailable-features too?
> > 
> > I'd like to avoid that, and refer only to the canonical names.
> > 
> > Could you explain the use case you have in mind, so we can look
> > for alternatives?
> 
> Libvirt only knows about a single spelling for each CPU feature and
> quite often it is not the canonical variant. Thus libvirt would only
> recognize features for which the name known by libvirt is the canonical
> name.
> 
> We could theoretically make the translation in libvirt, but it's not
> going to be future proof. If a new spelling is introduced, it's because
> the old one is not considered correct and the new one becomes the
> canonical version. When libvirt doesn't have the translation (libvirt is
> older or just didn't catch up yet) we have a big problem.
> 
> I guess a good alternative would be some way of querying all CPU feature
> names and their aliases. If I'm not mistaken, we can either get a list
> of canonical names or all names, but without any clue which names
> actually refer to a single feature.

Right.  But (as described below) if you want to know the status a
specific feature you already know about (even if you are using
the old spelling), qom-get should work for you.

The goal of filtered-features and unavailable-features is to
catch all the rest: features you might not know about, but that
should prevent a CPU model from running.

> 
> > > As you mentioned, there are two interesting QOM properties:
> > > filtered-features and feature-words and both are used by libvirt. We use
> > > feature-words to get CPU features which were enabled in the guest CPU on
> > > top of what we expected. This is the case of, e.g., a feature added to a
> > > given CPU model for new machine types. I guess we could switch to
> > > checking QOM properties for individual features as a replacement for
> > > feature-words which covers both CPUID and MSR features.
> > 
> > I guess it depends on your goal:
> > 
> > If your just want to know if one specific feature is missing for
> > some reason, you can check the QOM properties directly.  That's
> > OK, and it's even better than checking the `feature-words`
> > property.
> > 
> > If you want to be 100% sure no property was missing when starting
> > the VM (e.g. emulate the behavior of the "enforce" option), I
> > suggest you check if `unavailable-features` is empty.
> 
> That's what filtered-features is used for.

Right.  My goal here is to replace filtered-features, not
feature-words.

> 
> As I tried to explain (and apparently failed :-)) we use feature-words
> for a different thing. I guess it will be more clear using a specific
> example. For example, when arat CPU feature was introduced, it was added
> into several existing CPU models and thus libvirt's version of the CPU
> model differs from the one in QEMU. (This is actually safer and better
> then changing the libvirt's CPU model too since migration relies on both
> hosts having the same definition of the CPU model used by a domain.) So,
> for example, when a domain with Broadwell CPU model is started, libvirt
> checks feature-words to see whether some CPU features not defined in
> libvirt's definition of Broadwell CPU model were enabled. And it will
> see arat. As a result the live domain definition will actually be
> changed to Broadwell+arat to make sure arat is not lost after migration.
> 
> Is the usage clear now?
> 
> Anyway, I think we can just check all features we know about via CPU
> properties to get the same result. It's not going to be as nice as using
> feature-words, but it's doable.

For the use case you describe here, qom-get sounds better than
using feature-words, yes.

-- 
Eduardo


  reply	other threads:[~2019-05-09 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 23:47 [Qemu-devel] [PATCH 0/2] i386: "unavailable-features" QOM property Eduardo Habkost
2019-04-22 23:47 ` Eduardo Habkost
2019-04-22 23:47 ` [Qemu-devel] [PATCH 1/2] i386: x86_cpu_list_feature_names() function Eduardo Habkost
2019-04-22 23:47   ` Eduardo Habkost
2019-04-22 23:47 ` [Qemu-devel] [PATCH 2/2] i386: "unavailable-features" QOM property Eduardo Habkost
2019-04-22 23:47   ` Eduardo Habkost
2019-05-09 13:35 ` [Qemu-devel] [PATCH 0/2] " Jiri Denemark
2019-05-09 13:56   ` Eduardo Habkost
2019-05-09 15:26     ` Jiri Denemark
2019-05-09 16:08       ` Eduardo Habkost [this message]
2019-05-10 11:33         ` Jiri Denemark
2019-05-10 20:23           ` Eduardo Habkost
2019-05-22  8:42             ` Jiri Denemark
2019-05-22 17:46               ` Eduardo Habkost
2019-05-09 16:06     ` Igor Mammedov
2019-05-09 16:36       ` Jiri Denemark
2019-05-10 20:32         ` Eduardo Habkost
2019-05-22  8:27           ` Jiri Denemark
2019-05-22 14:44             ` 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=20190509160825.GL4189@habkost.net \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@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.