From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZ8-00072Y-V3 for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTfZ7-0000nr-AJ for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:46 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:36548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZ7-0000ng-62 for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:45 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 17BB520A34 for ; Sun, 23 Aug 2015 20:24:45 -0400 (EDT) From: "Emilio G. Cota" Date: Sun, 23 Aug 2015 20:24:04 -0400 Message-Id: <1440375847-17603-36-git-send-email-cota@braap.org> In-Reply-To: <1440375847-17603-1-git-send-email-cota@braap.org> References: <1440375847-17603-1-git-send-email-cota@braap.org> Subject: [Qemu-devel] [RFC 35/38] cputlb: use cpu_tcg_sched_work for tlb_flush_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Cc: mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, alex.bennee@linaro.org, Frederic Konrad Signed-off-by: Emilio G. Cota --- 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