[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH V7 16/19] translate-all: introduces tb_flush_saf
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC PATCH V7 16/19] translate-all: introduces tb_flush_safe. |
Date: |
Mon, 10 Aug 2015 17:27:14 +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 e9512df..246df68 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -200,6 +200,7 @@ struct TBContext {
void tb_free(TranslationBlock *tb);
void tb_flush(CPUState *cpu);
+void tb_flush_safe(CPUState *cpu);
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 fc5162a..7094bf0 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -818,6 +818,21 @@ static void page_flush_tb(void)
}
}
+static void tb_flush_work(void *opaque)
+{
+ CPUState *cpu = opaque;
+ tb_flush(cpu);
+}
+
+void tb_flush_safe(CPUState *cpu)
+{
+#if 0 /* !MTTCG */
+ tb_flush(cpu);
+#else
+ async_run_safe_work_on_cpu(cpu, tb_flush_work, cpu);
+#endif /* MTTCG */
+}
+
/* flush all the translation blocks */
/* XXX: tb_flush is currently not thread safe */
void tb_flush(CPUState *cpu)
--
1.9.0
- Re: [Qemu-devel] [RFC PATCH V7 13/19] add a callback when tb_invalidate is called., (continued)
- [Qemu-devel] [RFC PATCH V7 10/19] cpu: remove exit_request global., fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 12/19] Use atomic cmpxchg to atomically check the exclusive value in a STREX, fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 14/19] cpu: introduce tlb_flush*_all., fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 15/19] arm: use tlb_flush*_all, fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 18/19] mttcg: signal the associated cpu anyway., fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 16/19] translate-all: introduces tb_flush_safe.,
fred . konrad <=
- [Qemu-devel] [RFC PATCH V7 17/19] translate-all: (wip) use tb_flush_safe when we can't alloc more tb., fred . konrad, 2015/08/10
- [Qemu-devel] [RFC PATCH V7 19/19] target-arm/psci.c: wake up sleeping CPUs (MTTCG), fred . konrad, 2015/08/10
- Re: [Qemu-devel] [RFC PATCH V7 00/19] Multithread TCG., Alex Bennée, 2015/08/10