From patchwork Tue Apr 2 21:45:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 233166 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA6E42C016A for ; Wed, 3 Apr 2013 09:02:20 +1100 (EST) Received: from localhost ([::1]:54021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN9HW-0006hp-T6 for incoming@patchwork.ozlabs.org; Tue, 02 Apr 2013 18:02:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN97P-0000CD-3P for qemu-devel@nongnu.org; Tue, 02 Apr 2013 17:51:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN97N-0000Mz-RJ for qemu-devel@nongnu.org; Tue, 02 Apr 2013 17:51:50 -0400 Received: from mail-ye0-f173.google.com ([209.85.213.173]:46980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN97N-0000Mu-NH; Tue, 02 Apr 2013 17:51:49 -0400 Received: by mail-ye0-f173.google.com with SMTP id q5so139263yen.4 for ; Tue, 02 Apr 2013 14:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=Wwp9c34m72nQMS0kmJlvZEJB2O6TUpIO0+Ep9f9NCc8=; b=OMmMg6N5s+0zmX8sSuxLq7gLSpNoHf0uMjt49k9X2iboRUeB1mFutM7oyeHsK1HXUN Md+oqcUpcH69xLxLEW3U5wdbvwnTOznMFYZ0uLNbW5JZIqeZd9mb7LuQcHOcFFfCDcTh yeKK+ov6gdx1L1/Ay10OjGpEScf3w9qRaG3zH+o64aonob4MYyzpppyn99fAVpLzlNip DpZthODxacWEbziPtsnWYu0uIRUAeN3uMqO11wDYgX1Dd0D0fkOG4/0dK2/7eZx/Ww0F eY0xiDtkkS22FdLD/95tH76m8XVHJxgpnTP+8uk/rJXjdnDB9OSLkmGaWc2WgTwl3a4z V3Sg== X-Received: by 10.236.142.171 with SMTP id i31mr16247749yhj.85.1364939509239; Tue, 02 Apr 2013 14:51:49 -0700 (PDT) Received: from localhost ([32.97.110.51]) by mx.google.com with ESMTPS id f70sm5759837yhi.12.2013.04.02.14.51.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 02 Apr 2013 14:51:48 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2013 16:45:26 -0500 Message-Id: <1364939142-30066-22-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364939142-30066-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1364939142-30066-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.213.173 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 21/37] tcg: Fix occasional TCG broken problem when ldst optimization enabled 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 From: Yeongkyoon Lee is_tcg_gen_code() checks the upper limit of TCG generated code range wrong, so that TCG could get broken occasionally only when CONFIG_QEMU_LDST_OPTIMIZATION enabled. The reason is code_gen_buffer_max_size does not cover the upper range up to (TCG_MAX_OP_SIZE * OPC_BUF_SIZE), thus code_gen_buffer_max_size should be modified to code_gen_buffer_size. CC: qemu-stable@nongnu.org Signed-off-by: Yeongkyoon Lee Reviewed-by: Peter Maydell Signed-off-by: Aurelien Jarno (cherry picked from commit 52ae646d4a3ebdcdcc973492c6a56f2c49b6578f) Conflicts: translate-all.c *modified to use non-tcg-ctx version of code_gen_* variables Signed-off-by: Michael Roth --- translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translate-all.c b/translate-all.c index d367fc4..bf1db09 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1310,10 +1310,10 @@ static void tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, /* check whether the given addr is in TCG generated code buffer or not */ bool is_tcg_gen_code(uintptr_t tc_ptr) { - /* This can be called during code generation, code_gen_buffer_max_size + /* This can be called during code generation, code_gen_buffer_size is used instead of code_gen_ptr for upper boundary checking */ return (tc_ptr >= (uintptr_t)code_gen_buffer && - tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_max_size)); + tc_ptr < (uintptr_t)(code_gen_buffer + code_gen_buffer_size)); } #endif