[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH V6 17/18] translate-all: introduces tb_flush_saf
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC PATCH V6 17/18] translate-all: introduces tb_flush_safe. |
Date: |
Fri, 26 Jun 2015 16:47:32 +0200 |
From: KONRAD Frederic <address@hidden>
tb_flush is not thread safe we definitely need to exit VCPUs to do that.
This introduces tb_flush_safe which just creates an async safe work which will
do a tb_flush later.
Signed-off-by: KONRAD Frederic <address@hidden>
---
include/exec/exec-all.h | 1 +
translate-all.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 484c351..b5e4fb3 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -219,6 +219,7 @@ static inline unsigned int tb_phys_hash_func(tb_page_addr_t
pc)
void tb_free(TranslationBlock *tb);
void tb_flush(CPUArchState *env);
+void tb_flush_safe(CPUArchState *env);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
#if defined(USE_DIRECT_JUMP)
diff --git a/translate-all.c b/translate-all.c
index 468648d..8bd8fe8 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -815,6 +815,21 @@ static void page_flush_tb(void)
}
}
+static void tb_flush_work(void *opaque)
+{
+ CPUArchState *env = opaque;
+ tb_flush(env);
+}
+
+void tb_flush_safe(CPUArchState *env)
+{
+#if 0 /* !MTTCG */
+ tb_flush(env);
+#else
+ async_run_safe_work_on_cpu(ENV_GET_CPU(env), tb_flush_work, env);
+#endif /* MTTCG */
+}
+
/* flush all the translation blocks */
/* XXX: tb_flush is currently not thread safe */
void tb_flush(CPUArchState *env1)
--
1.9.0
- [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., (continued)
- [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., fred . konrad, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Paolo Bonzini, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Frederic Konrad, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Paolo Bonzini, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Peter Maydell, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Frederic Konrad, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Paolo Bonzini, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Frederic Konrad, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Paolo Bonzini, 2015/06/26
- Re: [Qemu-devel] [RFC PATCH V6 15/18] cpu: introduce tlb_flush*_all., Paolo Bonzini, 2015/06/26
[Qemu-devel] [RFC PATCH V6 17/18] translate-all: introduces tb_flush_safe.,
fred . konrad <=
[Qemu-devel] [RFC PATCH V6 18/18] translate-all: (wip) use tb_flush_safe when we can't alloc more tb., fred . konrad, 2015/06/26