From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com,
David Hildenbrand <david@redhat.com>
Subject: [PATCH v3 3/6] accel/tcg: Suppress auto-invalidate in probe_access_internal
Date: Mon, 5 Sep 2022 21:22:56 +0100 [thread overview]
Message-ID: <20220905202259.189852-4-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org>
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 <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
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 03395e725d..91f2b53142 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1535,6 +1535,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)) {
@@ -1550,10 +1551,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);
--
2.34.1
next prev parent reply other threads:[~2022-09-05 20:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 20:22 [PATCH v3 0/6] tcg: Introduce CPUTLBEntryFull Richard Henderson
2022-09-05 20:22 ` [PATCH v3 1/6] accel/tcg: Rename CPUIOTLBEntry to CPUTLBEntryFull Richard Henderson
2022-09-05 21:07 ` Philippe Mathieu-Daudé via
2022-09-20 10:42 ` Peter Maydell
2022-09-05 20:22 ` [PATCH v3 2/6] accel/tcg: Drop addr member from SavedIOTLB Richard Henderson
2022-09-05 21:07 ` Philippe Mathieu-Daudé via
2022-09-20 10:43 ` Peter Maydell
2022-09-05 20:22 ` Richard Henderson [this message]
2022-09-20 11:21 ` [PATCH v3 3/6] accel/tcg: Suppress auto-invalidate in probe_access_internal Peter Maydell
2022-09-05 20:22 ` [PATCH v3 4/6] accel/tcg: Introduce probe_access_full Richard Henderson
2022-09-05 21:10 ` Philippe Mathieu-Daudé via
2022-09-20 10:46 ` Peter Maydell
2022-09-05 20:22 ` [PATCH v3 5/6] accel/tcg: Introduce tlb_set_page_full Richard Henderson
2022-09-05 21:20 ` Philippe Mathieu-Daudé via
2022-09-20 10:59 ` Peter Maydell
2022-09-05 20:22 ` [PATCH v3 6/6] include/exec: Introduce TARGET_PAGE_ENTRY_EXTRA Richard Henderson
2022-09-05 21:28 ` Philippe Mathieu-Daudé via
2022-09-06 7:42 ` Richard Henderson
2022-09-20 10:59 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220905202259.189852-4-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=david@redhat.com \
--cc=f4bug@amsat.org \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).