From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwWkF-0007ID-Bt for qemu-devel@nongnu.org; Thu, 25 Aug 2011 06:01:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwWkE-0001Sx-BP for qemu-devel@nongnu.org; Thu, 25 Aug 2011 06:01:07 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:56010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwWkE-0001Sq-2k for qemu-devel@nongnu.org; Thu, 25 Aug 2011 06:01:06 -0400 Date: Thu, 25 Aug 2011 06:01:03 -0400 (EDT) From: Avi Kivity Message-ID: <1820735632.3145704.1314266463491.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] X86 CPU topology broken in qemu ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org > Hi, > > I see that x86 CPU topology inside VM is not showing up as specified. > With some debugging, I found out that the root cause for this: qemu is > not enumerating the apic ids correctly for vcpus. I made the below > hackish change to get it working. Has anybody else seen this problem > ? This patch is on qemu-kvm-0.14.1. Using 2.6.39 for guest. > > *************************** > Fix apic id enumeration > > apic id returned to guest kernel in ebx for cpuid(function=1) depends > on > CPUX86State->cpuid_apic_id which gets populated after the cpuid > information > is cached in the host kernel. > > Fix this by setting cpuid_apic_id before cpuid information is passed > to > the host kernel. > > Index: qemu-kvm-0.14.1/hw/pc.c > =================================================================== > --- qemu-kvm-0.14.1.orig/hw/pc.c > +++ qemu-kvm-0.14.1/hw/pc.c Please post a patch against qemu.git master branch. > > + if (env->cpuid_features & CPUID_APIC) > + env->cpuid_apic_id = env->cpu_index; > + qemu coding style requires braces even around single statements in if () blocks.