From patchwork Tue Oct 4 14:10:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 612288 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp229716pvb; Tue, 4 Oct 2022 07:59:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tHh5R2XDsaBNWaw2iBG9xvwHp7jcmt45YWpPYrE8xhR/L3/9ZZ02NEH77tqQUWUtdhAWF X-Received: by 2002:ae9:dd04:0:b0:6e0:ae86:b4 with SMTP id r4-20020ae9dd04000000b006e0ae8600b4mr1198363qkf.146.1664895566795; Tue, 04 Oct 2022 07:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664895566; cv=none; d=google.com; s=arc-20160816; b=EQ+KRRdXSKrSBIkiFX7LpeKZdXkWBAL3e7UA7dJKPbkKGqAMCEX/sNmwmAiykQ3ENE +gQMJYrtEzstulpNmMdH/yGrffnVMPdLwAgXwK+QHtPkls5n3dYhWy3CeBdXTFhTFjJB TL7ReC9hC0/YrbUaqkbQsWG54V0BHWr1gM9Vc+til7rSwAaXKk+wbk67de/PdPLt+bK/ AGBDlz7vrpMzLvf49Uxs9OWLtvHftwHZKu6eVvh7MnzFnpnQIATtrcJkFnhb30oWWrIf 3vEes+G4l96yvMjp5rcOyf0tct7xvcmtgbzfvs9/SmYRrbTvQHTZovjx02OMawaCimRB yllw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=St5dCg8yC5zIkIV0jUFWp9UWjpefIW881mvaUfGPCfo=; b=eyc62I9xoJST/i9XScLXZSYkdNpPDkTWxeohsebeOclZ1QzZnb6powY6MtosIQV7cq 2cvpghnJl+jPwAOjUZUkQBTzD7aqNbtrYA/8RYZHolMUcid0Hzigwq289KnQkYu4vw2U 6fYia+9+h5IQbCOUIvQ+UZNA6KIoAf55aMPYs4N0rBvIrh5syK92UUB6wi2hDjB2iJGX ud0J5QhB8dYVaD/8nbJgWlJOjSgWZ39j6IEb7Ffl/clXdqGHx3EhQHd6v9mFLSiMvh0Y ZprfPFxJKy36M56yk6xPWAHVambCjU6D8dyHUj2SiKY8VOWaOr6nioB0ez5f3n6QWXDb 5IRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1l7vnsl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bn36-20020a05620a2ae400b006e07ff9d047si408605qkb.728.2022.10.04.07.59.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Oct 2022 07:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i1l7vnsl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofjOH-000828-S6 for patch@linaro.org; Tue, 04 Oct 2022 10:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofidZ-0002Vn-Bv for qemu-devel@nongnu.org; Tue, 04 Oct 2022 10:11:09 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:43907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofidX-0004Jf-Kg for qemu-devel@nongnu.org; Tue, 04 Oct 2022 10:11:08 -0400 Received: by mail-pf1-x430.google.com with SMTP id 83so6248332pfw.10 for ; Tue, 04 Oct 2022 07:11:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=St5dCg8yC5zIkIV0jUFWp9UWjpefIW881mvaUfGPCfo=; b=i1l7vnsl3IaRsiVGvzgvoP+kjr2/33aQEwi1y891bxSwaRuKb6GDGwyZEHlYRtSkj8 iqvet7kLshPWpCEt3T0MOvEtRpityMf/fb12WDjzz+HxLXsms2frGcPcbEGJHeaNEtUe YHQPhB708/lK5AxHGnj1Z1kGhfyUGeuHwVHLbj4umcofOSblzJjSociSIoUFFvCUiypb l1LG8IdUmPs+rVxAFYs76782r7/9ef5HOl4YAwd1QfTaq36pA/glddh19h46p/JUOA5u l5VryiRQd1sQ6sy1GilikVmBdnwrTek/Z7nvFNTr6lXnyyvDV3rirRa8h4JQ+xcjjlhy RrUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=St5dCg8yC5zIkIV0jUFWp9UWjpefIW881mvaUfGPCfo=; b=hWKNn3vA2Svz4GldRoddFXDdSuEsXGQnSv1hHrECodPCM2DsJhy1c+n68VS6wLyc5y 4fIvJYWp1ZlkieLzr307W9rVq0iVOEcieeDBKtazMvovtzGbJuH9dZ2A7bWN9CORjbSq TYPvjm9kpcaJYJT/qAhBY8ZG1U+pp671GgdEJKso/om3/awntc/ln8iNj56TleMiL1+1 Fhi/cipHrtvyM0Ix01HB8lb38yk+B4fS8vdqHwYMWvQpmgTcCSQN5b5q8M2kONS+963z W5WlqHLGUGRyTN+8a62r2lNb/4x+jW0tFAag9ds9fGQhSu+DaYXis//vtYtGmrXZVjXr Q9dA== X-Gm-Message-State: ACrzQf1rWMTcq3qhoFGahmuim3+GBaE1DjdUNCpric9b39OrtImm+Od3 7TqnQOFVhqlRdIRk3FZllI1VdEoxjjNExg== X-Received: by 2002:a62:1e83:0:b0:545:6896:188 with SMTP id e125-20020a621e83000000b0054568960188mr27711610pfe.51.1664892664869; Tue, 04 Oct 2022 07:11:04 -0700 (PDT) Received: from stoup.. ([2605:ef80:8015:12b0:403e:a15b:ff5e:d439]) by smtp.gmail.com with ESMTPSA id y5-20020aa79ae5000000b00561382a5a25sm1240357pfp.26.2022.10.04.07.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 07:11:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, David Hildenbrand , Peter Maydell Subject: [PATCH v7 06/18] accel/tcg: Suppress auto-invalidate in probe_access_internal Date: Tue, 4 Oct 2022 07:10:39 -0700 Message-Id: <20221004141051.110653-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221004141051.110653-1-richard.henderson@linaro.org> References: <20221004141051.110653-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When PAGE_WRITE_INV is set when calling tlb_set_page, we immediately set TLB_INVALID_MASK in order to force tlb_fill to be called on the next lookup. Here in probe_access_internal, we have just called tlb_fill and eliminated true misses, thus the lookup must be valid. This allows us to remove a warning comment from s390x. There doesn't seem to be a reason to change the code though. Reviewed-by: Alex Bennée Reviewed-by: David Hildenbrand Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 10 +++++++++- target/s390x/tcg/mem_helper.c | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index d06ff44ce9..264f84a248 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1533,6 +1533,7 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, } tlb_addr = tlb_read_ofs(entry, elt_ofs); + flags = TLB_FLAGS_MASK; page_addr = addr & TARGET_PAGE_MASK; if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(env, mmu_idx, index, elt_ofs, page_addr)) { @@ -1547,10 +1548,17 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, /* TLB resize via tlb_fill may have moved the entry. */ entry = tlb_entry(env, mmu_idx, addr); + + /* + * With PAGE_WRITE_INV, we set TLB_INVALID_MASK immediately, + * to force the next access through tlb_fill. We've just + * called tlb_fill, so we know that this entry *is* valid. + */ + flags &= ~TLB_INVALID_MASK; } tlb_addr = tlb_read_ofs(entry, elt_ofs); } - flags = tlb_addr & TLB_FLAGS_MASK; + flags &= tlb_addr; /* Fold all "mmio-like" bits into TLB_MMIO. This is not RAM. */ if (unlikely(flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY))) { diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index fc52aa128b..3758b9e688 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -148,10 +148,6 @@ static int s390_probe_access(CPUArchState *env, target_ulong addr, int size, #else int flags; - /* - * For !CONFIG_USER_ONLY, we cannot rely on TLB_INVALID_MASK or haddr==NULL - * to detect if there was an exception during tlb_fill(). - */ env->tlb_fill_exc = 0; flags = probe_access_flags(env, addr, access_type, mmu_idx, nonfault, phost, ra);