From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za6D8-0008HW-MB for qemu-devel@nongnu.org; Thu, 10 Sep 2015 14:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Za6D5-0002dd-GX for qemu-devel@nongnu.org; Thu, 10 Sep 2015 14:04:38 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:48839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za6D5-0002dZ-Cr for qemu-devel@nongnu.org; Thu, 10 Sep 2015 14:04:35 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 51FD720930 for ; Thu, 10 Sep 2015 14:04:33 -0400 (EDT) Date: Thu, 10 Sep 2015 14:05:11 -0400 From: "Emilio G. Cota" Message-ID: <20150910180511.GD17236@flamenco> References: <1440375847-17603-1-git-send-email-cota@braap.org> <1440375847-17603-20-git-send-email-cota@braap.org> <87twr28drp.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87twr28drp.fsf@linaro.org> Subject: Re: [Qemu-devel] [RFC 19/38] tcg: add tcg_gen_smp_rmb() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, Frederic Konrad On Thu, Sep 10, 2015 at 17:01:14 +0100, Alex Bennée wrote: > > Emilio G. Cota writes: > > > Signed-off-by: Emilio G. Cota > > --- > > tcg/tcg-op.h | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h > > index 52482c0..3ec9f13 100644 > > --- a/tcg/tcg-op.h > > +++ b/tcg/tcg-op.h > > @@ -716,6 +716,16 @@ static inline void tcg_gen_fence_full(void) > > tcg_gen_op0(&tcg_ctx, INDEX_op_fence_full); > > } > > > > +#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__) > > +static inline void tcg_gen_smp_rmb(void) > > +{ } > > +#else > > +static inline void tcg_gen_smp_rmb(void) > > +{ > > + tcg_gen_fence_load(); > > +} > > +#endif > > This seems a little pointless wrapping up tcg_gen_fence_load. Could the > magic dealing with the backend not be done with something like > TCG_TARGET_HAS_fence_load. On the x86/x86_64 backends this could then > NOP away. This patch made sense at the time as a companion to this other patch: cpu: add barriers around cpu->tcg_exit_req (snip) +++ b/include/exec/gen-icount.h @@ -16,6 +16,7 @@ static inline void gen_tb_start(TranslationBlock *tb) exitreq_label = gen_new_label(); flag = tcg_temp_new_i32(); + tcg_gen_smp_rmb(); tcg_gen_ld_i32(flag, cpu_env, offsetof(CPUState, tcg_exit_req) - ENV_OFFSET); tcg_gen_brcondi_i32(TCG_COND_NE, flag, 0, exitreq_label); Paolo had the better idea of calling smp_rmb() once we've exited TCG, which renders tcg_gen_smp_rmb() unnecessary. Emilio