From nobody Fri Nov 7 22:57:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548812288348240.79116349371475; Tue, 29 Jan 2019 17:38:08 -0800 (PST) Received: from localhost ([127.0.0.1]:58500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goepF-0007Ui-Sb for importer@patchew.org; Tue, 29 Jan 2019 20:38:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe47-0000NH-2w for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe46-0001c4-6s for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41377) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe46-0001HV-1w for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AFA4D22203; Tue, 29 Jan 2019 19:48:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:31 -0500 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 595A1E446A; Tue, 29 Jan 2019 19:48:31 -0500 (EST) 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=yX5BV8uoDdB3SqyNiosF/J7VeH5BcN2lT+cKn4Idt60=; b=xRzUB GkMNDiMictdI9hnbDeotu8LWNNlciYPsBvM1CDF1rpX5abd2d7ntOKJl+srGad7b Ecgxz6BSCyjW83T/z3IvuaeOls9Y/Iqr9z75LbwPq/zgYXohXnAx01E045T9NspW h9ZUxiCfBNwJNnZUA0Ekz9XU0efRM/SR0uMEzw= 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=yX5BV8uoDdB3SqyNiosF/J7VeH5Bc N2lT+cKn4Idt60=; b=LunISpXENmLBnfHhd/7LhdlTlmmeemMWsQ1tcb9pP5QNd Y37hp2/yczuBxqUZyA42nsrh9wotdgDgIUqL0zaKqMLcWk2jvJLoJ9ZdL6DmWCOR 60F3W9Zpy8v8il3I0dmudiFFRo9nRXw56moxtqCrk+tiCDsO+gNQXWnT/YvmN+D5 8tIGaM/PNHUHn9SYB39kHLQBXIuQjG8jqXgTg5aU1qpiSnAWPeQsJOBWSOkUNDOQ lybEyBFMREjhckuwMYuo1+hLN24ySM0TP8WUOTGlhXHjh9JxEIzkHVv7BWCXOTV6 cadEp7AT1/XUpQOHRV6YgY/50aAluLM/SMyG8pb1w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:09 -0500 Message-Id: <20190130004811.27372-72-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 71/73] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 62e282bff1..1241024b2c 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -145,6 +145,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, r= un_on_cpu_data data) return; } =20 + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func =3D func; wi.data =3D data; wi.done =3D false; @@ -153,21 +158,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, r= un_on_cpu_data data) =20 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 ab= ove). - * 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 =3D current_cpu; =20 --=20 2.17.1