From patchwork Thu Oct 25 14:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 989116 Return-Path: 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=) 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="UM+gR+Le"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="dOw50BgQ"; 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 42gqyr0r8Nz9s9m for ; Fri, 26 Oct 2018 01:59:16 +1100 (AEDT) Received: from localhost ([::1]:55015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh6P-0005FX-Hm for incoming@patchwork.ozlabs.org; Thu, 25 Oct 2018 10:59:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0003Zd-BK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008OT-44 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48479) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-0008BN-Uw for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 88140221DD; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:06 -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=6ONHjaNfm3oSQRF6S1lHI7ZyJsqnMz7XfwyZKvSlGhY=; b=UM+gR +Le74xykPIpZH+47PVUa7pv7000DH918naeonpxtPqix6nDGhMxm+nOLBhrYSX/W lN2rYFX0MS7nvb7++cYBcrLmKcmB7xD8AsiordpN9fWKmb/TcwPrhusjSCxCAo0h q7EXh0C1qjQxDd8WYFARu8sfOFLtGQMzWV4QHY= 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=6ONHjaNfm3oSQRF6S1lHI7ZyJsqnM z7XfwyZKvSlGhY=; b=dOw50BgQud7MGaQHLR7v9YHiat7UTFiPPpM0MvjE6rCRh 4nUhpMVd02P6weaKER6YB7ErQU5eJekrjpKr+nNpz4AcTP5sj5DBq3uHhUhCpBev WkWuub7svQs9oxEob0cW4vbJYIVa6Mq2N+84DXG/BmW4kOvG4xxePSKnhThzgbJ1 iTYnx3qlGsfJXUZnLqEraOoFNpVk8/ZUXilUCT/zZPRATvN9WlxbnQcDbk9/Illf XaXwTzSJLRPEdzr/hIUZBlmsoiaVy/OSMjaad/++FDMDUWBjNihJRCJUgw1Y90PW J0lWNBboJpeQ/tYrIJNmNfzF9KqtH46Nxqz4RZLXw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 39CC1E44D4; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:40 -0400 Message-Id: <20181025144644.15464-67-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 67/71] cpus-common: release BQL earlier in run_on_cpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index c2ad554d54..80d7e300eb 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -145,6 +145,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) return; } + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func = func; wi.data = data; wi.done = false; @@ -153,21 +158,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); - - /* - * We are going to sleep on the CPU lock, so release the BQL. - * - * During the transition to per-CPU locks, we release the BQL _after_ - * having kicked the destination CPU (from queue_work_on_cpu_locked above). - * This makes sure that the enqueued work will be seen by the CPU - * after being woken up from the kick, since the CPU sleeps on the BQL. - * Once we complete the transition to per-CPU locks, we will release - * the BQL earlier in this function. - */ - if (has_bql) { - qemu_mutex_unlock_iothread(); - } - while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu;