From patchwork Tue Dec 6 20:56:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9463269 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 B59596022E for ; Tue, 6 Dec 2016 20:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8C15284AC for ; Tue, 6 Dec 2016 20:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D82C284C3; Tue, 6 Dec 2016 20:58:25 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 2DC91284AC for ; Tue, 6 Dec 2016 20:58:23 +0000 (UTC) Received: from localhost ([::1]:34771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEMog-0003Hy-AE for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Dec 2016 15:58:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEMoE-0003He-OC for qemu-devel@nongnu.org; Tue, 06 Dec 2016 15:57:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEMoD-0006RV-T4 for qemu-devel@nongnu.org; Tue, 06 Dec 2016 15:57:54 -0500 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cEMoD-0006Ny-Pv for qemu-devel@nongnu.org; Tue, 06 Dec 2016 15:57:53 -0500 Received: by mail-yw0-f196.google.com with SMTP id b66so29935814ywh.2 for ; Tue, 06 Dec 2016 12:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y9zF7XqeIzq8V2re7MCTri3C7PzChCwjCcUupJkwk6I=; b=r34B5tD6bfsFgy/GIR/atDmfVPBx2TFplbQbZkOsf1crI++gzk/2H60GpGiAxvaSx1 B0z1dI1oPcbmUjDAKuns7aTvvE+OIdrmyrk/ghi/m1Va42nDp9ubfulYyPKJgyeVG3Vf 7B2ZsCsBDHLDfavWaWfKXac67W13rl33gQT0J3SF0PTNrpKCxjrLaqo1Ba3KHE83qPLv uDLovATmBdtz5QVxB78EqjVlLfvyOV1PdKPlUdgcv6v/jXbOLiAy2Lb6AtNF/o3e2gsF vYQegZAqUw+xN8Y8GZedFJ/I/unRGer8efOk2CUYw1oWBJ0L/E2pk/w9NdFQ3UHjgqz/ mC+A== 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=Y9zF7XqeIzq8V2re7MCTri3C7PzChCwjCcUupJkwk6I=; b=IP0DXzSTxe4CUAYR+8gj1/L2PkAjssFZFHsQCWiS4fU3CayTQzYIojboGMVS1ZRtKh xLbDY3ACY4Iq0miKCoNoAkt3V1dy1D3gUszFNs8hQfHy9ljPPkzNk5vtyJ9jVzwfirVG WAedXnu6GQwc61Jks63hp2MgkWnDS5XuIxqSbS0wfOenu1fN4VWzz/cVSld+IWyN2D7Q MWV+O/z/YGE+OVfGBuXCJrN/BtLJyoHisTcejRB6iwo7XPQ7SGJCXiTPvIWJbq6TKaal 0jlgKN1r9F7zoSWRtBJwCY/IpGVpZpR/hV5NwM1smFSeU0sqoIzducHBUewSvHdGifop C/4A== X-Gm-Message-State: AKaTC03GJ9bcaJOXWXLWYbZXqwCxN0FFN5TgpOgiXiH2yWGGMZ7Nfa8MLgInneLhk0snzA== X-Received: by 10.13.246.193 with SMTP id g184mr60681065ywf.277.1481057792048; Tue, 06 Dec 2016 12:56:32 -0800 (PST) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id u1sm9012647ywc.15.2016.12.06.12.56.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Dec 2016 12:56:31 -0800 (PST) From: Pranith Kumar To: alex.bennee@linaro.org Date: Tue, 6 Dec 2016 15:56:27 -0500 Message-Id: <20161206205627.8443-4-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161206205627.8443-1-bobby.prani@gmail.com> References: <20161206205627.8443-1-bobby.prani@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.161.196 Subject: [Qemu-devel] [RFC PATCH 3/3] tcg: Explicitly unlock tb_lock 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: mst@redhat.com, cota@braap.org, qemu-devel@nongnu.org, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pranith Kumar --- exec.c | 2 ++ hw/i386/kvmvapic.c | 1 + translate-all.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/exec.c b/exec.c index 46e2044b1f..f49088b259 100644 --- a/exec.c +++ b/exec.c @@ -2115,11 +2115,13 @@ static void check_watchpoint(int offset, int len, MemTxAttrs attrs, int flags) tb_lock(); tb_check_watchpoint(cpu); if (wp->flags & BP_STOP_BEFORE_ACCESS) { + tb_unlock(); cpu->exception_index = EXCP_DEBUG; cpu_loop_exit(cpu); } else { cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags); tb_gen_code(cpu, pc, cs_base, cpu_flags, 1); + tb_unlock(); cpu_loop_exit_noexc(cpu); } } diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index c8d908ede6..ffee94dd88 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -454,6 +454,7 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip) * longjmps back into the cpu_exec loop. */ tb_lock(); tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1); + tb_unlock(); cpu_loop_exit_noexc(cs); } } diff --git a/translate-all.c b/translate-all.c index cf828aa927..240c0a5c3d 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1282,6 +1282,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, buffer_overflow: /* flush must be done */ tb_flush(cpu); + tb_unlock(); mmap_unlock(); cpu_loop_exit(cpu); } @@ -1526,6 +1527,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, modifying the memory. It will ensure that it cannot modify itself */ tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); + tb_unlock(); cpu_loop_exit_noexc(cpu); } #endif @@ -1802,6 +1804,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) /* FIXME: In theory this could raise an exception. In practice we have already translated the block once so it's probably ok. */ tb_gen_code(cpu, pc, cs_base, flags, cflags); + tb_unlock(); /* TODO: If env->pc != tb->pc (i.e. the faulting instruction was not * the first in the TB) then we end up generating a whole new TB and