From patchwork Tue Dec 1 16:19:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 550959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C6DBC14016A for ; Wed, 2 Dec 2015 03:20:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=O1EZ5vcD; dkim-atps=neutral Received: from localhost ([::1]:53540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3nfF-0007WL-Jp for incoming@patchwork.ozlabs.org; Tue, 01 Dec 2015 11:20:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3nev-0007Am-9N for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:20:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3ner-0006dd-Af for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:20:05 -0500 Received: from mail-qg0-x230.google.com ([2607:f8b0:400d:c04::230]:36063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3ner-0006dZ-6K for qemu-devel@nongnu.org; Tue, 01 Dec 2015 11:20:01 -0500 Received: by qgcc31 with SMTP id c31so8886991qgc.3 for ; Tue, 01 Dec 2015 08:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=5vnGXOJTSm4N3XGTSoBRlRbz5t/F598Ra31jng6AfTY=; b=O1EZ5vcDQQxx+bQV5aMEYPbJod/ZFB+M0H2WBhbT5fvuJt5c0Kiv8MpRGomL57IpYd TwT1W4pbgJ7HQmFjvHQ3jZOGaFDLFYkF9XZVK/I6i1RMYQQEFzCDou5IBYalKTZYvHaf afAT+HG9DTBVwsVpZAvEymcV86G965nRnlyfAom77WGfaPwY2wbLsOXpY13Ouz5Y5pbB 6BtartPrW+/cVDzHYEvFyOYd1QbQtm2UUr56KK4LQUQ/6JcUL4DIzraucE2UQHd1sX4A dQSCjmJIxfO0d/rZLhlxB0wWVuWKKh4wt5Bwhut3xRzGJ6vCOyRLpqBanrrfhcYijGTh XKIg== X-Received: by 10.140.239.87 with SMTP id k84mr90554264qhc.87.1448986800767; Tue, 01 Dec 2015 08:20:00 -0800 (PST) Received: from bigtime.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id u135sm13264920qka.22.2015.12.01.08.19.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Dec 2015 08:20:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 1 Dec 2015 08:19:27 -0800 Message-Id: <1448986767-28016-1-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c04::230 Cc: peter.maydell@linaro.org, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH for-2.5] tcg: Increase the highwater reservation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If there are a lot of guest memory ops in the TB, the amount of code generated by tcg_out_tb_finalize could be well more than 1k. In the short term, increase the reservation larger than any TB seen in practice. Reported-by: Aurelien Jarno Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno Tested-by: Aurelien Jarno --- Reported and discussed with Aurelien on IRC yesterday. This seems to be the easiest fix for the upcoming release. I will fix this properly (by modifying every backend's finalize routines) for 2.6. r~ --- tcg/tcg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index b20ed19..a163541 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -388,7 +388,11 @@ void tcg_prologue_init(TCGContext *s) /* Compute a high-water mark, at which we voluntarily flush the buffer and start over. The size here is arbitrary, significantly larger than we expect the code generation for any one opcode to require. */ - s->code_gen_highwater = s->code_gen_buffer + (total_size - 1024); + /* ??? We currently have no good estimate for, or checks in, + tcg_out_tb_finalize. If there are quite a lot of guest memory ops, + the number of out-of-line fragments could be quite high. In the + short-term, increase the highwater buffer. */ + s->code_gen_highwater = s->code_gen_buffer + (total_size - 64*1024); tcg_register_jit(s->code_gen_buffer, total_size);