From nobody Fri May 3 15:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1574807860; cv=none; d=zohomail.com; s=zohoarc; b=ZvtrPsI9GRmt0H1FeSdMfHdVakv1yl95QxmnwTnCZoTfVpUptWYcUQqJQtOyoBlb+t5XLb7J3W+f7+frkyQj2R7sS14tOoYEiXzKZKXBnSw6v9K65KrPNwOGZFICo4r1GjPvIlO8uuj1N4/oa5eUkFrP+wlUQikCVdhIG2Ecn7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574807860; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=+Fx+vf32likHXwrbJij7DVsy01KxeAQ/wZxvM8xQt6o=; b=TlN9cDmeUpfGGRzTDwn+c0SA1/cxYWEJNgByN5nmPgkB7ytWIG2sc3+TCNqeWdHaSHJFARraNhLDcPvs3yWYutC7PtZdSMBCUVzf+J11BWPuYYPB40Kut29I2MV72dSZJG+z/2AT/28QuOirEng0RIMW3cZAjvFtS5fkhiYVO38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574807860861995.3385903844738; Tue, 26 Nov 2019 14:37:40 -0800 (PST) Received: from localhost ([::1]:59774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZjSl-0002a2-NZ for importer@patchew.org; Tue, 26 Nov 2019 17:37:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58201) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iZjPJ-0007ln-0c for qemu-devel@nongnu.org; Tue, 26 Nov 2019 17:34:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iZjI6-0007lT-Er for qemu-devel@nongnu.org; Tue, 26 Nov 2019 17:26:39 -0500 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:46587) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iZjI6-0007kT-7y for qemu-devel@nongnu.org; Tue, 26 Nov 2019 17:26:38 -0500 Received: by mail-lf1-x12c.google.com with SMTP id a17so15407867lfi.13 for ; Tue, 26 Nov 2019 14:26:36 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id g11sm5897127lfb.94.2019.11.26.14.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 14:26:34 -0800 (PST) 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=+Fx+vf32likHXwrbJij7DVsy01KxeAQ/wZxvM8xQt6o=; b=PrMvV3Tq6Y9OzpyN+wkUc4yZKBJyCEWevt6UtsFSr/3iLSiV5zlt8A99RSRkr9Sgmu LULz4Ou0jFtahvqUg25nikV5Ss1gnCEaelmJWQSxTltNUXxdt9HVZPP1b2MZ5rkvcGwB bqWHQtuOfMAILp5tKzXMlbgD2zmu5ByvpMjAZfgYSj6qvrOWALyZoNi/4sWdZrPPy62z NW4/HSeCMmhxNZ2Wc7vqcMuaGDVTT+gRmplZkYekVyKiorSTeViSVQqOcdF9JrQU6rQT rG86sm+WhVmF6bFgQYwteGU0goa1IMPPBDxVCIvuitY4kaK5DxOe1H7qN/UaYieJYnip ftYg== 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=+Fx+vf32likHXwrbJij7DVsy01KxeAQ/wZxvM8xQt6o=; b=dn9YzVMT/whv6NIwpHKUGKNG3sKjTPzEbQZ501uzWPVCoB1QYYnnv5RI8Qeq6QdNoa RFwhm8AdoEUJ+AoGQ8/AmABG+g8l/5YKB87wt4gqHZn88Rslyiu0j8GFFq+XIChoDvo6 p2n+BbiCoWTBr7eAcPKoFH6G1II5/n1Pcpg5mpYTMbH5Vt398tO33Yn3ZPig7hyOjl2w oyZcd045+u4zssHVwrlcaOSZRe8/LSHrg17jFN9roqFwPPZJZaQIo498TFF5MeoZdH4b QkYk0YLwr0cPLVXaZmHhDu3YwfDK7Sqw94IPwiqkDsvqMkdif01qYFjbFUK6p22rlza8 Cn6Q== X-Gm-Message-State: APjAAAWbpBID7XDl0GN5/GF+kusVvgHbMKZzcnEJUuXBZanj+CQNuEc5 Ge9w9lrBVQJNAmHgqhIAGvvqMYEoPPU= X-Google-Smtp-Source: APXvYqyfubyGCtH4z4W58z6ClPk9FfP/R2+O6YNFKwhhbdtvieclnDd5E5bSfVGlnZiRwT0fPnJt3A== X-Received: by 2002:a19:f606:: with SMTP id x6mr25589663lfe.160.1574807194818; Tue, 26 Nov 2019 14:26:34 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Subject: [RFC] exec: flush CPU TB cache when breakpoint address translation fails Date: Tue, 26 Nov 2019 14:26:07 -0800 Message-Id: <20191126222607.25653-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When a breakpoint is inserted at location for which there's currently no virtual to physical translation no action is taken on CPU TB cache. If a TB for that virtual address already exists but is not visible ATM the breakpoint won't be hit next time an instruction at that address will be executed. Flush entire CPU TB cache when a breakpoint is set for a virtual address that cannot be translated to physical address. This change fixes the following workflow: - linux user application is running - a breakpoint is inserted from QEMU gdbstub for a user address that is not currently present in the target CPU TLB - an instruction at that address is executed, but the external debugger doesn't get control. Signed-off-by: Max Filippov --- exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exec.c b/exec.c index ffdb5185353b..918945f8097e 100644 --- a/exec.c +++ b/exec.c @@ -1024,6 +1024,8 @@ static void breakpoint_invalidate(CPUState *cpu, targ= et_ulong pc) /* Locks grabbed by tb_invalidate_phys_addr */ tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, phys | (pc & ~TARGET_PAGE_MASK), attrs); + } else { + tb_flush(cpu); } } #endif --=20 2.20.1