From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZ9-00072z-5M 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-0000o7-Hd for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:47 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:49941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZ7-0000nw-Ct for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:45 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4937920A40 for ; Sun, 23 Aug 2015 20:24:45 -0400 (EDT) From: "Emilio G. Cota" Date: Sun, 23 Aug 2015 20:24:05 -0400 Message-Id: <1440375847-17603-37-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 36/38] cputlb: use tcg_sched_work for tlb_flush_page_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 | 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