From patchwork Wed Jul 12 21:51:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9837455 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 40F09602D8 for ; Wed, 12 Jul 2017 21:54:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 331AE28534 for ; Wed, 12 Jul 2017 21:54:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 267D32867F; Wed, 12 Jul 2017 21:54:01 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 9DBD728534 for ; Wed, 12 Jul 2017 21:54:00 +0000 (UTC) Received: from localhost ([::1]:56139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVPa2-0008Ij-Rk for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Jul 2017 17:53:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVPZF-0008Gw-SZ for qemu-devel@nongnu.org; Wed, 12 Jul 2017 17:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVPZB-0007yv-04 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 17:53:09 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35865) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVPZA-0007yP-Ru for qemu-devel@nongnu.org; Wed, 12 Jul 2017 17:53:04 -0400 Received: by mail-yw0-f196.google.com with SMTP id l21so2086544ywb.3 for ; Wed, 12 Jul 2017 14:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OIjmdK4+RmaWNA9rmgGno2PizI2LvVEFtn3SSqPceIs=; b=KKak1EBHea6nOZsBeTjn1hAATC/g3WajM9bbhT3ZHMrULQs99KKgMzqcgecoUf7c5t S+RZ9VX8KF0eik59PaRKuEzUNz3qj7R2mncuSYrOU3ou0Kg2FzjtcRHMqvC5HdL5ZmyS MWPrOPG7z+4HpYvVIR71aM5b/o9/3QsyfGjwRu65luK96byN9OmLA3H/KDOzsBpiKM7Y w0DEAj4fzw9cMURIaJGeOoO7K7SoE6vTs7rZFHme71TBK1SXJ3W622MU2MZAG4o9AIts QsYigcoLJKs9r+vOd3bXuIwR1h7MsC97ciZa6Cgi4gnahGdvNh3h8YrTdSK/kSnZj6vD GvyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OIjmdK4+RmaWNA9rmgGno2PizI2LvVEFtn3SSqPceIs=; b=UD/MgJSjWdm0Jx7tRs7Ij9MK2jx4jXisrFX1LLdrOxVtGGOsKapsJbFwHTMvpRRXUl taoqtIGm8OEZQHXSaBBR0Qr4QA7Iooc22cyF/FReB85v/vmxLFhVklKg3qECZNaBldmp mIv5oabRmXJRx2ug4LhTm0uUaUNz3gqU6WuviSrD8za0pKw54uLNLTjseSYpLt4PlHlZ iy+fQnys1UISN+f1aPQFbpu7cVeGPgAZkW7gAmsbyItwVYa76wd4CKFDEfZAVbdQTts8 mGk8WLWM3NjUOQ3LLa7r29Q4CDo0G2rslTRdA5JiXiW3V8Pcl8PxdFjuZknSBAvOdgVV Lohw== X-Gm-Message-State: AIVw110GO2jVa9GsYP44NUjmctYdxkb5ptoVNuNfpAh203K9/9D4qyzs hHbVb/TmFQ+Jqw== X-Received: by 10.13.210.196 with SMTP id u187mr517450ywd.218.1499896323993; Wed, 12 Jul 2017 14:52:03 -0700 (PDT) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id d139sm1281902ywe.40.2017.07.12.14.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 14:52:03 -0700 (PDT) From: Pranith Kumar To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Wed, 12 Jul 2017 17:51:42 -0400 Message-Id: <20170712215143.19594-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 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] [PATCH v4 1/2] Revert "exec.c: Fix breakpoint invalidation race" 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: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that we have proper locking after MTTCG patches have landed, we can revert the commit. This reverts commit a9353fe897ca2687e5b3385ed39e3db3927a90e0. CC: Peter Maydell CC: Alex Bennée Signed-off-by: Pranith Kumar --- exec.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index a083ff89ad..48de9a67f5 100644 --- a/exec.c +++ b/exec.c @@ -775,15 +775,28 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #endif } +#if defined(CONFIG_USER_ONLY) static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) { - /* Flush the whole TB as this will not have race conditions - * even if we don't have proper locking yet. - * Ideally we would just invalidate the TBs for the - * specified PC. - */ - tb_flush(cpu); + mmap_lock(); + tb_lock(); + tb_invalidate_phys_page_range(pc, pc + 1, 0); + tb_unlock(); + mmap_unlock(); } +#else +static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) +{ + MemTxAttrs attrs; + hwaddr phys = cpu_get_phys_page_attrs_debug(cpu, pc, &attrs); + int asidx = cpu_asidx_from_attrs(cpu, attrs); + if (phys != -1) { + /* Locks grabbed by tb_invalidate_phys_addr */ + tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, + phys | (pc & ~TARGET_PAGE_MASK)); + } +} +#endif #if defined(CONFIG_USER_ONLY) void cpu_watchpoint_remove_all(CPUState *cpu, int mask)