From patchwork Fri Mar 22 11:56:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YeongKyoon Lee X-Patchwork-Id: 229973 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 CCF742C00CC for ; Fri, 22 Mar 2013 22:57:11 +1100 (EST) Received: from localhost ([::1]:57497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ0ar-0005M9-VK for incoming@patchwork.ozlabs.org; Fri, 22 Mar 2013 07:57:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ0ab-0005Lv-5n for qemu-devel@nongnu.org; Fri, 22 Mar 2013 07:56:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ0aZ-00044d-If for qemu-devel@nongnu.org; Fri, 22 Mar 2013 07:56:53 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:16011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ0aZ-00042h-8X; Fri, 22 Mar 2013 07:56:51 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MK200K8896LVSL0@mailout4.samsung.com>; Fri, 22 Mar 2013 20:56:45 +0900 (KST) X-AuditID: cbfee61b-b7f076d0000034b6-37-514c46fd3a20 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 32.8A.13494.DF64C415; Fri, 22 Mar 2013 20:56:45 +0900 (KST) Received: from localhost.localdomain ([182.198.1.3]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MK200HFP96L5L50@mmp2.samsung.com>; Fri, 22 Mar 2013 20:56:45 +0900 (KST) From: Yeongkyoon Lee To: qemu-devel@nongnu.org Date: Fri, 22 Mar 2013 20:56:52 +0900 Message-id: <1363953412-27847-1-git-send-email-yeongkyoon.lee@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t9jQd2/bj6BBhfn61jcnLaGxeLWPQGL 4707WCzmL93JYjHt1B1Wi5/TYi0m3p7K7MDu0bd0HpPHzll32T2eXNvM5NG3ZRWjR9/0D8we DfsPMQewRXHZpKTmZJalFunbJXBltKyMLmjkqTj5fDF7A+N5zi5GDg4JAROJexdVuhg5gUwx iQv31rN1MXJxCAlMZ5Q4+PIDI4TTwiTx4f18FpAqNgFDiZnnnzCB2CICkhK/u04zg9jMAtMY JZpnOoLYwgIlEt8W3WAEsVkEVCVavh5hBbF5Bbwk1n2ZyQyxWEFiziSbCYzcCxgZVjGKphYk FxQnpeca6RUn5haX5qXrJefnbmIEB8oz6R2MqxosDjEKcDAq8fBq6HgHCrEmlhVX5h5ilOBg VhLhXW3tEyjEm5JYWZValB9fVJqTWnyIUZqDRUmc92CrdaCQQHpiSWp2ampBahFMlomDU6qB cVrfR0nzW1MPhLA+MD5n5v3yfoDc08tL5tVJLnlabLnc+8WEip3pEs4czFN1i8pYpbalGm9r 0gs1ZRKdwxC3Tkyt13C6mqSTAqdPeinHH/VtwdmKHdLtbQKfW4IFJxqnum9gb5TQ64nv4jeo CZefInNh149czWunqgUWVxS++r/0fUdM/XMlluKMREMt5qLiRAA3Gs5jEAIAAA== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.254.224.34 Cc: Yeongkyoon Lee , sw@weilnetz.de, qemu-stable@nongnu.org, blauwirbel@gmail.com, aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [Qemu-stable][PATCH v2] 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 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. Signed-off-by: Yeongkyoon Lee Reviewed-by: Peter Maydell --- Here's is the promised patch with Aurelien Jarno for TCG broken problem, which is supposed to be applied to 1.3.x and 1.4.x releases as well as master. Thanks to Aurelien Jarno and Stefan Weil. translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translate-all.c b/translate-all.c index 1f3237e..72bea9b 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1308,11 +1308,11 @@ 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)tcg_ctx.code_gen_buffer && tc_ptr < (uintptr_t)(tcg_ctx.code_gen_buffer + - tcg_ctx.code_gen_buffer_max_size)); + tcg_ctx.code_gen_buffer_size)); } #endif