From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atflT-0007pH-VT for qemu-devel@nongnu.org; Fri, 22 Apr 2016 14:25:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atflQ-0000P0-PY for qemu-devel@nongnu.org; Fri, 22 Apr 2016 14:25:15 -0400 Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:36029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atflQ-0000Ow-LR for qemu-devel@nongnu.org; Fri, 22 Apr 2016 14:25:12 -0400 Received: by mail-qk0-x230.google.com with SMTP id x7so41423045qkd.3 for ; Fri, 22 Apr 2016 11:25:12 -0700 (PDT) Sender: Richard Henderson References: <1461283583-2833-1-git-send-email-cota@braap.org> From: Richard Henderson Message-ID: <571A6C85.5020707@twiddle.net> Date: Fri, 22 Apr 2016 11:25:09 -0700 MIME-Version: 1.0 In-Reply-To: <1461283583-2833-1-git-send-email-cota@braap.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] translate-all: protect code_gen_buffer with RCU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Peter Crosthwaite , Sergey Fedorov On 04/21/2016 05:06 PM, Emilio G. Cota wrote: > #ifdef USE_STATIC_CODE_GEN_BUFFER > -static uint8_t static_code_gen_buffer[DEFAULT_CODE_GEN_BUFFER_SIZE] > +static uint8_t static_code_gen_buffer1[DEFAULT_CODE_GEN_BUFFER_SIZE] > __attribute__((aligned(CODE_GEN_ALIGN))); > +static uint8_t static_code_gen_buffer2[DEFAULT_CODE_GEN_BUFFER_SIZE] > + __attribute__((aligned(CODE_GEN_ALIGN))); > +static int static_buf_mask = 1; > +static void *static_buf1; > +static void *static_buf2; I don't like this at all. (1) This is (by default) 32MB we're adding to the RSS of the simulator. Surely we can do better than this. (2) On some hosts we require a maximum displacement from any point in the code gen buffer from the tcg prologue. That means you can't simply allocate two separate buffers. You have to take a single buffer, of known good size and alignment, and split it in half. r~