From patchwork Fri Jul 15 17:58:42 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: 9232389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9B3C60574 for ; Fri, 15 Jul 2016 17:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82CDE264FB for ; Fri, 15 Jul 2016 17:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 759EC27F8F; Fri, 15 Jul 2016 17:59:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id BDE3F27C39 for ; Fri, 15 Jul 2016 17:59:40 +0000 (UTC) Received: from localhost ([::1]:34120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO7Ok-0002Wq-P4 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jul 2016 13:59:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO7OC-0002TF-M9 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:59:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO7OA-0006yr-IF for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:59:03 -0400 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:34581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO7OA-0006ym-9m for qemu-devel@nongnu.org; Fri, 15 Jul 2016 13:59:02 -0400 Received: by mail-lf0-x232.google.com with SMTP id l69so36596290lfg.1 for ; Fri, 15 Jul 2016 10:59:02 -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=oYLxmj3xiDJFJ0j3SfsmPmZFAXefeukpril/dFeW9cw=; b=frlQWXSq2S6K0G/9zAbIusSK84OxvZWsZYgpy3Mm2HxPOSmhbHFmdVX6goThMZ23FP nfO7US9kq2nk/AEAThF8TJ3fkrWtIhuslKjne0G9Ej+KGpEBi8uUTBRpNJOYHwDQ+5LV Een3lGaenjRWhv7Q8jnQBsPrezMbcE7hfz6yg= 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=oYLxmj3xiDJFJ0j3SfsmPmZFAXefeukpril/dFeW9cw=; b=NjbcxckZdtQUk5D3sMI8V6K+RxFatC2lAcHhBIAwO7aZ48RcMrI07LFaZt2h4WWAcZ EDO+QvZb/PJKnlRivPplxpeO+56PRyXsO8bsUik/W4cKr1z7hIm3CRm+vgjipmRF7NpL zlonBPqSSY7xpZE9QChXbYDrwpkH+8EGeXKEuR0Zs1+IyV501tZA3nLXdvC9L9FV2CiS iGLBJrkh/fiABsCofG3n0/f13b4Vp0eBHgA7/wU0N9QXw5ZROASyegFcILiUaYicpWs6 3OctJPzVXUUq4mD9dZWgVvv21RB5Ejkdj3R5Fl87mHc/qWzYSYkEmsZkqLeX4fYUKhMx VR6w== X-Gm-Message-State: ALyK8tKqjkoe2iiWeD3rVQWMjdoIZPdyJbTcZ0sUpKVEIC6ptpO+U3K/QRUM1TfC44M0lMWg X-Received: by 10.25.159.10 with SMTP id i10mr283700lfe.131.1468605541398; Fri, 15 Jul 2016 10:59:01 -0700 (PDT) Received: from sergey-laptop.Dlink (broadband-46-188-120-37.2com.net. [46.188.120.37]) by smtp.gmail.com with ESMTPSA id g193sm2113268lfb.14.2016.07.15.10.59.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jul 2016 10:59:00 -0700 (PDT) From: Sergey Fedorov To: qemu-devel@nongnu.org Date: Fri, 15 Jul 2016 20:58:42 +0300 Message-Id: <20160715175852.30749-3-sergey.fedorov@linaro.org> X-Mailer: git-send-email 2.9.1 In-Reply-To: <20160715175852.30749-1-sergey.fedorov@linaro.org> References: <20160715175852.30749-1-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::232 Subject: [Qemu-devel] [PATCH v4 02/12] tcg: Pass last_tb by value to tb_find_fast() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, Sergey Fedorov , patches@linaro.org, jan.kiszka@siemens.com, Peter Crosthwaite , mark.burton@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, pbonzini@redhat.com, Sergey Fedorov , bobby.prani@gmail.com, rth@twiddle.net, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sergey Fedorov This is a small clean up. tb_find_fast() is a final consumer of this variable so no need to pass it by reference. 'last_tb' is always updated by subsequent cpu_loop_exec_tb() in cpu_exec(). This change also simplifies calling cpu_exec_nocache() in cpu_handle_exception(). Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov --- Changes in v4: - Compile error fixed (missed conversion) --- cpu-exec.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index b840e1d2dd41..974de6aa27ee 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -320,7 +320,7 @@ found: } static inline TranslationBlock *tb_find_fast(CPUState *cpu, - TranslationBlock **last_tb, + TranslationBlock *last_tb, int tb_exit) { CPUArchState *env = (CPUArchState *)cpu->env_ptr; @@ -342,7 +342,7 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu, /* Ensure that no TB jump will be modified as the * translation buffer has been flushed. */ - *last_tb = NULL; + last_tb = NULL; cpu->tb_flushed = false; } #ifndef CONFIG_USER_ONLY @@ -351,12 +351,12 @@ static inline TranslationBlock *tb_find_fast(CPUState *cpu, * spanning two pages because the mapping for the second page can change. */ if (tb->page_addr[1] != -1) { - *last_tb = NULL; + last_tb = NULL; } #endif /* See if we can patch the calling TB. */ - if (*last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { - tb_add_jump(*last_tb, tb_exit, tb); + if (last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + tb_add_jump(last_tb, tb_exit, tb); } tb_unlock(); return tb; @@ -437,8 +437,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) } else if (replay_has_exception() && cpu->icount_decr.u16.low + cpu->icount_extra == 0) { /* try to cause an exception pending in the log */ - TranslationBlock *last_tb = NULL; /* Avoid chaining TBs */ - cpu_exec_nocache(cpu, 1, tb_find_fast(cpu, &last_tb, 0), true); + cpu_exec_nocache(cpu, 1, tb_find_fast(cpu, NULL, 0), true); *ret = -1; return true; #endif @@ -622,7 +621,7 @@ int cpu_exec(CPUState *cpu) cpu->tb_flushed = false; /* reset before first TB lookup */ for(;;) { cpu_handle_interrupt(cpu, &last_tb); - tb = tb_find_fast(cpu, &last_tb, tb_exit); + tb = tb_find_fast(cpu, last_tb, tb_exit); cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc); /* Try to align the host and virtual clocks if the guest is in advance */