From: Wei Huang <wei@redhat.com>
To: afaerber@suse.de
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/1] target-i386: prevent users from setting threads>1 for AMD CPUs
Date: Tue, 07 Oct 2014 14:42:53 -0500 [thread overview]
Message-ID: <5434423D.8030701@redhat.com> (raw)
In-Reply-To: <1412709453-11940-1-git-send-email-wei@redhat.com>
Sorry, please skip this version. I am sending out a updated one.
-Wei
On 10/07/2014 02:17 PM, Wei Huang wrote:
> AMD CPU doesn't support hyperthreading. Even though QEMU fixes
> this issue by setting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
> via conversion, it is better to stop end-users in the first place
> with a warning message.
>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
> target-i386/cpu.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index e7bf9de..01bbcaf 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2742,6 +2742,24 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> mce_init(cpu);
> qemu_init_vcpu(cs);
>
> + /* AMD CPU doesn't support hyperthreading. Even though QEMU does fix
> + * this issue by setting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
> + * correctly, it is still better to stop end-users in the first place
> + * by giving out a warning message.
> + *
> + * NOTE: cs->nr_threads is initialized in qemu_init_vcpu(). So the
> + * following code has to follow qemu_init_vcpu().
> + */
> + if (env->cpuid_vendor1 == CPUID_VENDOR_AMD_1 &&
> + env->cpuid_vendor2 == CPUID_VENDOR_AMD_2 &&
> + env->cpuid_vendor3 == CPUID_VENDOR_AMD_3 &&
> + (cs->nr_threads > 1)) {
> + error_setg(&local_err,
> + "AMD CPU doesn't support hyperthreading. Please configure "
> + "-smp options correctly.");
> + goto out;
> + }
> +
> x86_cpu_apic_realize(cpu, &local_err);
> if (local_err != NULL) {
> goto out;
>
next prev parent reply other threads:[~2014-10-07 19:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 19:17 [Qemu-devel] [PATCH 1/1] target-i386: prevent users from setting threads>1 for AMD CPUs Wei Huang
2014-10-07 19:42 ` Wei Huang [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-10-07 19:44 Wei Huang
2014-10-07 20:58 ` Paolo Bonzini
2014-10-07 21:16 ` Wei Huang
2014-10-07 21:36 ` Paolo Bonzini
2014-10-08 0:41 ` Wei Huang
2014-10-08 7:47 ` Paolo Bonzini
2014-10-09 20:22 ` Wei Huang
2014-10-09 21:08 ` Paolo Bonzini
2014-10-09 22:16 ` Eduardo Habkost
2014-10-21 15:11 ` Wei Huang
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=5434423D.8030701@redhat.com \
--to=wei@redhat.com \
--cc=afaerber@suse.de \
--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).