Message ID | 20181025144644.15464-58-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="smB2Z+QQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="iWXW4ZwU"; 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 42grG03qdsz9sBQ for <incoming@patchwork.ozlabs.org>; Fri, 26 Oct 2018 02:12:24 +1100 (AEDT) Received: from localhost ([::1]:55090 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 1gFhJ8-00011n-3e for incoming@patchwork.ozlabs.org; Thu, 25 Oct 2018 11:12:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <cota@braap.org>) id 1gFh5L-00034O-1e for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <cota@braap.org>) id 1gFgvK-0008IS-F5 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:47 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34391) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <cota@braap.org>) id 1gFgvK-00088v-6n for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 34DB8221BD; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -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=Jpb+qUurjYT57NIevzIWApuErIaeR5J+BnZ+5TznZIk=; b=smB2Z +QQglIA9FwxoWZzMAEHrz4YsmN73RDKlijZHwnsncs/cdle9x9nGCdlco8XBV3FL TiMUj8b3wZ5wKIjYmKw3pV4wnNMlVvejqQMik2EliGHKO2O1PkCw6SNk8SijfHGg YIVbE+K71esrIEuVECoblFNMFYhVN8QbjBibOw= 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=Jpb+qUurjYT57NIevzIWApuErIaeR 5J+BnZ+5TznZIk=; b=iWXW4ZwU/GRKHWpW6loKuSZHUDYm0kKCbm8E3Qk0Nx71/ nekzoTtHWtxTDrkP6f7WcVdlDuIvmr09QC8aUgN1Uy6H73e2eCcmcv6oRuWOTCPC MCl0Kom3ehRQS3vpA28/k3fDgzFiuKrVYHdHm+2D7x+fSJW+GTrIO1oLU8L6cuVG St7oMeZpyCRpRqlUGkzm0GNEGZMggYism2mHohMNaU9yYc52oFyeeo+QcOY+r3Fu 3zM6q9TeHMrFvhM/DHJrYb+ZwX5BfFHVXJ/JBGuF6KMwfNreMOGRGRip2yTlE6+U /WsgyYIw14Oavjc4+gxIgU3bLflPAF+xJzzFrq10g== X-ME-Sender: <xms:aNfRWxknYauPPwo8b5BmLk_JMAoy7vnFU9KIZd5U2XtxcjWoXKxSPQ> X-ME-Proxy: <xmx:aNfRWwtVx9MoArl8cDG4bg3ixXJgxzfpvZg8vBozNeqtq-SuBoy1aQ> <xmx:aNfRW2BsM49RHNDnVTUue3bWNA_-YjBKKEaZMxNXeKqUDkBoX4dmVg> <xmx:aNfRWy0JvfGNt_ObwQ27phpIMbnPMHEadEzIbdHShJpdOet1hYHdKw> <xmx:aNfRW4SzClyAb2GcRBHtEPi1Uh8OKm6HyfkhHYWD8_YPZexQy0Cjkg> <xmx:aNfRWxsdtDyFvfjM47D8QyQxjrMP9pIO82twXP1PC_2E5_CFxfdUVA> <xmx:aNfRW6n2VvIQ7bn6df6O3BBA6IH98_SRCU1bV_OXWgHPPOfLghtk4g> Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D4569E4A4A; Thu, 25 Oct 2018 10:47:03 -0400 (EDT) From: "Emilio G. Cota" <cota@braap.org> To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:31 -0400 Message-Id: <20181025144644.15464-58-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-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.27 Subject: [Qemu-devel] [RFC v4 58/71] 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>, Richard Henderson <richard.henderson@linaro.org> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> |
Series |
[RFC,v4,01/71] cpu: convert queued work to a QSIMPLEQ
|
expand
|
On 10/25/18 3:46 PM, Emilio G. Cota wrote: > Signed-off-by: Emilio G. Cota <cota@braap.org> > --- > include/qom/cpu.h | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/include/qom/cpu.h b/include/qom/cpu.h index a86690c7a5..9826cdfa4c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -84,7 +84,8 @@ struct TranslationBlock; * @parse_features: Callback to parse command line arguments. * @reset: Callback to reset the #CPUState to its initial state. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. - * @has_work: Callback for checking if there is work to do. + * @has_work: Callback for checking if there is work to do. Called with the + * CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) @@ -793,9 +794,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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)