From nobody Tue Feb 10 09:59:11 2026 Delivered-To: importer@patchew.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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591372261; cv=none; d=zohomail.com; s=zohoarc; b=Zjv8Nrgq0d6t2LpnGQEQSC8euuinKaxXNKiZTZZ8zviCoSoYgU4PZYrdYEhZwOyeXR8nINQwCydcVpIV8RtZMKTzVI4f2OwTnbIoeoDPTUpEz6UhnzPMPdQlXgFHXPM5u3ri+ILs6xAI31r929POBube8wkotVd8alPBXtyGkG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591372261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=phvNC/3twlj1z+FSK0lUDFiax2fRGfdSfNFp/IJDVTk=; b=f7ZwqVdwi7AaZMVbfin9LKGLrVuD0RAM+FgT2qrWlElxAnQ8GrluV04YTZp71eiqwuJrQGUMSeRovfAQZLT9QcUAQB76yeExLmhHz3hqkmRFtmdRaku1NvBDSRLXkYQcLgfBTbHQNfDgbnPpGPfLNqDlo2VAQEbW2rURA+cG+uM= 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 1591372261131650.4166937560882; Fri, 5 Jun 2020 08:51:01 -0700 (PDT) Received: from localhost ([::1]:50684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhEcV-0005BC-P2 for importer@patchew.org; Fri, 05 Jun 2020 11:50:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhEbA-0003Ph-RL for qemu-devel@nongnu.org; Fri, 05 Jun 2020 11:49:36 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhEb9-0004Is-8S for qemu-devel@nongnu.org; Fri, 05 Jun 2020 11:49:35 -0400 Received: by mail-wm1-x341.google.com with SMTP id q25so9620786wmj.0 for ; Fri, 05 Jun 2020 08:49:34 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o10sm12731793wrj.37.2020.06.05.08.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 08:49:32 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 74F761FF90; Fri, 5 Jun 2020 16:49:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=phvNC/3twlj1z+FSK0lUDFiax2fRGfdSfNFp/IJDVTk=; b=mCTl1mvCxnnPcuLi0xBxmz6EH2VTEyybz5fZVgREAcDoQWmRObW5N+U6sEouCoe8LU v0S1AJAie0ZtTLa3ijetOQ8GF1OQVmEbsWTf2EKCIiwp+zAuSYgt4BRtHIR7Zgsfqv6q L1YcdeJVHGQo83svTl/ih6BFGqak3EmZSa36WNwVxcbDXs7GGNhaCJEqRmDsZ8cCYxXF 9pSCA2QsXwSb356Tb5H93jDHFy7YTQayBKgRTnBzWI25nv9Vk7adWq38eIIf+NMnnwIA DBMD8LLER5Lxddka2vqDzNY5Cx90fVqePAY7CpHTxK/lLCzIPb6Ji/9N94hF+xdcaiCm MIug== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=phvNC/3twlj1z+FSK0lUDFiax2fRGfdSfNFp/IJDVTk=; b=Z0p7EqmF3cUAiLlXAQqEz6g6ytYDnfkPcqz3zl5dbIWjP3Y598hwGKHIlxFJ+gKPOI FVKkHWTjUPdWwP0ek1n8RkctKN9Vl9khDr0cDIDOEsR/ktptok7ZcGhq2WaYzngS6n4f 6Vwn7Mh/JsJ3i9sq9op9Fnh0jXD5BMFrrGp68QodhhK/jwboah/iwsQ9e+QcG/OMvNFS WCPVOFxm2u9WKdJC3YbiI6e3gzGQejG+j8x8mAd2VoLElhBWybqrpqiff1DsD03gzoE+ 19zEJxxzd+IqWP1Kd3vgA2+kotlJBQLCVgbNRz7KP06Tx834Ld4uWIMD6e/QzFj2haU7 kLtA== X-Gm-Message-State: AOAM530Vj/fniw+heC8HlvQW9v45K6MGjbsAPIJe15drf/H9B5NToNBM MQw057jeSxx75OPkdmrP7LrH/A== X-Google-Smtp-Source: ABdhPJw7H3CVv9zcPxZY1Qqx0SDFbtTnSe+Qu+M/AAbgaSAmLJY1QSVEG/30Hat1m/xmtNFL9Tkvag== X-Received: by 2002:a05:600c:4102:: with SMTP id j2mr1165177wmi.48.1591372173529; Fri, 05 Jun 2020 08:49:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 04/14] exec: flush the whole TLB if a watchpoint crosses a page boundary Date: Fri, 5 Jun 2020 16:49:19 +0100 Message-Id: <20200605154929.26910-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200605154929.26910-1-alex.bennee@linaro.org> References: <20200605154929.26910-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Alexander Bulekov , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There is no particular reason why you can't have a watchpoint in TCG that covers a large chunk of the address space. We could be clever about it but these cases are pretty rare and we can assume the user will expect a little performance degradation. NB: In my testing gdb will silently squash a watchpoint like: watch (char[0x7fffffffff]) *0x0 to a 4 byte watchpoint. Practically it will limit the maximum size based on max-value-size. However given enough of a tweak the sky is the limit. Reported-by: Alexander Bulekov Signed-off-by: Alex Benn=C3=A9e --- v2 - use cleaner in_page =3D -(addr | TARGET_PAGE_MASK) logic per rth --- exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 3d4c94a9dc3..7cd45e94fce 100644 --- a/exec.c +++ b/exec.c @@ -1036,6 +1036,7 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, = vaddr len, int flags, CPUWatchpoint **watchpoint) { CPUWatchpoint *wp; + vaddr in_page; =20 /* forbid ranges which are empty or run off the end of the address spa= ce */ if (len =3D=3D 0 || (addr + len - 1) < addr) { @@ -1056,7 +1057,12 @@ int cpu_watchpoint_insert(CPUState *cpu, vaddr addr,= vaddr len, QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry); } =20 - tlb_flush_page(cpu, addr); + in_page =3D -(addr | TARGET_PAGE_MASK); + if (len <=3D in_page) { + tlb_flush_page(cpu, addr); + } else { + tlb_flush(cpu); + } =20 if (watchpoint) *watchpoint =3D wp; --=20 2.20.1