From mboxrd@z Thu Jan 1 00:00:00 1970 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 3EBC6C4167B for ; Thu, 30 Nov 2023 20:09:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8nLK-000865-AD; Thu, 30 Nov 2023 15:09:02 -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 1r8nLI-00083d-Li for qemu-riscv@nongnu.org; Thu, 30 Nov 2023 15:09:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8nLF-0002fK-V1 for qemu-riscv@nongnu.org; Thu, 30 Nov 2023 15:09:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701374937; 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: in-reply-to:in-reply-to:references:references; bh=vQ5m3o7+UqdtWYSDU6QubOO0VIH9lcTK3EaDyGHvbxw=; b=TUgxmHM9JwEJ2vungQdnKYHPrNSGZqPYc5G12Qf5g9KY/XcvcFZDxf2kyZMTYnTxddX9P5 0IsZ+/UFhuEVfaJ77yEAueTCv0zgJ8lHuI30DRBddkCPqkOQjkh7eNAWC4q0RC9qRd/yAX +ofgjUeMscWwgOxvhnVg2HbG52LCOCk= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-BJfHyidYP_etVuTI5ZqD9Q-1; Thu, 30 Nov 2023 15:08:55 -0500 X-MC-Unique: BJfHyidYP_etVuTI5ZqD9Q-1 Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-58dc1a18554so210192eaf.1 for ; Thu, 30 Nov 2023 12:08:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701374935; x=1701979735; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vQ5m3o7+UqdtWYSDU6QubOO0VIH9lcTK3EaDyGHvbxw=; b=SXz7GJkeyfPogw6Ln4yMjyOEq9B89Kzw712K7j541M/Z2eWsIqJp80OWI1yjoact0L PlxA918wmFLDQOACOM93lyvS1Y8yDlPV3Gdt+g6CYrIcIREN8DztHaRY/hKk+7cGpovY erEZmSqIkyaj9Ux5efw+DllauciS3ToAZgQOPi0kMb6DROt3+mfnYkma374hS1GidlhI XlDi8lMmIy9jTh2kcM0IlkTJN5dbo0iI5HNJd2PVM9KPB1xgkb9JiwZ9ma434iF+cCHw UUNpGng3z17z4HXbiLPtischZLjilsgoLHI/AaRiVxVgcroiecFdhLPEbeR4G+HD6WoB +XRQ== X-Gm-Message-State: AOJu0YyCB8grGf4YUTncmkOSYVBCPL9lQhkZM6WSrL2mZd2c4IyxR72P J0sgl8zwy2z5/N78DGrgidDAWG+FWC7FGldgndphyRppGrlQCepi+ZL3auKpgy4vUk+XDkwrAbD 2d03hHLrZmVYSYqg= X-Received: by 2002:a05:6820:a8f:b0:58d:e3d3:ec72 with SMTP id de15-20020a0568200a8f00b0058de3d3ec72mr3219686oob.0.1701374934948; Thu, 30 Nov 2023 12:08:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFrVwMaTOwUyaQhegCiYW255oqkz3A1nA2DFXZquNCGnC+wsIvv9V9+I7etJ6uoaw71Bi5Lw== X-Received: by 2002:a05:6820:a8f:b0:58d:e3d3:ec72 with SMTP id de15-20020a0568200a8f00b0058de3d3ec72mr3219606oob.0.1701374934634; Thu, 30 Nov 2023 12:08:54 -0800 (PST) Received: from x1n (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id qr13-20020a05620a390d00b0077d5e1e4edesm790071qkn.57.2023.11.30.12.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:08:54 -0800 (PST) Date: Thu, 30 Nov 2023 15:08:49 -0500 From: Peter Xu To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Jean-Christophe Dubois , Fabiano Rosas , qemu-s390x@nongnu.org, Song Gao , Marcel Apfelbaum , Thomas Huth , Hyman Huang , Marcelo Tosatti , David Woodhouse , Andrey Smirnov , Peter Maydell , Kevin Wolf , Ilya Leoshkevich , Artyom Tarasenko , Mark Cave-Ayland , Max Filippov , Alistair Francis , Paul Durrant , Jagannathan Raman , Juan Quintela , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , qemu-arm@nongnu.org, Jason Wang , Gerd Hoffmann , Hanna Reitz , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , BALATON Zoltan , Daniel Henrique Barboza , Elena Ufimtseva , Aurelien Jarno , Hailiang Zhang , Roman Bolshakov , Huacai Chen , Fam Zheng , Eric Blake , Jiri Slaby , Alexander Graf , Liu Zhiwei , Weiwei Li , Eric Farman , Stafford Horne , David Hildenbrand , Markus Armbruster , Reinoud Zandijk , Palmer Dabbelt , Cameron Esfahani , xen-devel@lists.xenproject.org, Pavel Dovgalyuk , qemu-riscv@nongnu.org, Aleksandar Rikalo , John Snow , Sunil Muthuswamy , Michael Roth , David Gibson , "Michael S. Tsirkin" , Richard Henderson , Bin Meng , Stefano Stabellini , kvm@vger.kernel.org, qemu-block@nongnu.org, Halil Pasic , Anthony Perard , Harsh Prateek Bora , Alex =?utf-8?Q?Benn=C3=A9e?= , Eduardo Habkost , Paolo Bonzini , Vladimir Sementsov-Ogievskiy , =?utf-8?Q?C=C3=A9dric?= Le Goater , qemu-ppc@nongnu.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Christian Borntraeger , Akihiko Odaki , Leonardo Bras , Nicholas Piggin , Jiaxun Yang Subject: Re: [PATCH 1/6] system/cpus: rename qemu_mutex_lock_iothread() to qemu_bql_lock() Message-ID: References: <20231129212625.1051502-1-stefanha@redhat.com> <20231129212625.1051502-2-stefanha@redhat.com> MIME-Version: 1.0 In-Reply-To: <20231129212625.1051502-2-stefanha@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H4=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-riscv@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-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org On Wed, Nov 29, 2023 at 04:26:20PM -0500, Stefan Hajnoczi wrote: > The Big QEMU Lock (BQL) has many names and they are confusing. The > actual QemuMutex variable is called qemu_global_mutex but it's commonly > referred to as the BQL in discussions and some code comments. The > locking APIs, however, are called qemu_mutex_lock_iothread() and > qemu_mutex_unlock_iothread(). > > The "iothread" name is historic and comes from when the main thread was > split into into KVM vcpu threads and the "iothread" (now called the main > loop thread). I have contributed to the confusion myself by introducing > a separate --object iothread, a separate concept unrelated to the BQL. > > The "iothread" name is no longer appropriate for the BQL. Rename the > locking APIs to: > - void qemu_bql_lock(void) > - void qemu_bql_unlock(void) > - bool qemu_bql_locked(void) > > There are more APIs with "iothread" in their names. Subsequent patches > will rename them. There are also comments and documentation that will be > updated in later patches. > > Signed-off-by: Stefan Hajnoczi Acked-by: Peter Xu Two nickpicks: - BQL contains "QEMU" as the 2nd character, so maybe easier to further rename qemu_bql into bql_? - Could we keep the full spell of BQL at some places, so people can still reference it if not familiar? IIUC most of the BQL helpers will root back to the major three functions (_lock, _unlock, _locked), perhaps add a comment of "BQL stands for..." over these three functions as comment? Please take or ignore these nitpicks; my ACK will stand irrelevant. Thanks, -- Peter Xu