[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_al
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all |
Date: |
Sun, 23 Aug 2015 20:24:04 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
cputlb.c | 41 +++++++++++------------------------------
1 file changed, 11 insertions(+), 30 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index 1b3673e..d81a4eb 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -73,43 +73,24 @@ void tlb_flush(CPUState *cpu, int flush_global)
tlb_flush_count++;
}
-struct TLBFlushParams {
- CPUState *cpu;
- int flush_global;
-};
-
-static void tlb_flush_async_work(void *opaque)
+static void __tlb_flush_all(void *arg)
{
- struct TLBFlushParams *params = opaque;
+ CPUState *cpu;
+ int flush_global = *(int *)arg;
- tlb_flush(params->cpu, params->flush_global);
- g_free(params);
+ CPU_FOREACH(cpu) {
+ tlb_flush(cpu, flush_global);
+ }
+ g_free(arg);
}
void tlb_flush_all(int flush_global)
{
- CPUState *cpu;
- struct TLBFlushParams *params;
+ int *arg = g_malloc(sizeof(*arg));
-#if 0 /* MTTCG */
- CPU_FOREACH(cpu) {
- tlb_flush(cpu, flush_global);
- }
-#else
- CPU_FOREACH(cpu) {
- if (qemu_cpu_is_self(cpu)) {
- /* async_run_on_cpu handle this case but this just avoid a malloc
- * here.
- */
- tlb_flush(cpu, flush_global);
- } else {
- params = g_malloc(sizeof(struct TLBFlushParams));
- params->cpu = cpu;
- params->flush_global = flush_global;
- async_run_on_cpu(cpu, tlb_flush_async_work, params);
- }
- }
-#endif /* MTTCG */
+ *arg = flush_global;
+ tb_lock();
+ cpu_tcg_sched_work(current_cpu, __tlb_flush_all, arg);
}
static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, target_ulong addr)
--
1.9.1
- [Qemu-devel] [RFC 24/38] cpu-exec: reset mmap_lock after exiting the CPU loop, (continued)
- [Qemu-devel] [RFC 24/38] cpu-exec: reset mmap_lock after exiting the CPU loop, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 09/38] rcu: fix comment with s/rcu_gp_lock/rcu_registry_lock/, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 30/38] translate-all: add tb_lock assertions, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 26/38] cpu: protect tb_jmp_cache with seqlock, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_all, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all,
Emilio G. Cota <=
- [Qemu-devel] [RFC 34/38] translate-all: use tcg_sched_work for tb_flush, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 19/38] tcg: add tcg_gen_smp_rmb(), Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 22/38] cpu: update interrupt_request atomically, Emilio G. Cota, 2015/08/23
- [Qemu-devel] [RFC 31/38] cpu: protect l1_map with tb_lock in full-system mode, Emilio G. Cota, 2015/08/23