From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nmqzt-00019W-FM for qemu-devel@nongnu.org; Wed, 03 Mar 2010 11:00:29 -0500 Received: from [199.232.76.173] (port=40581 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nmqzt-00019L-3X for qemu-devel@nongnu.org; Wed, 03 Mar 2010 11:00:29 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nmqzr-0001JR-S7 for qemu-devel@nongnu.org; Wed, 03 Mar 2010 11:00:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24721) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nmqzr-0001JJ-Du for qemu-devel@nongnu.org; Wed, 03 Mar 2010 11:00:27 -0500 Date: Wed, 3 Mar 2010 18:00:22 +0200 From: Gleb Natapov Message-ID: <20100303160022.GG16909@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [PATCH v4 03/10] x86: Extend validity of cpu_is_bsp List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Marcelo Tosatti , Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org On Mon, Mar 01, 2010 at 06:17:22PM +0100, Jan Kiszka wrote: > As we hard-wire the BSP to CPU 0 anyway and cpuid_apic_id equals > cpu_index, cpu_is_bsp can also be based on the latter directly. This > will help an early user of it: KVM while initializing mp_state. > > Signed-off-by: Jan Kiszka > --- > hw/pc.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index b90a79e..58c32ea 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -767,7 +767,8 @@ static void pc_init_ne2k_isa(NICInfo *nd) > > int cpu_is_bsp(CPUState *env) > { > - return env->cpuid_apic_id == 0; > + /* We hard-wire the BSP to the first CPU. */ > + return env->cpu_index == 0; > } We should not assume that. The function was written like that specifically so the code around it will not rely on this assumption. Now you change that specifically to write code that will do incorrect assumptions. I don't see the logic here. > > CPUState *pc_new_cpu(const char *cpu_model) > -- > 1.6.0.2 -- Gleb.