From: Eduardo Habkost <ehabkost@redhat.com>
To: "Moger, Babu" <Babu.Moger@amd.com>
Cc: "mst@redhat.com" <mst@redhat.com>,
"marcel.apfelbaum@gmail.com" <marcel.apfelbaum@gmail.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"rth@twiddle.net" <rth@twiddle.net>,
"mtosatti@redhat.com" <mtosatti@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"kash@tripleback.net" <kash@tripleback.net>,
"geoff@hostfission.com" <geoff@hostfission.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v12 2/4] i386: Verify if topoext feature can be supported
Date: Thu, 7 Jun 2018 11:38:35 -0300 [thread overview]
Message-ID: <20180607143835.GF7451@localhost.localdomain> (raw)
In-Reply-To: <DM5PR12MB2471DF38865A11BD0D08F8CE95640@DM5PR12MB2471.namprd12.prod.outlook.com>
On Thu, Jun 07, 2018 at 02:24:18PM +0000, Moger, Babu wrote:
[...]
> > > + /* On AMD systems, check if we can support topoext feature */
> > > + if (IS_AMD_CPU(env) &&
> > > + (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT)) {
> > > + if (!topology_supports_topoext(cs->nr_cores, cs->nr_threads)) {
> > > + /* Cannot support topoext */
> > > + error_setg(errp, "CPU model does not support topoext feature "
> > > + "with number of cores(%d) and threads(%d). "
> > > + "Please configure -smp options properly.",
> > > + cs->nr_cores, cs->nr_threads);
> >
> > See error.h documentation:
> >
> > * Error reporting system loosely patterned after Glib's GError.
> > *
> > * Create an error:
> > * error_setg(&err, "situation normal, all fouled up");
> > *
> > * Create an error and add additional explanation:
> > * error_setg(&err, "invalid quark");
> > * error_append_hint(&err, "Valid quarks are up, down, strange, "
> > * "charm, top, bottom.\n");
> > *
> > * Do *not* contract this to
> > * error_setg(&err, "invalid quark\n"
> > * "Valid quarks are up, down, strange, charm, top, bottom.");
> > *
> >
> > I suggest something like this:
>
> Sure. I will make these changes. Thanks
Thanks. Note that I have made a mistake below, by not including
a newline in error_append_hint().
Also, I'm not sure if it's better to mention the current value of
nr_cores in error_setg() or just in the error hint. Markus, do
you have any suggestion?
>
> >
> > static bool topology_supports_topoext(int nr_cores, int nr_threads, Error
> > **errp)
> > {
> > if (nr_cores > (MAX_CORES_IN_NODE * MAX_NODES_PER_SOCKET))) {
> > error_setg(errp, "TOPOEXT unsupported with %d cores per socket",
> > nr_cores);
> > error_append_hint(errp, "TOPOEXT supports only up to %d cores per
> > socket",
> > (MAX_CORES_IN_NODE * MAX_NODES_PER_SOCKET));
> > return false;
> > }
> > if (nr_threads > 2) {
> > error_setg(errp, "TOPOEXT unsupported with %d threads per core",
> > nr_threads);
> > error_append_hint(errp, "TOPOEXT supports only up to 2 threads per
> > core");
> > (MAX_CORES_IN_NODE * MAX_NODES_PER_SOCKET));
> > return false;
> > }
> > return true;
> > }
> >
> > static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> > {
> > /* ... */
> > if (IS_AMD_CPU(env) &&
> > (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
> > !topology_supports_topoext(cs->nr_cores, cs->nr_threads, errp)) {
> > return;
> > }
> > /* ... */
> > }
> >
> > --
> > Eduardo
--
Eduardo
next prev parent reply other threads:[~2018-06-07 14:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 14:36 [Qemu-devel] [PATCH v12 0/4] i386: Enable TOPOEXT to support hyperthreading on AMD CPU Babu Moger
2018-06-06 14:36 ` [Qemu-devel] [PATCH v12 1/4] i386: Add support for CPUID_8000_001E for AMD Babu Moger
2018-06-06 21:26 ` Eduardo Habkost
2018-06-08 18:15 ` Moger, Babu
2018-06-06 14:36 ` [Qemu-devel] [PATCH v12 2/4] i386: Verify if topoext feature can be supported Babu Moger
2018-06-06 22:05 ` Eduardo Habkost
2018-06-07 14:24 ` Moger, Babu
2018-06-07 14:38 ` Eduardo Habkost [this message]
2018-06-06 14:36 ` [Qemu-devel] [PATCH v12 3/4] i386: Enable TOPOEXT feature on AMD EPYC CPU Babu Moger
2018-06-06 22:39 ` Eduardo Habkost
2018-06-08 18:40 ` Moger, Babu
2018-06-08 19:23 ` Eduardo Habkost
2018-06-08 19:36 ` Moger, Babu
2018-06-08 19:50 ` Eduardo Habkost
2018-06-08 20:00 ` Moger, Babu
2018-06-08 22:59 ` Moger, Babu
2018-06-06 14:36 ` [Qemu-devel] [PATCH v12 4/4] i386: Remove generic SMT thread check Babu Moger
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=20180607143835.GF7451@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=Babu.Moger@amd.com \
--cc=armbru@redhat.com \
--cc=geoff@hostfission.com \
--cc=kash@tripleback.net \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@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).