From patchwork Thu Mar 17 13:46:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sergey.fedorov@linaro.org X-Patchwork-Id: 8611991 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED5DCC0553 for ; Thu, 17 Mar 2016 14:50:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40CF02035E for ; Thu, 17 Mar 2016 14:50:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 933AF2026F for ; Thu, 17 Mar 2016 14:50:34 +0000 (UTC) Received: from localhost ([::1]:35477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agZFx-00082D-VU for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 10:50:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agYI6-0003Qc-U7 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 09:48:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agYI3-0008Jp-N6 for qemu-devel@nongnu.org; Thu, 17 Mar 2016 09:48:42 -0400 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:33876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agYI3-0008Jf-FP for qemu-devel@nongnu.org; Thu, 17 Mar 2016 09:48:39 -0400 Received: by mail-lf0-x229.google.com with SMTP id e138so41677655lfe.1 for ; Thu, 17 Mar 2016 06:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xIbbs0vNT63ftS3oy50LH02MMcgBUVk5X/xD+r6ewZ0=; b=Cay7R8uX2fHF9jRnW8JaF3uZrCNX+yRZW6/bisllx92HSCmFZpHc48j35H4vppalN5 a8UbhDwkvrP1NibHxW52mzNHikGLuThE3Ex4R/MyjMkf2B7IX/2hqF+mXu9QOkO2TYNC xmiiR+LZP5Dhp4cQS1UKUASUxXc3m02085LpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xIbbs0vNT63ftS3oy50LH02MMcgBUVk5X/xD+r6ewZ0=; b=bnEfHzqEPPCeXHF//O+bMX0qAnJPtvJGYFaHhA3R3OPvD47jfjlEQeqj9RjooMdWM3 mPmbFYj64i2pVjYV6nm5aS+zaELTE4ylcNlFgHhOOzZXN7VytLrS0v01EIdTDohF/wQ+ xedH0BAWOwnD1EOcFKBRvDPVT77NYyDnERsye58o/EOIdy1wfgGoWmu7Y6c1DggPns1/ 6ILQR3fdNQUe1j/6kWj3WtPWG3ISZOO6aN8bsqR3IXVOvhcBbPHi8kvBS468RhgLlEIf 2kcTRpOE6Udqepb+4LOhm32IIHmivOtWuYK2YSwvg+gcA86dnGqAsgD7Uxzpdat+A29z HI3Q== X-Gm-Message-State: AD7BkJLIZMd2wbZMO2zf64CwONHmRQRwdpWk0yI6hl2TGU+a6RiC5nVsOvmF/9Tpx7cEZqcu X-Received: by 10.25.10.1 with SMTP id 1mr2339548lfk.65.1458222518703; Thu, 17 Mar 2016 06:48:38 -0700 (PDT) Received: from localhost.localdomain ([89.208.20.115]) by smtp.gmail.com with ESMTPSA id wj2sm1371399lbb.5.2016.03.17.06.48.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Mar 2016 06:48:37 -0700 (PDT) From: sergey.fedorov@linaro.org To: qemu-devel@nongnu.org Date: Thu, 17 Mar 2016 16:46:20 +0300 Message-Id: <1458222382-6498-4-git-send-email-sergey.fedorov@linaro.org> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458222382-6498-1-git-send-email-sergey.fedorov@linaro.org> References: <1458222382-6498-1-git-send-email-sergey.fedorov@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::229 X-Mailman-Approved-At: Thu, 17 Mar 2016 10:44:16 -0400 Cc: Sergey Fedorov , Richard Henderson , Peter Crosthwaite , Sergey Fedorov , Paolo Bonzini Subject: [Qemu-devel] [PATCH 3/5] tcg: always keep jump target and tb->jmp_next consistent 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Simple code simplification. Signed-off-by: Paolo Bonzini Signed-off-by: Sergey Fedorov --- translate-all.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/translate-all.c b/translate-all.c index f17ace1ae899..a1ac9841de48 100644 --- a/translate-all.c +++ b/translate-all.c @@ -927,6 +927,14 @@ static inline void tb_page_remove(TranslationBlock **ptb, TranslationBlock *tb) } } +/* reset the jump entry 'n' of a TB so that it is not chained to + another TB */ +static inline void tb_reset_jump(TranslationBlock *tb, int n) +{ + tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n])); + tb->jmp_next[n] = NULL; +} + static inline void tb_jmp_remove(TranslationBlock *tb, int n) { TranslationBlock *tb1, **ptb; @@ -951,18 +959,10 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) } /* now we can suppress tb(n) from the list */ *ptb = tb->jmp_next[n]; - - tb->jmp_next[n] = NULL; + tb_reset_jump(tb, n); } } -/* reset the jump entry 'n' of a TB so that it is not chained to - another TB */ -static inline void tb_reset_jump(TranslationBlock *tb, int n) -{ - tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n])); -} - /* invalidate one TB */ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) { @@ -1013,7 +1013,6 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) tb1 = (TranslationBlock *)((uintptr_t)tb1 & ~3); tb2 = tb1->jmp_next[n1]; tb_reset_jump(tb1, n1); - tb1->jmp_next[n1] = NULL; tb1 = tb2; } tb->jmp_first = (TranslationBlock *)((uintptr_t)tb | 2); /* fail safe */