[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_a
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_all |
Date: |
Sun, 23 Aug 2015 20:24:05 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
cputlb.c | 39 +++++++++++----------------------------
1 file changed, 11 insertions(+), 28 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index d81a4eb..717a856 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -145,41 +145,24 @@ void tlb_flush_page(CPUState *cpu, target_ulong addr)
tb_flush_jmp_cache(cpu, addr);
}
-struct TLBFlushPageParams {
- CPUState *cpu;
- target_ulong addr;
-};
-
-static void tlb_flush_page_async_work(void *opaque)
+static void __tlb_flush_page_all(void *arg)
{
- struct TLBFlushPageParams *params = opaque;
+ target_ulong addr = *(target_ulong *)arg;
+ CPUState *cpu;
- tlb_flush_page(params->cpu, params->addr);
- g_free(params);
+ CPU_FOREACH(cpu) {
+ tlb_flush_page(cpu, addr);
+ }
+ g_free(arg);
}
void tlb_flush_page_all(target_ulong addr)
{
- CPUState *cpu;
- struct TLBFlushPageParams *params;
+ target_ulong *arg = g_malloc(sizeof(*arg));
- CPU_FOREACH(cpu) {
-#if 0 /* !MTTCG */
- tlb_flush_page(cpu, addr);
-#else
- if (qemu_cpu_is_self(cpu)) {
- /* async_run_on_cpu handle this case but this just avoid a malloc
- * here.
- */
- tlb_flush_page(cpu, addr);
- } else {
- params = g_malloc(sizeof(struct TLBFlushPageParams));
- params->cpu = cpu;
- params->addr = addr;
- async_run_on_cpu(cpu, tlb_flush_page_async_work, params);
- }
-#endif /* MTTCG */
- }
+ *arg = addr;
+ tb_lock();
+ cpu_tcg_sched_work(current_cpu, __tlb_flush_page_all, arg);
}
/* update the TLBs so that writes to code in the virtual page 'addr'
--
1.9.1
- [Qemu-devel] [RFC 23/38] cpu-exec: grab iothread lock during interrupt handling, (continued)
- [Qemu-devel] [RFC 23/38] cpu-exec: grab iothread lock during interrupt handling, Emilio G. Cota, 2015/08/23
- [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 <=
- [Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all, Emilio G. Cota, 2015/08/23
[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