From patchwork Tue Jan 2 15:35:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 13509127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 576F1C46CD2 for ; Tue, 2 Jan 2024 15:38:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKgo8-0002nU-Co; Tue, 02 Jan 2024 10:35:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKgo5-0002mX-SL for qemu-devel@nongnu.org; Tue, 02 Jan 2024 10:35:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rKgo1-0006JN-CJ for qemu-devel@nongnu.org; Tue, 02 Jan 2024 10:35:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704209748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OwajIiXGKStV/z0IMsU+Fr0XyTy0YZLrRynkJ5gSOmo=; b=ERMBnmfTM7XPAGNNV5Aeguj58lOnhz1oyFAwarZAdO6EC79ubZki2C956JXpF9aVd0vRWI 3JegJVkLhO55S6wP8zLlirefROnImI8d3KWNG7W8RMRw2yoLf0RSHxhxI6guX/ZO8aYJC3 RDGxhvMaRWULd/cbhRxBmBmVVSZZDgM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-1PB8t8t1Oum-Zc_LQMCeiA-1; Tue, 02 Jan 2024 10:35:43 -0500 X-MC-Unique: 1PB8t8t1Oum-Zc_LQMCeiA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 48BBC1019DE2; Tue, 2 Jan 2024 15:35:41 +0000 (UTC) Received: from localhost (unknown [10.39.193.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0B151C060AF; Tue, 2 Jan 2024 15:35:39 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Hanna Reitz , qemu-riscv@nongnu.org, Roman Bolshakov , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Elena Ufimtseva , Eduardo Habkost , Thomas Huth , Stefan Hajnoczi , qemu-block@nongnu.org, Andrey Smirnov , Peter Maydell , Huacai Chen , Fam Zheng , Gerd Hoffmann , David Gibson , John Snow , Stafford Horne , Weiwei Li , Jean-Christophe Dubois , Cameron Esfahani , Alexander Graf , David Hildenbrand , Juan Quintela , Nicholas Piggin , Max Filippov , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , Daniel Henrique Barboza , Markus Armbruster , Peter Xu , Vladimir Sementsov-Ogievskiy , Richard Henderson , qemu-s390x@nongnu.org, Jiri Slaby , Pavel Dovgalyuk , Eric Blake , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , Aleksandar Rikalo , "Michael S. Tsirkin" , Jason Wang , Jiaxun Yang , Sunil Muthuswamy , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Fabiano Rosas , Michael Roth , Paul Durrant , Jagannathan Raman , Mark Cave-Ayland , Stefano Stabellini , Hyman Huang , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , xen-devel@lists.xenproject.org, Halil Pasic , Christian Borntraeger , Song Gao , Kevin Wolf , Ilya Leoshkevich , Artyom Tarasenko , Marcel Apfelbaum , Reinoud Zandijk , qemu-ppc@nongnu.org, Marcelo Tosatti , David Woodhouse , Aurelien Jarno , Bin Meng , qemu-arm@nongnu.org, Anthony Perard , Leonardo Bras , Hailiang Zhang , Harsh Prateek Bora , kvm@vger.kernel.org, Palmer Dabbelt , Eric Farman , BALATON Zoltan , Liu Zhiwei Subject: [PATCH v3 3/5] qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql() Date: Tue, 2 Jan 2024 10:35:27 -0500 Message-ID: <20240102153529.486531-4-stefanha@redhat.com> In-Reply-To: <20240102153529.486531-1-stefanha@redhat.com> References: <20240102153529.486531-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.178, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) instead, it is already widely used and unambiguous. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé --- include/qemu/main-loop.h | 10 +++++----- accel/tcg/tcg-accel-ops-rr.c | 4 ++-- hw/display/virtio-gpu.c | 2 +- hw/ppc/spapr_events.c | 2 +- system/cpu-throttle.c | 2 +- system/cpus.c | 4 ++-- target/i386/nvmm/nvmm-accel-ops.c | 2 +- target/i386/whpx/whpx-accel-ops.c | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index c26ad2a029..5764db157c 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -371,17 +371,17 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(BQLLockAuto, bql_auto_unlock) = bql_auto_lock(__FILE__, __LINE__) /* - * qemu_cond_wait_iothread: Wait on condition for the main loop mutex + * qemu_cond_wait_bql: Wait on condition for the Big QEMU Lock (BQL) * - * This function atomically releases the main loop mutex and causes + * This function atomically releases the Big QEMU Lock (BQL) and causes * the calling thread to block on the condition. */ -void qemu_cond_wait_iothread(QemuCond *cond); +void qemu_cond_wait_bql(QemuCond *cond); /* - * qemu_cond_timedwait_iothread: like the previous, but with timeout + * qemu_cond_timedwait_bql: like the previous, but with timeout */ -void qemu_cond_timedwait_iothread(QemuCond *cond, int ms); +void qemu_cond_timedwait_bql(QemuCond *cond, int ms); /* internal interfaces */ diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index c4ea372a3f..5794e5a9ce 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -111,7 +111,7 @@ static void rr_wait_io_event(void) while (all_cpu_threads_idle()) { rr_stop_kick_timer(); - qemu_cond_wait_iothread(first_cpu->halt_cond); + qemu_cond_wait_bql(first_cpu->halt_cond); } rr_start_kick_timer(); @@ -198,7 +198,7 @@ static void *rr_cpu_thread_fn(void *arg) /* wait for initial kick-off after machine start */ while (first_cpu->stopped) { - qemu_cond_wait_iothread(first_cpu->halt_cond); + qemu_cond_wait_bql(first_cpu->halt_cond); /* process any pending work */ CPU_FOREACH(cpu) { diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index b016d3bac8..67c5be1a4e 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1512,7 +1512,7 @@ void virtio_gpu_reset(VirtIODevice *vdev) g->reset_finished = false; qemu_bh_schedule(g->reset_bh); while (!g->reset_finished) { - qemu_cond_wait_iothread(&g->reset_cond); + qemu_cond_wait_bql(&g->reset_cond); } } else { virtio_gpu_reset_bh(g); diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index deb4641505..cb0eeee587 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -899,7 +899,7 @@ void spapr_mce_req_event(PowerPCCPU *cpu, bool recovered) } return; } - qemu_cond_wait_iothread(&spapr->fwnmi_machine_check_interlock_cond); + qemu_cond_wait_bql(&spapr->fwnmi_machine_check_interlock_cond); if (spapr->fwnmi_machine_check_addr == -1) { /* * If the machine was reset while waiting for the interlock, diff --git a/system/cpu-throttle.c b/system/cpu-throttle.c index 786a9a5639..c951a6c65e 100644 --- a/system/cpu-throttle.c +++ b/system/cpu-throttle.c @@ -54,7 +54,7 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque) endtime_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + sleeptime_ns; while (sleeptime_ns > 0 && !cpu->stop) { if (sleeptime_ns > SCALE_MS) { - qemu_cond_timedwait_iothread(cpu->halt_cond, + qemu_cond_timedwait_bql(cpu->halt_cond, sleeptime_ns / SCALE_MS); } else { bql_unlock(); diff --git a/system/cpus.c b/system/cpus.c index 9b68dc9c7c..c8e2772b5f 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -514,12 +514,12 @@ void bql_unlock(void) qemu_mutex_unlock(&bql); } -void qemu_cond_wait_iothread(QemuCond *cond) +void qemu_cond_wait_bql(QemuCond *cond) { qemu_cond_wait(cond, &bql); } -void qemu_cond_timedwait_iothread(QemuCond *cond, int ms) +void qemu_cond_timedwait_bql(QemuCond *cond, int ms) { qemu_cond_timedwait(cond, &bql, ms); } diff --git a/target/i386/nvmm/nvmm-accel-ops.c b/target/i386/nvmm/nvmm-accel-ops.c index f9d5e9a37a..6b2bfd9b9c 100644 --- a/target/i386/nvmm/nvmm-accel-ops.c +++ b/target/i386/nvmm/nvmm-accel-ops.c @@ -48,7 +48,7 @@ static void *qemu_nvmm_cpu_thread_fn(void *arg) } } while (cpu_thread_is_idle(cpu)) { - qemu_cond_wait_iothread(cpu->halt_cond); + qemu_cond_wait_bql(cpu->halt_cond); } qemu_wait_io_event_common(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/whpx-accel-ops.c index e783a760a7..189ae0f140 100644 --- a/target/i386/whpx/whpx-accel-ops.c +++ b/target/i386/whpx/whpx-accel-ops.c @@ -48,7 +48,7 @@ static void *whpx_cpu_thread_fn(void *arg) } } while (cpu_thread_is_idle(cpu)) { - qemu_cond_wait_iothread(cpu->halt_cond); + qemu_cond_wait_bql(cpu->halt_cond); } qemu_wait_io_event_common(cpu); } while (!cpu->unplug || cpu_can_run(cpu));