Received: from eggs.gnu.org ([2001:4830:134:3::10]:46499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgbVH-000532-Pf for qemu-devel@nongnu.org; Tue, 21 Oct 2014 11:37:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgbVB-00013h-3D for qemu-devel@nongnu.org; Tue, 21 Oct 2014 11:37:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgbVA-00013S-RR for qemu-devel@nongnu.org; Tue, 21 Oct 2014 11:37:37 -0400 Date: Tue, 21 Oct 2014 13:37:32 -0200 From: Eduardo Habkost Message-ID: <20141021153732.GB19316@thinpad.lan.raisama.net> References: <1413903645-12035-1-git-send-email-wei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1413903645-12035-1-git-send-email-wei@redhat.com> Subject: Re: [Qemu-devel] [PATCH] target-i386: warns users when CPU threads>1 for AMD CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Huang Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de On Tue, Oct 21, 2014 at 11:00:45AM -0400, Wei Huang wrote: > No AMD CPUs support hyperthreading. When users select threads>1 in > -smp option, QEMU fixes it by adjusting CPUID_0000_0001_EBX and > CPUID_8000_0008_ECX based on inputs (sockets, cores, threads); > so guest VM can boot correctly. However it is still better to gives > users a warning when such case happens. > > Signed-off-by: Wei Huang > --- [...] > @@ -2742,6 +2745,20 @@ 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 fixes > + * this issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX > + * based on inputs (sockets,cores,threads), it is still better to gives > + * users a warning. > + * > + * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise > + * cs->nr_threads hasn't be populated yet and the checking is incorrect. > + */ > + if (IS_AMD_CPU(env) && (cs->nr_threads > 1) && !ht_warned) { We set CmpLegacy for all non-Intel CPU vendors (and that's what makes Linux guests ignore HT). So I believe we should warn if !IS_INTEL_CPU(env) instead of just when it's AMD. > + error_report("AMD CPU doesn't support hyperthreading. Please configure" > + " -smp options properly."); > + ht_warned = true; > + } > + > x86_cpu_apic_realize(cpu, &local_err); > if (local_err != NULL) { > goto out; > -- > 1.8.3.1 > -- Eduardo