From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v4 03/10] x86: Extend validity of cpu_is_bsp Date: Thu, 04 Mar 2010 00:34:22 +0100 Message-ID: <4B8EF1FE.7020000@web.de> References: <20100303160022.GG16909@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9EBAA8660FA784658E8834C2" Cc: Avi Kivity , Marcelo Tosatti , kvm@vger.kernel.org, qemu-devel@nongnu.org To: Gleb Natapov Return-path: Received: from fmmailgate02.web.de ([217.72.192.227]:53450 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753215Ab0CCXew (ORCPT ); Wed, 3 Mar 2010 18:34:52 -0500 In-Reply-To: <20100303160022.GG16909@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9EBAA8660FA784658E8834C2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gleb Natapov wrote: > 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) >> =20 >> int cpu_is_bsp(CPUState *env) >> { >> - return env->cpuid_apic_id =3D=3D 0; >> + /* We hard-wire the BSP to the first CPU. */ >> + return env->cpu_index =3D=3D 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. The logic is that we do not support any other mapping yet - with or without this change. Without it, we complicate the APIC initialization for (so far) no good reason. Once we want to support different BSP assignments, we need to go through the code and rework some parts anyway.= Jan --------------enig9EBAA8660FA784658E8834C2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkuO8gsACgkQitSsb3rl5xS+/wCfV99Rqdm+GULibWNcQcxQLbRb fvMAmwSHkMOgMUxH31e0ZCnitZ0sNsiu =gbwD -----END PGP SIGNATURE----- --------------enig9EBAA8660FA784658E8834C2-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nmy5g-0004VN-58 for qemu-devel@nongnu.org; Wed, 03 Mar 2010 18:34:56 -0500 Received: from [199.232.76.173] (port=33293 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nmy5f-0004VC-QH for qemu-devel@nongnu.org; Wed, 03 Mar 2010 18:34:55 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nmy5e-0006hM-Ef for qemu-devel@nongnu.org; Wed, 03 Mar 2010 18:34:55 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:53457) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nmy5d-0006hE-Tp for qemu-devel@nongnu.org; Wed, 03 Mar 2010 18:34:54 -0500 Message-ID: <4B8EF1FE.7020000@web.de> Date: Thu, 04 Mar 2010 00:34:22 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <20100303160022.GG16909@redhat.com> In-Reply-To: <20100303160022.GG16909@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9EBAA8660FA784658E8834C2" Sender: jan.kiszka@web.de 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: Gleb Natapov Cc: Marcelo Tosatti , Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9EBAA8660FA784658E8834C2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Gleb Natapov wrote: > 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) >> =20 >> int cpu_is_bsp(CPUState *env) >> { >> - return env->cpuid_apic_id =3D=3D 0; >> + /* We hard-wire the BSP to the first CPU. */ >> + return env->cpu_index =3D=3D 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. The logic is that we do not support any other mapping yet - with or without this change. Without it, we complicate the APIC initialization for (so far) no good reason. Once we want to support different BSP assignments, we need to go through the code and rework some parts anyway.= Jan --------------enig9EBAA8660FA784658E8834C2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkuO8gsACgkQitSsb3rl5xS+/wCfV99Rqdm+GULibWNcQcxQLbRb fvMAmwSHkMOgMUxH31e0ZCnitZ0sNsiu =gbwD -----END PGP SIGNATURE----- --------------enig9EBAA8660FA784658E8834C2--