[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 09/10] cputlb: Query tlb_flush_page_all
From: |
Alvise Rigo |
Subject: |
[Qemu-devel] [RFC 09/10] cputlb: Query tlb_flush_page_all |
Date: |
Thu, 26 May 2016 18:35:48 +0200 |
Secure tlb_flush_page_all() by waiting the queried flushes to be
actually completed using async_wait_run_on_cpu();
Signed-off-by: Alvise Rigo <address@hidden>
---
cputlb.c | 15 ++++++++++-----
include/exec/exec-all.h | 4 ++--
target-arm/helper.c | 4 ++--
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index 77a1997..4ed0cc8 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -346,13 +346,18 @@ static void tlb_flush_page_async_work(CPUState *cpu, void
*opaque)
tlb_flush_page(cpu, GPOINTER_TO_UINT(opaque));
}
-void tlb_flush_page_all(target_ulong addr)
+void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr)
{
- CPUState *cpu;
+ CPUState *other_cpu;
- CPU_FOREACH(cpu) {
- async_run_on_cpu(cpu, tlb_flush_page_async_work,
- GUINT_TO_POINTER(addr));
+ CPU_FOREACH(other_cpu) {
+ if (other_cpu != this_cpu) {
+ async_wait_run_on_cpu(other_cpu, this_cpu,
+ tlb_flush_page_async_work,
+ GUINT_TO_POINTER(addr));
+ } else {
+ tlb_flush_page(current_cpu, addr);
+ }
}
}
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index cb891d2..36f1b81 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -191,7 +191,7 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx,
uintptr_t retaddr);
-void tlb_flush_page_all(target_ulong addr);
+void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr);
#else
static inline void tlb_flush_page(CPUState *cpu, target_ulong addr)
{
@@ -209,7 +209,7 @@ static inline void tlb_flush_page_by_mmuidx(CPUState *cpu,
CPUState *target,
static inline void tlb_flush_by_mmuidx(CPUState *cpu, CPUState *target ...)
{
}
-static inline void tlb_flush_page_all(target_ulong addr)
+static inline void tlb_flush_page_all(CPUState *this_cpu, target_ulong addr)
{
}
#endif
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 0187c0a..8988c8b 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -554,13 +554,13 @@ static void tlbiasid_is_write(CPUARMState *env, const
ARMCPRegInfo *ri,
static void tlbimva_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
- tlb_flush_page_all(value & TARGET_PAGE_MASK);
+ tlb_flush_page_all(ENV_GET_CPU(env), value & TARGET_PAGE_MASK);
}
static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
uint64_t value)
{
- tlb_flush_page_all(value & TARGET_PAGE_MASK);
+ tlb_flush_page_all(ENV_GET_CPU(env), value & TARGET_PAGE_MASK);
}
static const ARMCPRegInfo cp_reginfo[] = {
--
2.8.3
- [Qemu-devel] [RFC 00/10] MTTCG: Slow-path for atomic insns, Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 01/10] exec: Introduce tcg_exclusive_{lock, unlock}(), Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 04/10] cputlb: Introduce tlb_flush_other(), Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 03/10] cpus: Introduce async_wait_run_on_cpu(), Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 02/10] softmmu_llsc_template.h: Move to multi-threading, Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 05/10] target-arm: End TB after ldrex instruction, Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 06/10] cputlb: Add tlb_tables_flush_bitmap(), Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 09/10] cputlb: Query tlb_flush_page_all,
Alvise Rigo <=
- [Qemu-devel] [RFC 07/10] cputlb: Query tlb_flush_by_mmuidx, Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 08/10] cputlb: Query tlb_flush_page_by_mmuidx, Alvise Rigo, 2016/05/26
- [Qemu-devel] [RFC 10/10] cpus: Do not sleep if some work item is pending, Alvise Rigo, 2016/05/26