qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: qemu-devel@nongnu.org
Cc: "Daniel P . Berrange" <berrange@redhat.com>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Laurent Desnogues" <laurent.desnogues@gmail.com>
Subject: [Qemu-devel] [PATCH 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache
Date: Mon, 26 Jun 2017 18:04:35 -0400	[thread overview]
Message-ID: <1498514681-3059-2-git-send-email-cota@braap.org> (raw)
In-Reply-To: <1498514681-3059-1-git-send-email-cota@braap.org>

From: Lluís Vilanova <vilanova@ac.upc.edu>

The function is reused in later patches.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 accel/tcg/cputlb.c        |  2 +-
 accel/tcg/translate-all.c | 15 ++++++++++-----
 include/exec/exec-all.h   |  6 ++++++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 743776a..6a2b762 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -118,7 +118,7 @@ static void tlb_flush_nocheck(CPUState *cpu)
 
     memset(env->tlb_table, -1, sizeof(env->tlb_table));
     memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table));
-    memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));
+    tb_flush_jmp_cache_all(cpu);
 
     env->vtlb_index = 0;
     env->tlb_flush_addr = -1;
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index f6ad46b..8888dad 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -928,11 +928,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
     }
 
     CPU_FOREACH(cpu) {
-        int i;
-
-        for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
-            atomic_set(&cpu->tb_jmp_cache[i], NULL);
-        }
+        tb_flush_jmp_cache_all(cpu);
     }
 
     tcg_ctx.tb_ctx.nb_tbs = 0;
@@ -1732,6 +1728,15 @@ void tb_check_watchpoint(CPUState *cpu)
     }
 }
 
+void tb_flush_jmp_cache_all(CPUState *cpu)
+{
+    int i;
+
+    for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+        atomic_set(&cpu->tb_jmp_cache[i], NULL);
+    }
+}
+
 #ifndef CONFIG_USER_ONLY
 /* in deterministic execution mode, instructions doing device I/Os
  * must be at the end of the TB.
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 724ec73..b0281b0 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -366,6 +366,12 @@ struct TranslationBlock {
 };
 
 void tb_free(TranslationBlock *tb);
+/**
+ * tb_flush_jmp_cache_all:
+ *
+ * Flush the virtual translation block cache.
+ */
+void tb_flush_jmp_cache_all(CPUState *env);
 void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
-- 
2.7.4

  reply	other threads:[~2017-06-26 22:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 22:04 [Qemu-devel] [PATCH v9 0/7] trace: Optimize per-vCPU TCG tracing states Emilio G. Cota
2017-06-26 22:04 ` Emilio G. Cota [this message]
2017-06-26 22:04 ` [Qemu-devel] [PATCH 2/7] cpu: allocate cpu->trace_dstate in place Emilio G. Cota
2017-06-26 22:04 ` [Qemu-devel] [PATCH 3/7] trace: [tcg] Delay changes to dynamic state when translating Emilio G. Cota
2017-06-26 22:04 ` [Qemu-devel] [PATCH 4/7] exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state Emilio G. Cota
2017-06-26 22:04 ` [Qemu-devel] [PATCH 5/7] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events Emilio G. Cota
2017-06-26 22:04 ` [Qemu-devel] [PATCH 6/7] trace: [tcg, trivial] Re-align generated code Emilio G. Cota
2017-06-26 22:04 ` [Qemu-devel] [PATCH 7/7] trace: Statically enable all TCG guest events Emilio G. Cota
2017-07-10 12:07 ` [Qemu-devel] [PATCH v9 0/7] trace: Optimize per-vCPU TCG tracing states Stefan Hajnoczi
2017-07-11 10:55   ` Stefan Hajnoczi
2017-07-11 12:35   ` Lluís Vilanova

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=1498514681-3059-2-git-send-email-cota@braap.org \
    --to=cota@braap.org \
    --cc=berrange@redhat.com \
    --cc=laurent.desnogues@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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).