From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rw9r5-0007xK-6u for qemu-devel@nongnu.org; Sat, 11 Feb 2012 05:06:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rw9r3-0007ai-FK for qemu-devel@nongnu.org; Sat, 11 Feb 2012 05:06:55 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:56980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rw9r3-0007aH-7J for qemu-devel@nongnu.org; Sat, 11 Feb 2012 05:06:53 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate02.web.de (Postfix) with ESMTP id B94751C0FDD61 for ; Sat, 11 Feb 2012 11:06:46 +0100 (CET) Message-ID: <4F363DB2.3080908@web.de> Date: Sat, 11 Feb 2012 11:06:42 +0100 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7F57BEFC2048A6A92C47F79F" Subject: Re: [Qemu-devel] [PATCH v2 1/8] kvm: Set cpu_single_env only once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Anthony Liguori , kvm@vger.kernel.org, Gleb Natapov , Marcelo Tosatti , qemu-devel , Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7F57BEFC2048A6A92C47F79F Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2012-02-11 11:02, Blue Swirl wrote: > On Fri, Feb 10, 2012 at 18:31, Jan Kiszka wrot= e: >> As we have thread-local cpu_single_env now and KVM uses exactly one >> thread per VCPU, we can drop the cpu_single_env updates from the loop >> and initialize this variable only once during setup. >=20 > I don't think this is correct. Maybe you missed the part that sets > cpu_single_env to NULL, which I think is to annoy broken code that > assumes that some CPU state is always globally available. This is not > true for monitor context. I did check this before changing, and I see no such need. Particularly as this old debugging help prevents valid use case. Jan >=20 >> Signed-off-by: Jan Kiszka >> --- >> cpus.c | 1 + >> kvm-all.c | 5 ----- >> 2 files changed, 1 insertions(+), 5 deletions(-) >> >> diff --git a/cpus.c b/cpus.c >> index f45a438..d0c8340 100644 >> --- a/cpus.c >> +++ b/cpus.c >> @@ -714,6 +714,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) >> qemu_mutex_lock(&qemu_global_mutex); >> qemu_thread_get_self(env->thread); >> env->thread_id =3D qemu_get_thread_id(); >> + cpu_single_env =3D env; >> >> r =3D kvm_init_vcpu(env); >> if (r < 0) { >> diff --git a/kvm-all.c b/kvm-all.c >> index c4babda..e2cbc03 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -1118,8 +1118,6 @@ int kvm_cpu_exec(CPUState *env) >> return EXCP_HLT; >> } >> >> - cpu_single_env =3D env; >> - >> do { >> if (env->kvm_vcpu_dirty) { >> kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE); >> @@ -1136,13 +1134,11 @@ int kvm_cpu_exec(CPUState *env) >> */ >> qemu_cpu_kick_self(); >> } >> - cpu_single_env =3D NULL; >> qemu_mutex_unlock_iothread(); >> >> run_ret =3D kvm_vcpu_ioctl(env, KVM_RUN, 0); >> >> qemu_mutex_lock_iothread(); >> - cpu_single_env =3D env; >> kvm_arch_post_run(env, run); >> >> kvm_flush_coalesced_mmio_buffer(); >> @@ -1206,7 +1202,6 @@ int kvm_cpu_exec(CPUState *env) >> } >> >> env->exit_request =3D 0; >> - cpu_single_env =3D NULL; >> return ret; >> } >> >> -- >> 1.7.3.4 >> >> >=20 >=20 --------------enig7F57BEFC2048A6A92C47F79F 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.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk82PbUACgkQitSsb3rl5xRQfQCeLkWhGH4tR6ZPVRwRZehLZGkj wnAAnjEuI4ak6Noph52MTfX7V2JCFIU7 =qL8m -----END PGP SIGNATURE----- --------------enig7F57BEFC2048A6A92C47F79F--