All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] accel/tcg: Optimize jump cache flush during tlb range flush
@ 2022-01-10 16:47 Idan Horowitz
  2022-01-10 16:47 ` [PATCH 2/2] target/arm: Bail out early on 0-length tlb range invalidate Idan Horowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Idan Horowitz @ 2022-01-10 16:47 UTC (permalink / raw)
  To: qemu-arm
  Cc: peter.maydell, richard.henderson, Idan Horowitz, qemu-devel, pbonzini

When the length of the range is large enough, clearing the whole cache is
faster than iterating over the (possibly extremely large) set of pages
contained in the range.

This mimics the pre-existing similar optimization done on the flush of the
tlb itself.

Signed-off-by: Idan Horowitz <idan.horowitz@gmail.com>
---
 accel/tcg/cputlb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 5e0d0eebc3..926d9a9192 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -783,6 +783,15 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUState *cpu,
     }
     qemu_spin_unlock(&env_tlb(env)->c.lock);
 
+    /*
+     * If the length is larger than the jump cache size, then it will take
+     * longer to clear each entry individually than it will to clear it all.
+     */
+    if (d.len >= (TARGET_PAGE_SIZE * TB_JMP_CACHE_SIZE)) {
+        cpu_tb_jmp_cache_clear(cpu);
+        return;
+    }
+
     for (target_ulong i = 0; i < d.len; i += TARGET_PAGE_SIZE) {
         tb_flush_jmp_cache(cpu, d.addr + i);
     }
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-25 23:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 16:47 [PATCH 1/2] accel/tcg: Optimize jump cache flush during tlb range flush Idan Horowitz
2022-01-10 16:47 ` [PATCH 2/2] target/arm: Bail out early on 0-length tlb range invalidate Idan Horowitz
2022-01-25 22:05   ` Richard Henderson
2022-01-25 22:06     ` Peter Maydell
2022-01-25 23:34       ` Richard Henderson
2022-01-14 15:48 ` [PATCH 1/2] accel/tcg: Optimize jump cache flush during tlb range flush Alex Bennée
2022-01-14 16:41   ` Idan Horowitz
2022-01-14 20:56     ` Idan Horowitz
2022-01-25 21:55 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.