From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agxf7-0001TK-PX for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:54:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agxf4-0006Wl-ID for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:54:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agxf4-0006Wh-CR for qemu-devel@nongnu.org; Fri, 18 Mar 2016 12:54:06 -0400 References: <1458317932-1875-1-git-send-email-alex.bennee@linaro.org> <1458317932-1875-2-git-send-email-alex.bennee@linaro.org> From: Paolo Bonzini Message-ID: <56EC32A8.9020903@redhat.com> Date: Fri, 18 Mar 2016 17:54:00 +0100 MIME-Version: 1.0 In-Reply-To: <1458317932-1875-2-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v1 01/11] tcg: move tb_find_fast outside the tb_lock critical section List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , mttcg@greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, serge.fdrv@gmail.com, cota@braap.org Cc: Richard Henderson , mark.burton@greensocs.com, qemu-devel@nongnu.org, =?UTF-8?Q?Andreas_F=c3=a4rber?= , Peter Crosthwaite On 18/03/2016 17:18, Alex Benn=C3=A9e wrote: > -#endif > - > - /* if no translated code available, then translate it now */ > - cpu->tb_invalidated_flag =3D 0; Moving this reset from here... > - if (cpu->tb_invalidated_flag) { > + if (atomic_read(&cpu->tb_invalidated_flag)) { > /* as some TB could have been invalidated because > of a tb_flush while generating the code, we > must recompute the hash index here */ > next_tb =3D 0; > + > + /* Clear the flag, we've now observed the flush. = */ > + tb_lock_recursive(); > + cpu->tb_invalidated_flag =3D 0; > } ... to here probably can be anticipated to Sergey's (my? :D) "make tb_invalidated_flag per-CPU" patch. Then this patch can just add the tb_lock_recursive. Paolo