From patchwork Wed Jun 7 17:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9772027 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 6694B6034B for ; Wed, 7 Jun 2017 17:08:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2038126785 for ; Wed, 7 Jun 2017 17:08:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1335528438; Wed, 7 Jun 2017 17:08:38 +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 8583E26785 for ; Wed, 7 Jun 2017 17:08:37 +0000 (UTC) Received: from localhost ([::1]:45276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIeRg-00021e-O7 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Jun 2017 13:08:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIeJa-0004AF-HV for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIeJV-00008W-Fp for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:00:14 -0400 Received: from mail-yw0-x244.google.com ([2607:f8b0:4002:c05::244]:34038) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIeJV-00007H-BM for qemu-devel@nongnu.org; Wed, 07 Jun 2017 13:00:09 -0400 Received: by mail-yw0-x244.google.com with SMTP id w143so898671yww.1 for ; Wed, 07 Jun 2017 10:00:09 -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=gnifVolz9621S6zk98421lQ7bwwOBdlGHByNnC9G9Fs=; b=W/sX/KxhV56Qr+EK1FLBo7Xhyv/clb/Gw6zNRU69qWQVmjesob2U1sTRUl8uuQzgUi 3vv5k5pu6we236Tt+JPdnSjt1b212EUz8VpASJeqh7aSdViXwDTgScsY/bcRBCdX1XIR RcFuw1hguoiNAYZTgdZk2VFZ5XoPYn6EL+0CbEMcP4JsKICimzpVv0m980qW9XotnZUz S7eY6FFncO6Oy4vdSrvf4WyQNarPo3zFi2f5kjSF19vEGhuf+69tT6TQCbFiKB0DuHY5 ZUMJ1AuVqqaTk6UFfh1xYO7z+mB4NJvCt/+Ialh9Kz+0i0s90ssRdG+bOepd7euRls9u IulA== 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=gnifVolz9621S6zk98421lQ7bwwOBdlGHByNnC9G9Fs=; b=moOf15hOyn4T0lT5ZFZI0Rsy8vGe8oLARg0sFi45Ous6dLlWP2nPVzhB6QNa8C5Itt Igb7vm7wSeJAHo492NsGDqMPDGuWsXCNcKyvTbh7l6eanb3ZbV3McEqU83cmZdSsmmgo W+ZnVho9RlyUx7rwJuhhecaWj4/sGF60+b1ina1xYJkmZc7Xlcmtuxwib51Mtt8vc3lM 5lqMYVoDfMKLmnOnsR4qpXOFlsK9ISuB1ASMlg2Q8UVC94JEOrLU0awuJ6bbqtMh6DyH a7RNr9+IodS8yU8sOsX7DlMpdMd9UJpS1V0cwK2eABx+sdZ3qkfXFt2SH3OXqosRo8/u q4iw== X-Gm-Message-State: AODbwcD0M6zVhoxlrEpfRgWYRFWPeT+oUNvoAvc6gTTHo0q0OWdKu8DD 8NYIGygcfN/X0A== X-Received: by 10.129.106.196 with SMTP id f187mr8737924ywc.251.1496854807894; Wed, 07 Jun 2017 10:00:07 -0700 (PDT) Received: from senna.cc.gatech.edu (senna.cc.gt.atl.ga.us. [143.215.128.17]) by smtp.gmail.com with ESMTPSA id z142sm1204620ywz.50.2017.06.07.10.00.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 10:00:07 -0700 (PDT) From: Pranith Kumar To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Wed, 7 Jun 2017 13:00:06 -0400 Message-Id: <20170607170006.9203-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c05::244 Subject: [Qemu-devel] [PATCH] 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 eac6085760..ce7a3412bf 100644 --- a/exec.c +++ b/exec.c @@ -731,15 +731,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)