From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44361 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQpFW-0004Xq-PP for qemu-devel@nongnu.org; Mon, 21 Jun 2010 18:13:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQpFV-0006gF-Iu for qemu-devel@nongnu.org; Mon, 21 Jun 2010 18:13:50 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:45551) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQpFV-0006fv-3B for qemu-devel@nongnu.org; Mon, 21 Jun 2010 18:13:49 -0400 Message-ID: <4C1FE40C.3070506@web.de> Date: Tue, 22 Jun 2010 00:13:32 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4C1BA0B4.2010803@siemens.com> <4C1BCEB0.6050601@codemonkey.ws> <20100621193123.GA14083@amt.cnet> <4C1FCABA.3060207@web.de> In-Reply-To: <4C1FCABA.3060207@web.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigE09BAAB1C80856716522CA79" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] fix smp with tcg mode and --enable-io-thread List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Glauber Costa , qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE09BAAB1C80856716522CA79 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jan Kiszka wrote: > And there is some race that cause a lock up in qemu_mutex_lock_iothread= > after a while (the cpu_unlink_tb seems to race with the linking - just = a > guess so far). This seems to fix a long-standing race between cpu_exec and signal-driven cpu_unlink_tb: diff --git a/cpu-exec.c b/cpu-exec.c index 026980a..bfc34e4 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -599,8 +598,9 @@ int cpu_exec(CPUState *env1) TB, but before it is linked into a potentially infinite loop and becomes env->current_tb. Avoid starting execution if there is a pending interrupt. *= / - if (!unlikely (env->exit_request)) { - env->current_tb =3D tb; + env->current_tb =3D tb; + asm(""); + if (likely(!env->exit_request)) { tc_ptr =3D tb->tc_ptr; /* execute the generated code */ #if defined(__sparc__) && !defined(CONFIG_SOLARIS) @@ -609,7 +609,6 @@ int cpu_exec(CPUState *env1) #define env cpu_single_env #endif next_tb =3D tcg_qemu_tb_exec(tc_ptr); - env->current_tb =3D NULL; if ((next_tb & 3) =3D=3D 2) { /* Instruction counter expired. */ int insns_left; @@ -638,6 +637,7 @@ int cpu_exec(CPUState *env1) } } } + env->current_tb =3D NULL; /* reset soft MMU for next block (it can currently only be set by a memory fault) */ } /* for(;;) */ Still testing, though. Jan --------------enigE09BAAB1C80856716522CA79 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 iEYEARECAAYFAkwf5BoACgkQitSsb3rl5xRrAwCgzTbKryxug1O6ESGQbnBmXfGT ah4An0u4zTivaTzc/b+OOnRFIhL6FS8r =LOyI -----END PGP SIGNATURE----- --------------enigE09BAAB1C80856716522CA79--