From patchwork Mon Aug 22 15:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599172 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1848547mae; Mon, 22 Aug 2022 10:46:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Bsb1QqxxE4XYxuSnGJqGuN73p3/DR8A6U/fSfslTOhLjDQbHD3PZCCiEB8uTMyE9KVU/r X-Received: by 2002:a05:620a:2590:b0:6b8:d11b:7b1e with SMTP id x16-20020a05620a259000b006b8d11b7b1emr13497810qko.577.1661190396886; Mon, 22 Aug 2022 10:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661190396; cv=none; d=google.com; s=arc-20160816; b=LHLgl95uA9JNZ+DxkGrRCeXd14gr61P1WAyXOFpeOPCEcgV4KReTWSlzTgQUdVe3rW bDWCePPGsnAc/Xy9LzfprdtkAJrZ/Bkl8c5s/RNkyFIn0EOApRW/Mx6Qss5/57AfvNgu /LwzbXlfzaSQ/XlrstmCAEhPhcMTSMDz66EYjacwztvk/d4Kypr4EFuCTlC1MMkMCxfl 0+A1kBSpffqSbVdatpkqQ//qmgj8I5A7SmrS1G4aVbYI2uJk8sMR+gHh/ktceLoANWgu DQ7MlArHeuUZtA1LWdlvVHAiYkxMMSjAzzjVOIXDEF1OnvC7+RoS29//QHf0j1uwv+1n T1fw== 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=AOC1J2N1TFaqmPODpiEeJvvId1/L1t5ozJ+BKFX5tCI=; b=AKBAwZZWlk9cVOmIdE8a7/nj/RTstBXpTX5vRShMPMwfBFYXMrkGIfJpAV5XY43a5G YCykTWM33agr03C0HjJunhZbA/8y3RdwIj0H0lGK7VO6w0DR39gCoQwi4AlyGoAqmIlU BO5MD0Pfic2Wykz8xD9XR6s9T8DBB/WMc/pfUyI3Q/DlSDoxd2DjqzzdbIzUfFDDZC6j vB+KEi41b6dfjWwLfaNKaMtX3m7TvdSCibTLteEC7LywuRuV4fZ2QG9QJ7UytfQi/g76 KKw1joWgv6e63swx15ebIU31c/Xg5Hy0XcBwOQaoCsZ6X7GYcm8sSF0NR99IV4H5u8Pt CHiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iIvxLrzj; 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 u5-20020a0562141c0500b00496a9091e96si2785765qvc.360.2022.08.22.10.46.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 10:46:36 -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=iIvxLrzj; 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]:37780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQBVT-0000Kc-FG for patch@linaro.org; Mon, 22 Aug 2022 13:46:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9M0-0000p7-Ga for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:40 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:37876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9Le-0000h5-Rt for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:28:40 -0400 Received: by mail-pf1-x42b.google.com with SMTP id x15so9774973pfp.4 for ; Mon, 22 Aug 2022 08:28:18 -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; bh=AOC1J2N1TFaqmPODpiEeJvvId1/L1t5ozJ+BKFX5tCI=; b=iIvxLrzj8WxzmdYfitz6DVTQo2olvu6icUB/p/DoRCUH67QB5rjnc4S5hbAwU5iUXh vizwayS9shWSKQ+MUkki9pqv2B3gBZeSJtOe1rADfyNgW948xljZ5HeRLwy0ccnASec7 Zdbpdi2lxZQImaxDd0+JaQH/RW1+ZqNSEeLfaAy4t8/rKepiqeic+RfICdWmE7ecMpeU KkKSRUp98G9gUH4f0T5MfsMLp4d9gqQxVo7HnenbOzIrxv7X7o/xBRkPsvrXmex84U9R vgTbd/QIibgpx2GEDaPRc/8OQnCm23/n6sybFtNRhL27VZy6aSFvvya84rdE6eQJbAds 90uQ== 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; bh=AOC1J2N1TFaqmPODpiEeJvvId1/L1t5ozJ+BKFX5tCI=; b=2e8GsdIqrhb8sAeMaUBIv0WgpITeM/IYdDSfSmbmJRcKSPVDI08v71cRBkhdxDTMzV w3PQW6g2fXXVuFH5/ggKszqDMWyYVyvj3MW/3z6I/mMEFgbEAhkSH7FIfIxTqVQS/L70 MTUam4pmNa/Ouy6onbfrgtGs7GWuwHfkpTatyzCKomeUzCJ74wFkceq1KJ2/2REF1Z1u sJLUoFc62ap8Ji2XLsZOfsa/Q6QugrEOht6KRExbMxXNaI9a9YEeteAlk33XDHI50f7G gXU+AmqXqZ+PCWiCp1orUgjVBMLqoqsOlMC07iOJ9sqE1BmS7XVHIUd1JwyVWZOGRuXG o+fw== X-Gm-Message-State: ACgBeo1t+gJ+G5aqJ7uC0MmiYspA6f3BBonM408ChByHVc2rCnyTe/9q 8EC0HR7SekpjMGNxAwMU85wDIeHdXqZaNA== X-Received: by 2002:a05:6a00:1883:b0:536:e59f:f776 with SMTP id x3-20020a056a00188300b00536e59ff776mr1086800pfh.49.1661182098016; Mon, 22 Aug 2022 08:28:18 -0700 (PDT) Received: from stoup.. ([71.212.157.236]) by smtp.gmail.com with ESMTPSA id q7-20020a17090311c700b0016bffc59718sm8665222plh.58.2022.08.22.08.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:28:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, David Hildenbrand Subject: [PATCH v2 39/66] accel/tcg: Suppress auto-invalidate in probe_access_internal Date: Mon, 22 Aug 2022 08:27:14 -0700 Message-Id: <20220822152741.1617527-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822152741.1617527-1-richard.henderson@linaro.org> References: <20220822152741.1617527-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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. Cc: David Hildenbrand 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 1509df96b4..5359113e8d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1602,6 +1602,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)) { @@ -1617,10 +1618,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);