Message ID | 20181019010625.25294-48-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="UBbkw6pF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="sW9SfKxt"; 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 42bpZZ096Sz9s8J for <incoming@patchwork.ozlabs.org>; Fri, 19 Oct 2018 12:42:45 +1100 (AEDT) Received: from localhost ([::1]:46094 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 1gDJoJ-0002pr-F8 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:42:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJFo-0004t2-BY for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJFl-0003Nr-4Q for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35991) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <cota@braap.org>) id 1gDJFk-00035X-CS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 43C092298B; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=FGRgPrm/gA+rsX2AH8wamMUlcAVdc/8it5hbR1Udj/w=; b=UBbkw 6pFfIR5RbJMjySpU0rP1XFEWbddi7IUdHRyz5t2E3CFSJ2Ia8DkWZLZTNhrb7t2f T6ev3Mx9GIEs08HKhsCBhD45lw+kOhH0WaGipcnvX/19euE1PQRVFKLuD/4EywRJ Xqy4/E7o5B7U7TN5XSnd6zt7hdRM+xGcWI2zLM= 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=FGRgPrm/gA+rsX2AH8wamMUlcAVdc /8it5hbR1Udj/w=; b=sW9SfKxt3YSuql0icNj29PuPCRlgv+NkPhGnl1FcVSmlK nbme7FoHgwPt87pXe8T3/SMQODcywlcXri48ip6o/itgOks5oNTLmR9cRZCraJ+1 0IThRYN3iDdgtYHQVcRHCzRu6UYMooOyD0PCZ9+5sQEYQY1AWP7Iibo1n1D/KfxQ zdPsQ+5IyjfvzFD25M/aCLsnJhnU53pe8DWUOpoFhyHGpm3yrog53/pJlQyKPxBD 3SM6WdTaCv+hcWmziRIf6r9LvjwVpZS5xoJwN5/hBPvyDJ/UrWmtrVbCpP9RYcnb wx4tEwGXe2bNAK+vWpJZ0sgcCov4VD9mjJfNHS52g== X-ME-Sender: <xms:HS7JWzk8fjZYxpuwU58OpFbcLXFvyUewaO92JbXZ2D1U-5c6skmysg> X-ME-Proxy: <xmx:HS7JW67cAxrLFBTk4TSYJulF_6lWW1pj8j4RGhc1OLyB-9sssRfJ1A> <xmx:HS7JW0FAmhSlHsHYtw1sARU4iUYJiuBthNmZMWiYplaFa0Z2KENIMQ> <xmx:HS7JW7QKLh2w1c_jZ-4sUr41OW1vTZv13GMQs989uuxGtuzRgptHpQ> <xmx:HS7JW1vE7ql_92ZzfSB9VIuhgi_qCff9DAoM4GRbgn4seabm87N2ig> <xmx:HS7JWyxIj2o4JGVikVvi8ZiLM3z4bWl56tHZ5Tlt3M8RG0tHmOKMLw> <xmx:HS7JW-0UjOE9XaGeZROClwWkEffKVAQQGQn08hDkq5xni5fIxv1udg> Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E825D102E2; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" <cota@braap.org> To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:16 -0400 Message-Id: <20181019010625.25294-48-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 47/56] cpu: call .cpu_has_work with the CPU lock held 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> 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/include/qom/cpu.h b/include/qom/cpu.h index cd66b8828a..ca7d92c360 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -784,9 +784,16 @@ const char *parse_cpu_model(const char *cpu_model); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool ret; g_assert(cc->has_work); - return cc->has_work(cpu); + if (cpu_mutex_locked(cpu)) { + return cc->has_work(cpu); + } + cpu_mutex_lock(cpu); + ret = cc->has_work(cpu); + cpu_mutex_unlock(cpu); + return ret; } /**
Signed-off-by: Emilio G. Cota <cota@braap.org> --- include/qom/cpu.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)