From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1auwan-0006DI-Qe for qemu-devel@nongnu.org; Tue, 26 Apr 2016 02:35:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1auwaj-0003a6-1d for qemu-devel@nongnu.org; Tue, 26 Apr 2016 02:35:29 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:36997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1auwai-0003a2-Qx for qemu-devel@nongnu.org; Tue, 26 Apr 2016 02:35:24 -0400 Received: by mail-wm0-x229.google.com with SMTP id n3so16138769wmn.0 for ; Mon, 25 Apr 2016 23:35:24 -0700 (PDT) References: <20160425152528.GA16402@flamenco> <1461627983-32563-1-git-send-email-cota@braap.org> <8b49fdbb-fe67-ce03-c288-f31b4f34af8b@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <8b49fdbb-fe67-ce03-c288-f31b4f34af8b@twiddle.net> Date: Tue, 26 Apr 2016 07:35:23 +0100 Message-ID: <87r3dsev2s.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v3] translate-all: protect code_gen_buffer with RCU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: "Emilio G. Cota" , QEMU Developers , MTTCG Devel , Paolo Bonzini , Peter Crosthwaite , Sergey Fedorov Richard Henderson writes: > On 04/25/2016 04:46 PM, Emilio G. Cota wrote: >> + /* >> + * write the prologue into buf2. This is safe because we'll later call >> + * tcg_prologue_init on buf1, from which we'll start execution. >> + */ >> + tcg_ctx.code_gen_buffer = code_gen_buf2; >> + tcg_prologue_init(&tcg_ctx); >> + > > Ah, no. Write only one prologue, not one per buffer. > > If they're sufficiently close (i.e. one allocation under the max size), > then the same one can be used for both halves. > > The global variables that you didn't see in this revision are: > > aarch64/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > arm/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > i386/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ia64/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ia64/tcg-target.inc.c: tcg_insn_unit *thunks[8] = { }; > mips/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > ppc/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > s390/tcg-target.inc.c:static tcg_insn_unit *tb_ret_addr; > sparc/tcg-target.inc.c:static tcg_insn_unit *qemu_ld_trampoline[16]; > sparc/tcg-target.inc.c:static tcg_insn_unit *qemu_st_trampoline[16]; Aside from the existing code structure is there any reason to have only one prologue? It doesn't seem to be a large amount of code and in the case of having smaller translation regions I would posit having a "local" prologue/epilogue would make the jumps cheaper. > > > r~ -- Alex Bennée