Received: from eggs.gnu.org ([2001:4830:134:3::10]:57657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqyqy-0000rs-2R for qemu-devel@nongnu.org; Mon, 03 Oct 2016 04:44:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqyqx-0005Sr-75 for qemu-devel@nongnu.org; Mon, 03 Oct 2016 04:44:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqyqx-0005Qa-0Q for qemu-devel@nongnu.org; Mon, 03 Oct 2016 04:44:03 -0400 References: <20160930213106.20186-1-alex.bennee@linaro.org> <20160930213106.20186-14-alex.bennee@linaro.org> From: Paolo Bonzini Message-ID: Date: Mon, 3 Oct 2016 10:43:50 +0200 MIME-Version: 1.0 In-Reply-To: <20160930213106.20186-14-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 13/15] tcg: ensure cpu_tb_exec/tb_gen_code use atomic_read/write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , qemu-devel@nongnu.org Cc: mttcg@greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com, mark.burton@greensocs.com, jan.kiszka@siemens.com, serge.fdrv@gmail.com, rth@twiddle.net, peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite On 30/09/2016 23:31, Alex Benn=C3=A9e wrote: > tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(p= c)]); > - if (unlikely(!tb || tb->pc !=3D pc || tb->cs_base !=3D cs_base || > - tb->flags !=3D flags)) { > + if (unlikely(!tb || atomic_read(&tb->pc) !=3D pc || atomic_read(&t= b->cs_base) !=3D cs_base || > + atomic_read(&tb->flags) !=3D flags)) { This should not be necessary (and is responsible for the 64-on-32 compilation failure). The load of tb from the cache is an acquire operation, and synchronizes with the corresponding store in cpu->tb_jmp_cache. Paolo