From patchwork Mon Aug 24 00:24:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 510058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 02A37140280 for ; Tue, 25 Aug 2015 00:31:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b=QqDk4QVL; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=R7uWJJ77; dkim-atps=neutral Received: from localhost ([::1]:48642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTsmY-0000JK-Ta for incoming@patchwork.ozlabs.org; Mon, 24 Aug 2015 10:31:30 -0400 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) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Sun, 23 Aug 2015 20:24:45 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=GSXJt8KNuwwCnW5PaxHz+GAK9Gk =; b=QqDk4QVLXpUHervnBI+Xc6T9GF1RjPSoE2cHnQnrPyVIwgXC5lMgs64oZck u6XGkuRY/Ia4yuiV5zTqQHLQJNe4nqXwq0pbqj2SFZ2/KQ6vyjLEoo3V2nwd9ndk 40VT23sJWlQDQ2If78qhJVtXQbfd2bYck0SZj+oPakPrt5e0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=GSXJ t8KNuwwCnW5PaxHz+GAK9Gk=; b=R7uWJJ776+FtZYC4cAnPx+JU4eLcfCnaqcxK hfacO2KFxCePs2ExhrJQJNENKbOBV2vFUES6o5VYfxkONMdoKAxchkR/yn4whBa4 HCJOeULfwvr3CkfH84T1RQkXli9dUEYLGWwyEzccN9KeUubfVgkRQn30CtrEgLbq 7ZW4uhg= X-Sasl-enc: 541ignHvqLglH7KnBR7jK4Ae0cEeCwspSBvupCoULfAS 1440375885 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B69AC0001D; Sun, 23 Aug 2015 20:24:45 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Date: Sun, 23 Aug 2015 20:24:05 -0400 Message-Id: <1440375847-17603-37-git-send-email-cota@braap.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440375847-17603-1-git-send-email-cota@braap.org> References: <1440375847-17603-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 Cc: mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, alex.bennee@linaro.org, Frederic Konrad Subject: [Qemu-devel] [RFC 36/38] cputlb: use tcg_sched_work for tlb_flush_page_all X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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'