From nobody Mon Feb 9 17:25:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500027546179327.73486815133026; Fri, 14 Jul 2017 03:19:06 -0700 (PDT) Received: from localhost ([::1]:36744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVxga-0007lX-T9 for importer@patchew.org; Fri, 14 Jul 2017 06:19:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVxYV-0000CG-IM for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVxYR-0004v8-AF for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:39 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:34786) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVxYR-0004uo-3R for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:35 -0400 Received: by mail-wr0-x241.google.com with SMTP id k67so11312805wrc.1 for ; Fri, 14 Jul 2017 03:10:35 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id 143sm2934870wmg.9.2017.07.14.03.10.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 03:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wvXPMNN07ApJ/L7EBb39SQIbcxhOQ37pb7Bhz2mm5vo=; b=aKfXb36k16Cjjf2iSLxepVkVCKzQBz+e6nRttF/tdgKcb8IRRNKAWmIjDXtMx4rYKY 2KkCBSoYgJabfLb+L+a6vjXzgQRW7D7spfOKskmY2/GcJC4SoUb/8skbtEVnJLNUnU7+ TwWcmnwH5G5sXl24aVBOKiovI7uYc+y/6ZNiIz7F2Cjigdl+Fh61pxh4bej4lCJkoVdd uLSIzi+xJKcSUGvwUyhkL1FiY2BTQmIPWY/3QeTENAiIiozs1g6EGgOns8l7AHNhaqFm BHgN1Hp+Tp2EVgKPnS7z3FYkRqFJSFXLO8bZFuE0W6Ue8wR14DcwFihK/ZF9SjGfqzWt 4chg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wvXPMNN07ApJ/L7EBb39SQIbcxhOQ37pb7Bhz2mm5vo=; b=XWJTEEttXAUu9f0vMmbv0tZikcMD0XzrC16Zxm/E+0H+HuT81Zq04Sgm6pygkHyt5D obQF+kVIW0+wE3Lc4ChXXGcxz/7UeHA3WHAs0HcxP36Vk0utDu3WvrLIx0AVxSfWz9zk enA32oiB3zg7ToY3YtoJFMhK9W8AlFBSiGkMFSgtxjjKj4NS3CVYwTCBRBZjLcCdXxCg 60GImRZH/ZNdAA/fIbv5P0VX4px273iWOrfxpZ3wzzRXvRHVKDzF6zdZu1X45EFv5k42 jR5yJG16KPQNgTojSjKFF3XpXtOdW95czTiWyb0VsFUnPvfAaJOxQs2gTB5/bhMX1W5R EXdQ== X-Gm-Message-State: AIVw112NBgOiPRi1KxK4KVrA7fZi3g4e8Ukd39NlwwYTk4limPE37DTk G7Z1dlIg4492vmnEFK8= X-Received: by 10.223.153.70 with SMTP id x64mr4103371wrb.18.1500027033813; Fri, 14 Jul 2017 03:10:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 12:10:13 +0200 Message-Id: <1500027028-4127-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1500027028-4127-1-git-send-email-pbonzini@redhat.com> References: <1500027028-4127-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 22/55] 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 , Pranith Kumar , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Pranith Kumar 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=C3=A9e Signed-off-by: Pranith Kumar Message-Id: <20170712215143.19594-1-bobby.prani@gmail.com> Signed-off-by: Paolo Bonzini --- exec.c | 25 +++++++++++++++++++------ include/exec/exec-all.h | 3 +++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index ad103ce..2e8bc43 100644 --- a/exec.c +++ b/exec.c @@ -775,15 +775,28 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #endif } =20 +#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 =3D cpu_get_phys_page_attrs_debug(cpu, pc, &attrs); + int asidx =3D cpu_asidx_from_attrs(cpu, attrs); + if (phys !=3D -1) { + /* Locks grabbed by tb_invalidate_phys_addr */ + tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, + phys | (pc & ~TARGET_PAGE_MASK)); + } +} +#endif =20 #if defined(CONFIG_USER_ONLY) void cpu_watchpoint_remove_all(CPUState *cpu, int mask) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 8096d64..bf8da2a 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -290,6 +290,9 @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(= CPUState *cpu, uint16_t idxmap) { } +static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr) +{ +} #endif =20 #define CODE_GEN_ALIGN 16 /* must be >=3D of the size of a icach= e line */ --=20 1.8.3.1