Message ID | 20181019010625.25294-54-cota@braap.org |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="meyCs9YU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="adLYGPBN"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpsF729Fz9s8J for <incoming@patchwork.ozlabs.org>; Fri, 19 Oct 2018 12:55:28 +1100 (AEDT) Received: from localhost ([::1]:46206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>) id 1gDK0Z-0005cG-GD for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:55:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJGO-0005U6-Aj for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJGK-00042J-Sq for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33717) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJGI-0003Hk-5E for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 64BD822982; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=1VA5Z7/mwyaiI9SksGJXKlgeDueRRBYKEMy4uxZdkME=; b=meyCs 9YUrYLy93C3RbRcQRLSl+xH/9nTSWKeeJFU0vVMsBFqfwbzn5t8GUgvMAgwFBvFE 4WoSzDF0O5Z0pKP3JdnMPaYX+b5F61/QAhi60oIbu0/gALC2wIruM+LBwHrX45S1 B+xGdt0Y2sQ2HRhooZxdfpJ3SoJu7aOPiqSuSs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=1VA5Z7/mwyaiI9SksGJXKlgeDueRR BYKEMy4uxZdkME=; b=adLYGPBNSlhBPBBlD8cc2E3twpbOINwckq54/vNm2aPoq zwVbfDEbQih5qbuHFHtAHdd/nnw+/pUuK8otwhxKRiRqSGmYgswvG3LbRw22zsZ1 +t7pmm4kADXUGAZjlC1iMLhJ1kvfJM11OlfZrBPNCgc0Gu7vjJExTwH6MmmRptE4 7MmbhAYwoll8sEnFB6pBZG3GTO+Z74IdSJSabIXbDihIgEvA+wZdcGa7jzEmkuuP pZPP3e9yRaMv5I/cLeK4GusoprZd0kMX+mnc6zuLuHUZ5GhVlR55fovrSdBICPsx P27XZNk/J9snSWm4DNPcsDOoFq/CpLIQ3c6JpW73Q== X-ME-Sender: <xms:Hi7JW2G0wa9Ei0TwJeXFFwiAjMxx88c00qm5VCiVKBJzHLRmivRuDQ> X-ME-Proxy: <xmx:Hi7JW8LN_TOQ8DLCqSwIMzMGoMZEVgpDT6EGHpfzBA-KFjZGJ5qRSQ> <xmx:Hi7JWzDO8S_Px9eXPt2zGgELslZLlNELPQBqOf46CN1pUiX4JIp_Fw> <xmx:Hi7JW1B9hgDCwxNWIy43xvFg6xmyAbXLi3_ZepLWaO3wdGi0PtnyRw> <xmx:Hi7JW1BlOnnSHLQnQIV79S_2q3bGLkKsabFGR0vEvWPazt4yUi6IVg> <xmx:Hi7JWwrAuA9voHXqp7Uw8UIV47wouSt-1A04w6daMCZKYjBzyUHOEQ> <xmx:Hi7JW6qQ91rtEFdkUbrOcD8oYUBc5SEN9qFe0HQMIljKwASuf7W2kw> Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 1D09C102E2; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) From: "Emilio G. Cota" <cota@braap.org> To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:22 -0400 Message-Id: <20181019010625.25294-54-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-1-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.29 Subject: [Qemu-devel] [RFC v3 53/56] xtensa: acquire the BQL in cpu_has_work X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Paolo Bonzini <pbonzini@redhat.com>, Max Filippov <jcmvbkbc@gmail.com> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> |
Series |
per-CPU locks
|
expand
|
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index d4ca35e6cc..5cb881f89b 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" @@ -42,17 +43,34 @@ static void xtensa_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.pc = value; } -static bool xtensa_cpu_has_work(CPUState *cs) +static bool xtensa_cpu_has_work_locked(CPUState *cs) { #ifndef CONFIG_USER_ONLY XtensaCPU *cpu = XTENSA_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + return !cpu->env.runstall && cpu->env.pending_irq_level; #else return true; #endif } +static bool xtensa_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = xtensa_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return xtensa_cpu_has_work_locked(cs); +} + /* CPUClass::reset() */ static void xtensa_cpu_reset(CPUState *s) {
Soon we will call cpu_has_work without the BQL. Cc: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Emilio G. Cota <cota@braap.org> --- target/xtensa/cpu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)