[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs |
Date: |
Sun, 16 Jul 2017 16:03:53 -0400 |
This gets rid of the need to check the tb->invalid bit during lookups.
After this change we do not need atomics to operate on tb->invalid: setting
and checking its value is serialised with tb_lock.
Signed-off-by: Emilio G. Cota <address@hidden>
---
accel/tcg/cpu-exec.c | 3 +--
accel/tcg/translate-all.c | 8 ++++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index c4c289b..9b5ce13 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -292,8 +292,7 @@ static bool tb_cmp(const void *p, const void *d)
tb->page_addr[0] == desc->phys_page1 &&
tb->cs_base == desc->cs_base &&
tb->flags == desc->flags &&
- tb->trace_vcpu_dstate == desc->trace_vcpu_dstate &&
- !atomic_read(&tb->invalid)) {
+ tb->trace_vcpu_dstate == desc->trace_vcpu_dstate) {
/* check next page if needed */
if (tb->page_addr[1] == -1) {
return true;
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index a124181..6d4c05f 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1073,13 +1073,17 @@ void tb_phys_invalidate(TranslationBlock *tb,
tb_page_addr_t page_addr)
assert_tb_locked();
- atomic_set(&tb->invalid, true);
-
/* remove the TB from the hash list */
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
h = tb_hash_func(phys_pc, tb->pc, tb->flags, tb->trace_vcpu_dstate);
qht_remove(&tcg_ctx.tb_ctx.htable, tb, h);
+ /*
+ * Mark the TB as invalid *after* it's been removed from tb_hash, which
+ * eliminates the need to check this bit on lookups.
+ */
+ tb->invalid = true;
+
/* remove the TB from the page list */
if (tb->page_addr[0] != page_addr) {
p = page_find(tb->page_addr[0] >> TARGET_PAGE_BITS);
--
2.7.4
- [Qemu-devel] [PATCH v2 18/45] target/m68k: check CF_PARALLEL instead of parallel_cpus, (continued)
- [Qemu-devel] [PATCH v2 18/45] target/m68k: check CF_PARALLEL instead of parallel_cpus, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 39/45] osdep: move qemu_real_host_page_size/mask to osdep, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 37/45] tcg: introduce **tcg_ctxs to keep track of all TCGContext's, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 40/45] osdep: introduce qemu_mprotect_rwx/none, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 32/45] tcg: take tb_ctx out of TCGContext, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs,
Emilio G. Cota <=
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Richard Henderson, 2017/07/17
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Emilio G. Cota, 2017/07/17
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Richard Henderson, 2017/07/17
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Emilio G. Cota, 2017/07/18
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Richard Henderson, 2017/07/18
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Emilio G. Cota, 2017/07/18
- Re: [Qemu-devel] [PATCH v2 10/45] translate-all: guarantee that tb_hash only holds valid TBs, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v2 29/45] exec-all: rename tb_free to tb_remove, Emilio G. Cota, 2017/07/16
- [Qemu-devel] [PATCH v2 14/45] tcg: define CF_PARALLEL and use it for TB hashing, Emilio G. Cota, 2017/07/16