From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, dahi@linux.vnet.ibm.com,
Paolo Bonzini <pbonzini@redhat.com>,
Jiri Denemark <jdenemar@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Richard Henderson <rth@twiddle.net>,
libvir-list@redhat.com
Subject: Re: [Qemu-devel] [PATCH v6 3/3] target-i386: Return runnability information on query-cpu-definitions
Date: Tue, 11 Oct 2016 15:51:51 +0200 [thread overview]
Message-ID: <20161011155151.36876570@nial.brq.redhat.com> (raw)
In-Reply-To: <20161011132438.GB3847@thinpad.lan.raisama.net>
On Tue, 11 Oct 2016 10:24:38 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
> On Tue, Oct 11, 2016 at 03:21:05PM +0200, Igor Mammedov wrote:
> > On Tue, 11 Oct 2016 08:58:02 -0300
> > Eduardo Habkost <ehabkost@redhat.com> wrote:
> >
> > > On Tue, Oct 11, 2016 at 01:45:21PM +0200, Igor Mammedov wrote:
> > > > On Mon, 10 Oct 2016 14:01:10 -0300
> > > > Eduardo Habkost <ehabkost@redhat.com> wrote:
> > > > > On Mon, Oct 10, 2016 at 02:27:49PM +0200, Igor Mammedov wrote:
> > > > > > On Fri, 7 Oct 2016 17:29:02 -0300
> > > > > > Eduardo Habkost <ehabkost@redhat.com> wrote:
> > > [...]
> > > > > > > +static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
> > > > > > > + strList **missing_feats)
> > > > > > > +{
> > > > > > > + X86CPU *xc;
> > > > > > > + FeatureWord w;
> > > > > > > + Error *err = NULL;
> > > > > > > + strList **next = missing_feats;
> > > > > > > +
> > > > > > > + if (xcc->kvm_required && !kvm_enabled()) {
> > > > > > > + strList *new = g_new0(strList, 1);
> > > > > > > + new->value = g_strdup("kvm");;
> > > > > > > + *missing_feats = new;
> > > > > > > + return;
> > > > > > > + }
> > > > > > > +
> > > > > > > + xc = X86_CPU(object_new(object_class_get_name(OBJECT_CLASS(xcc))));
> > > > > > > +
> > > > > > > + x86_cpu_load_features(xc, &err);
> > > > > > > + if (err) {
> > > > > > > + /* Errors at x86_cpu_load_features should never happen,
> > > > > > > + * but in case it does, just report the model as not
> > > > > > > + * runnable at all using the "type" property.
> > > > > > > + */
> > > > > > > + strList *new = g_new0(strList, 1);
> > > > > > > + new->value = g_strdup("type");
> > > > > > > + *next = new;
> > > > > > > + next = &new->next;
> > > > > > > + }
> > > > > > > +
> > > > > > > + x86_cpu_filter_features(xc);
> > > > > > > +
> > > > > > > + for (w = 0; w < FEATURE_WORDS; w++) {
> > > > > > > + uint32_t filtered = xc->filtered_features[w];
> > > > > > > + int i;
> > > > > > > + for (i = 0; i < 32; i++) {
> > > > > > > + if (filtered & (1UL << i)) {
> > > > > > > + strList *new = g_new0(strList, 1);
> > > > > > > + new->value = g_strdup(x86_cpu_feature_name(w, i));
> > > > > > > + *next = new;
> > > > > > > + next = &new->next;
> > > > > > > + }
> > > > > > > + }
> > > > > > > + }
> > > > > > Shouldn't you add
> > > > > > if (IS_AMD_CPU(env)) {
> > > > > > fixup here, that realize does right after calling x86_cpu_filter_features()
> > > > >
> > > > > What would it be useful for? The IS_AMD_CPU fixup runs after
> > > > > x86_cpu_filter_features() (so it doesn't affect filtered_features
> > > > > at all), and filtered_features is the only field used as input to
> > > > > build missing_feats.
> > > > For completeness of features returned by query-cpu-definitions, I'd guess.
> > > > So that returned cpu definitions would match actually created cpus.
> > >
> > > For completeness of which query-cpu-definitions field, exactly?
> > > There's no field in the return value of query-cpu-definitions
> > > that would be affected by the AMD aliases. The AMD aliases don't
> > > affect runnability of the CPU model because they aren't included
> > > in the GET_SUPPORTED_CPUID check[1].
> > >
> > > You would be right if we did return a copy of the low-level CPUID
> > > data that's seen by the guest, or if the AMD aliases were set up
> > > before x86_cpu_filter_features() (so they could affect
> > > filtered_features/unavailable-features), but that's not the case.
> > >
> > > [1] They aren't included in the GET_SUPPORTED_CPUID check because
> > > the existence of the AMD aliases depend only on the
> > > configured guest vendor ID, not on the host CPU.
> > >
> > Got it.
> >
> > I've tried to build with this patch but build fails with
> >
> > make -j32
> > CHK version_gen.h
> > CC i386-linux-user/target-i386/cpu.o
> > target-i386/cpu.c: In function ‘x86_cpu_definition_entry’:
> > target-i386/cpu.c:2199:51: error: ‘CpuDefinitionInfo’ has no member named ‘unavailable_features’
> > x86_cpu_class_check_missing_features(cc, &info->unavailable_features);
> > ^
> > target-i386/cpu.c:2200:9: error: ‘CpuDefinitionInfo’ has no member named ‘has_unavailable_features’
> > info->has_unavailable_features = true;
> >
> > Probably series misses a patch that adds it.
>
> See git URLs on cover letter. Series is based on my x86-next branch.
>
> ] This series can be seen in the git branch at:
> ] https://github.com/ehabkost/qemu-hacks.git work/query-cpu-definitions-runnable-info
> ]
> ] The series is based on my x86-next branch:
> ] https://github.com/ehabkost/qemu.git x86-next
I've used this one from yesterday as base and it didn't have
"qmp: Add runnability information to query-cpu-definitions"
I'll refetch and try again.
next prev parent reply other threads:[~2016-10-11 13:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 20:28 [Qemu-devel] [PATCH v6 0/3] Add runnability info to query-cpu-definitions Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 1/3] target-i386: Move warning code outside x86_cpu_filter_features() Eduardo Habkost
2016-10-10 11:57 ` Igor Mammedov
2016-10-10 17:04 ` Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 2/3] target-i386: x86_cpu_load_features() function Eduardo Habkost
2016-10-10 12:25 ` Igor Mammedov
2016-10-10 16:58 ` [Qemu-devel] [PATCH] fixup! " Eduardo Habkost
2016-10-11 11:41 ` Igor Mammedov
2016-10-14 14:59 ` Eduardo Habkost
2016-10-07 20:29 ` [Qemu-devel] [PATCH v6 3/3] target-i386: Return runnability information on query-cpu-definitions Eduardo Habkost
2016-10-10 12:27 ` Igor Mammedov
2016-10-10 17:01 ` Eduardo Habkost
2016-10-11 11:45 ` Igor Mammedov
2016-10-11 11:58 ` Eduardo Habkost
2016-10-11 13:21 ` Igor Mammedov
2016-10-11 13:24 ` Eduardo Habkost
2016-10-11 13:51 ` Igor Mammedov [this message]
2016-10-11 14:13 ` Igor Mammedov
2016-10-14 14:59 ` 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=20161011155151.36876570@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=ehabkost@redhat.com \
--cc=jdenemar@redhat.com \
--cc=libvir-list@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 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).