[PULL 5/6] Replace "iothread lock" with "BQL" in comments

2024-01-08 Thread Stefan Hajnoczi
The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) in their names. Update the code comments to use "BQL" instead of "iothread lock". Signed-off-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paul Durrant Reviewed-by: Akih

[PULL 6/6] Rename "QEMU global mutex" to "BQL" in comments and docs

2024-01-08 Thread Stefan Hajnoczi
The term "QEMU global mutex" is identical to the more widely used Big QEMU Lock ("BQL"). Update the code comments and documentation to use "BQL" instead of "QEMU global mutex". Signed-off-by: Stefan Hajnoczi Acked-by: Markus Armbruster Reviewed-by: P

[PULL 3/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD

2024-01-08 Thread Stefan Hajnoczi
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: Paul Durrant Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Ilya Leoshkevich Reviewed-by: Harsh Pr

[PULL 4/6] qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql()

2024-01-08 Thread Stefan Hajnoczi
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é Reviewed-by: Paul Durrant Reviewed-by: Harsh Prateek Bora

[PULL 2/6] system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

2024-01-08 Thread Stefan Hajnoczi
s and documentation that will be updated in later patches. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paul Durrant Acked-by: Fabiano Rosas Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Peter Xu Acked-by: Eric Farman Reviewed-by: Harsh Prateek Bora Acked-by: Hyman Huang

[PULL 1/6] iothread: Remove unused Error** argument in aio_context_set_aio_params

2024-01-08 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi Message-ID: <20231120171806.19361-1-phi...@linaro.org> --- include/block/aio.h | 3 +-- iothread.c | 3 +-- util/aio-posix.c| 3 +-- util/aio-win32.c| 3 +-- util/main-loop.c| 5 + 5 files changed, 5 insertions(+), 12 deletions(-) diff

[PULL 0/6] Block patches

2024-01-08 Thread Stefan Hajnoczi
--- Pull request Philippe Mathieu-Daudé (1): iothread: Remove unused Error** argument in aio_context_set_aio_params Stefan Hajnoczi (5): system/cpus: rename qemu_mutex_lock_iothread() to bql_lock() qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD qe

Re: [PATCH v3 0/5] Make Big QEMU Lock naming consistent

2024-01-08 Thread Stefan Hajnoczi
On Tue, Jan 02, 2024 at 10:35:24AM -0500, Stefan Hajnoczi wrote: > v3: > - Rebase > - Define bql_lock() macro on a single line [Akihiko Odaki] > v2: > - Rename APIs bql_*() [PeterX] > - Spell out "Big QEMU Lock (BQL)" in doc comments [PeterX] > - Rename "i

[PATCH v3 1/5] system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

2024-01-02 Thread Stefan Hajnoczi
s and documentation that will be updated in later patches. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paul Durrant Acked-by: Fabiano Rosas Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Peter Xu Acked-by: Eric Farman Reviewed-by: Harsh Prateek Bora Acked-by: Hy

[PATCH v3 5/5] Rename "QEMU global mutex" to "BQL" in comments and docs

2024-01-02 Thread Stefan Hajnoczi
The term "QEMU global mutex" is identical to the more widely used Big QEMU Lock ("BQL"). Update the code comments and documentation to use "BQL" instead of "QEMU global mutex". Signed-off-by: Stefan Hajnoczi Acked-by: Markus Armbruster Reviewed-by: Phili

[PATCH v3 2/5] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD

2024-01-02 Thread Stefan Hajnoczi
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: Paul Durrant Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Ilya Leoshkevich --- include/qemu/m

[PATCH v3 4/5] Replace "iothread lock" with "BQL" in comments

2024-01-02 Thread Stefan Hajnoczi
The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) in their names. Update the code comments to use "BQL" instead of "iothread lock". Signed-off-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé --- docs/devel/reset.rst

[PATCH v3 3/5] qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql()

2024-01-02 Thread Stefan Hajnoczi
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

[PATCH v3 0/5] Make Big QEMU Lock naming consistent

2024-01-02 Thread Stefan Hajnoczi
" is easily confused with the unrelated --object iothread (iothread.c). This series updates the code and documentation to consistently use "BQL". This makes the code easier to understand. Stefan Hajnoczi (5): system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

Re: [PATCH v2 1/5] system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

2024-01-02 Thread Stefan Hajnoczi
On Wed, Dec 13, 2023 at 03:37:00PM +0900, Akihiko Odaki wrote: > On 2023/12/13 0:39, Stefan Hajnoczi wrote: > > @@ -312,58 +312,58 @@ bool qemu_in_main_thread(void); > > } while (0) > > /** > > - * qemu_mutex_lock_iothread: Lock the main loop mutex. > > + *

Re: [PATCH v2 04/14] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-12-20 Thread Stefan Hajnoczi
On Tue, 19 Dec 2023 at 13:20, Kevin Wolf wrote: > > Am 19.12.2023 um 16:28 hat Kevin Wolf geschrieben: > > Am 05.12.2023 um 19:20 hat Stefan Hajnoczi geschrieben: > > > aio_context_acquire()/aio_context_release() has been replaced by > > > fine-grained locking to pr

Re: [PATCH v2 04/14] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-12-20 Thread Stefan Hajnoczi
On Wed, 20 Dec 2023 at 04:32, Kevin Wolf wrote: > > Am 19.12.2023 um 22:23 hat Stefan Hajnoczi geschrieben: > > The following hack makes the test pass but there are larger safety > > issues that I'll need to look at on Wednesday: > > I see, you're taking the same appro

Re: [PATCH v2 04/14] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-12-19 Thread Stefan Hajnoczi
The following hack makes the test pass but there are larger safety issues that I'll need to look at on Wednesday: diff --git a/nbd/server.c b/nbd/server.c index 895cf0a752..cf4b7d5c6d 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1617,7 +1617,7 @@ static void nbd_drained_begin(void *opaque)

Re: [PATCH v2 06/14] block: remove AioContext locking

2023-12-19 Thread Stefan Hajnoczi
On Tue, 19 Dec 2023 at 10:59, Kevin Wolf wrote: > > Am 05.12.2023 um 19:20 hat Stefan Hajnoczi geschrieben: > > This is the big patch that removes > > aio_context_acquire()/aio_context_release() from the block layer and > > affected block layer users. > > > &

Re: [PATCH] fix qemu build with xen-4.18.0

2023-12-12 Thread Stefan Hajnoczi
On Tue, 12 Dec 2023 at 11:02, Volodymyr Babchuk wrote: > > > Hi Stefan, > > Stefan Hajnoczi writes: > > > On Tue, 12 Dec 2023 at 10:36, Volodymyr Babchuk > > wrote: > >> > >> Hi Anthony > >> > >> Anthony PERARD writes: > &

Re: [PATCH] fix qemu build with xen-4.18.0

2023-12-12 Thread Stefan Hajnoczi
On Tue, 12 Dec 2023 at 10:36, Volodymyr Babchuk wrote: > > Hi Anthony > > Anthony PERARD writes: > > > On Fri, Dec 08, 2023 at 02:49:27PM -0800, Stefano Stabellini wrote: > >> On Fri, 8 Dec 2023, Daniel P. Berrangé wrote: > >> > On Thu, Dec 07, 2023 at 11:12:48PM +, Michael Young wrote: > >>

[PATCH v2 5/5] Rename "QEMU global mutex" to "BQL" in comments and docs

2023-12-12 Thread Stefan Hajnoczi
The term "QEMU global mutex" is identical to the more widely used Big QEMU Lock ("BQL"). Update the code comments and documentation to use "BQL" instead of "QEMU global mutex". Signed-off-by: Stefan Hajnoczi Acked-by: Markus Armbruster Reviewed-by: Phili

[PATCH v2 2/5] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD

2023-12-12 Thread Stefan Hajnoczi
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: Paul Durrant Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Ilya Leoshkevich --- include/qemu/m

[PATCH v2 4/5] Replace "iothread lock" with "BQL" in comments

2023-12-12 Thread Stefan Hajnoczi
The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) in their names. Update the code comments to use "BQL" instead of "iothread lock". Signed-off-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé --- docs/devel/reset.rst

[PATCH v2 1/5] system/cpus: rename qemu_mutex_lock_iothread() to bql_lock()

2023-12-12 Thread Stefan Hajnoczi
s and documentation that will be updated in later patches. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paul Durrant Acked-by: Fabiano Rosas Acked-by: David Woodhouse Reviewed-by: Cédric Le Goater Acked-by: Peter Xu Acked-by: Eric Farman Reviewed-by: Harsh Prateek Bora --- include/block/

[PATCH v2 0/5] Make Big QEMU Lock naming consistent

2023-12-12 Thread Stefan Hajnoczi
.c). This series updates the code and documentation to consistently use "BQL". This makes the code easier to understand. Stefan Hajnoczi (5): system/cpus: rename qemu_mutex_lock_iothread() to bql_lock() qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to BQL_LOCK_GUARD qemu/main-loop: re

[PATCH v2 3/5] qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql()

2023-12-12 Thread Stefan Hajnoczi
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

Re: [PATCH 1/6] system/cpus: rename qemu_mutex_lock_iothread() to qemu_bql_lock()

2023-12-07 Thread Stefan Hajnoczi
On Fri, Dec 01, 2023 at 10:42:43AM +0530, Harsh Prateek Bora wrote: > On 11/30/23 02:56, Stefan Hajnoczi wrote: > > diff --git a/hw/remote/mpqemu-link.c b/hw/remote/mpqemu-link.c > > index 9bd98e8219..ffb2c25145 100644 > > --- a/hw/remote/mpqemu-link.c > > ++

[PATCH v2 14/14] block: remove outdated AioContext locking comments

2023-12-05 Thread Stefan Hajnoczi
the substance unchanged and just removed mention of the AioContext. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- include/block/block-common.h | 3 -- include/block/block-io.h | 9 ++-- include/block/block_int-common.h | 2 - block.c

[PATCH v2 13/14] job: remove outdated AioContext locking comments

2023-12-05 Thread Stefan Hajnoczi
The AioContext lock no longer exists. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- include/qemu/job.h | 20 1 file changed, 20 deletions(-) diff --git a/include/qemu/job.h b/include/qemu/job.h index e502787dd8..9ea98b5927 100644 --- a/include/qemu/job.h

[PATCH v2 11/14] docs: remove AioContext lock from IOThread docs

2023-12-05 Thread Stefan Hajnoczi
Encourage the use of locking primitives and stop mentioning the AioContext lock since it is being removed. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- docs/devel/multiple-iothreads.txt | 45 +++ 1 file changed, 15 insertions(+), 30 deletions(-) diff

[PATCH v2 10/14] aio: remove aio_context_acquire()/aio_context_release() API

2023-12-05 Thread Stefan Hajnoczi
who helped with this effort, including Eric Blake, code reviewer extraordinaire, and others who I've forgotten to mention. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- include/block/aio.h | 17 - util/async.c| 10 -- 2 files changed, 27 deletions(-)

[PATCH v2 07/14] block: remove bdrv_co_lock()

2023-12-05 Thread Stefan Hajnoczi
The bdrv_co_lock() and bdrv_co_unlock() functions are already no-ops. Remove them. Signed-off-by: Stefan Hajnoczi --- include/block/block-global-state.h | 14 -- block.c| 10 -- blockdev.c | 4 3 files changed, 28

[PATCH v2 12/14] scsi: remove outdated AioContext lock comment

2023-12-05 Thread Stefan Hajnoczi
The SCSI subsystem no longer uses the AioContext lock. Request processing runs exclusively in the BlockBackend's AioContext since "scsi: only access SCSIDevice->requests from one thread" and hence the lock is unnecessary. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake ---

[PATCH v2 05/14] graph-lock: remove AioContext locking

2023-12-05 Thread Stefan Hajnoczi
Stop acquiring/releasing the AioContext lock in bdrv_graph_wrlock()/bdrv_graph_unlock() since the lock no longer has any effect. The distinction between bdrv_graph_wrunlock() and bdrv_graph_wrunlock_ctx() becomes meaningless and they can be collapsed into one function. Signed-off-by: Stefan

[PATCH v2 09/14] aio-wait: draw equivalence between AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED()

2023-12-05 Thread Stefan Hajnoczi
Now that the AioContext lock no longer exists, AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED() are equivalent. A future patch will get rid of AIO_WAIT_WHILE_UNLOCKED(). Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- include/block/aio-wait.h | 16 1 file changed, 4

[PATCH v2 03/14] tests: remove aio_context_acquire() tests

2023-12-05 Thread Stefan Hajnoczi
The aio_context_acquire() API is being removed. Drop the test case that calls the API. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- tests/unit/test-aio.c | 67 +-- 1 file changed, 1 insertion(+), 66 deletions

[PATCH v2 08/14] scsi: remove AioContext locking

2023-12-05 Thread Stefan Hajnoczi
The AioContext lock no longer has any effect. Remove it. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- include/hw/virtio/virtio-scsi.h | 14 -- hw/scsi/scsi-bus.c | 2 -- hw/scsi/scsi-disk.c | 31 +-- hw/scsi/virtio

[PATCH v2 02/14] scsi: assert that callbacks run in the correct AioContext

2023-12-05 Thread Stefan Hajnoczi
Since the removal of AioContext locking, the correctness of the code relies on running requests from a single AioContext at any given time. Add assertions that verify that callbacks are invoked in the correct AioContext. Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c | 14

[PATCH v2 04/14] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-12-05 Thread Stefan Hajnoczi
incrementally. I have performed "make check" and qemu-iotests stress tests across x86-64, ppc64le, and aarch64 to confirm that there are no failures as a result of eliminating the lock. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Acked-by: Kevin Wolf --- util/async.c | 4 ++

[PATCH v2 01/14] virtio-scsi: replace AioContext lock with tmf_bh_lock

2023-12-05 Thread Stefan Hajnoczi
aio_wait_bh_oneshot(). This avoids more locking to protect the virtqueue and SCSI layer state. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- include/hw/virtio/virtio-scsi.h | 3 +- hw/scsi/virtio-scsi.c | 62 ++--- 2 files changed

[PATCH v2 00/14] aio: remove AioContext lock

2023-12-05 Thread Stefan Hajnoczi
nces of case 2 left. If you see one, you've found a bug in this patch series! Patches 11-14 remove comments. Based-on: 20231204164259.1515217-1-stefa...@redhat.com ("[PATCH v2 0/4] scsi: eliminate AioContext lock") Since SCSI needs to stop relying on the AioContext lock before we can

Re: [PATCH 05/12] block: remove AioContext locking

2023-12-04 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 03:31:37PM -0600, Eric Blake wrote: > On Wed, Nov 29, 2023 at 02:55:46PM -0500, Stefan Hajnoczi wrote: > > This is the big patch that removes > > aio_context_acquire()/aio_context_release() from the block layer and > > affected block layer users.

Re: [PATCH 06/12] scsi: remove AioContext locking

2023-12-04 Thread Stefan Hajnoczi
On Mon, Dec 04, 2023 at 01:23:09PM +0100, Kevin Wolf wrote: > Am 29.11.2023 um 20:55 hat Stefan Hajnoczi geschrieben: > > The AioContext lock no longer has any effect. Remove it. > > > > Signed-off-by: Stefan Hajnoczi > > --- > > include/hw/virtio/virtio-scsi.h

Re: [PATCH 05/12] block: remove AioContext locking

2023-12-04 Thread Stefan Hajnoczi
On Mon, Dec 04, 2023 at 03:33:57PM +0100, Kevin Wolf wrote: > Am 29.11.2023 um 20:55 hat Stefan Hajnoczi geschrieben: > > This is the big patch that removes > > aio_context_acquire()/aio_context_release() from the block layer and > > affected block layer users. > >

Re: [PATCH 01/12] virtio-scsi: replace AioContext lock with tmf_bh_lock

2023-12-04 Thread Stefan Hajnoczi
On Mon, Dec 04, 2023 at 01:46:13PM +0100, Kevin Wolf wrote: > Am 29.11.2023 um 20:55 hat Stefan Hajnoczi geschrieben: > > Protect the Task Management Function BH state with a lock. The TMF BH > > runs in the main loop thread. An IOThread might process a TMF at the > > sa

Re: [PATCH 01/12] virtio-scsi: replace AioContext lock with tmf_bh_lock

2023-12-04 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 09:25:52AM -0600, Eric Blake wrote: > On Wed, Nov 29, 2023 at 02:55:42PM -0500, Stefan Hajnoczi wrote: > > Protect the Task Management Function BH state with a lock. The TMF BH > > runs in the main loop thread. An IOThread might process a TMF at the > >

Re: [PATCH 1/6] system/cpus: rename qemu_mutex_lock_iothread() to qemu_bql_lock()

2023-11-30 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 03:08:49PM -0500, Peter Xu wrote: > 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 > > r

Re: [PATCH 6/6] Rename "QEMU global mutex" to "BQL" in comments and docs

2023-11-30 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 02:49:48PM +0100, Philippe Mathieu-Daudé wrote: > On 29/11/23 22:26, Stefan Hajnoczi wrote: > > The term "QEMU global mutex" is identical to the more widely used Big > > QEMU Lock ("BQL"). Update the code comments and documentation to us

Re: [PATCH 5/6] Replace "iothread lock" with "BQL" in comments

2023-11-30 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 02:47:49PM +0100, Philippe Mathieu-Daudé wrote: > Hi Stefan, > > On 29/11/23 22:26, Stefan Hajnoczi wrote: > > The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) > > in their names. Update the code comments to use &quo

Re: [PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql

2023-11-30 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 02:44:07PM +0100, Philippe Mathieu-Daudé wrote: > Hi Stefan, > > On 29/11/23 22:26, Stefan Hajnoczi wrote: > > The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) > > nomenclature. It's a little strange that the actual QemuMutex varia

Re: [PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD

2023-11-30 Thread Stefan Hajnoczi
On Thu, Nov 30, 2023 at 10:14:47AM +0100, Ilya Leoshkevich wrote: > On Wed, 2023-11-29 at 16:26 -0500, Stefan Hajnoczi wrote: > > The name "iothread" is overloaded. Use the term Big QEMU Lock (BQL) > > instead, it is already widely used and unambiguous. > > >

[PATCH 1/6] system/cpus: rename qemu_mutex_lock_iothread() to qemu_bql_lock()

2023-11-29 Thread Stefan Hajnoczi
here are also comments and documentation that will be updated in later patches. Signed-off-by: Stefan Hajnoczi --- include/block/aio-wait.h | 2 +- include/qemu/main-loop.h | 26 +++--- accel/accel-blocker.c| 10 +-- accel/dummy-cpus.c

[PATCH 6/6] Rename "QEMU global mutex" to "BQL" in comments and docs

2023-11-29 Thread Stefan Hajnoczi
The term "QEMU global mutex" is identical to the more widely used Big QEMU Lock ("BQL"). Update the code comments and documentation to use "BQL" instead of "QEMU global mutex". Signed-off-by: Stefan Hajnoczi --- docs/devel/multi-thread-tcg.rst |

[PATCH 3/6] qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql()

2023-11-29 Thread Stefan Hajnoczi
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 --- include/qemu/main-loop.h | 8 accel/tcg/tcg-accel-ops-rr.c | 4 ++-- hw/display/virtio-gpu.c | 2

[PATCH 0/6] Make Big QEMU Lock naming consistent

2023-11-29 Thread Stefan Hajnoczi
QL". This makes the code easier to understand. Stefan Hajnoczi (6): system/cpus: rename qemu_mutex_lock_iothread() to qemu_bql_lock() qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD qemu/main-loop: rename qemu_cond_wait_iothread() to qemu_cond_wait_bql()

[PATCH 5/6] Replace "iothread lock" with "BQL" in comments

2023-11-29 Thread Stefan Hajnoczi
The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) in their names. Update the code comments to use "BQL" instead of "iothread lock". Signed-off-by: Stefan Hajnoczi --- docs/devel/reset.rst | 2 +- hw/display/qxl.h

[PATCH 4/6] system/cpus: rename qemu_global_mutex to qemu_bql

2023-11-29 Thread Stefan Hajnoczi
The APIs using qemu_global_mutex now follow the Big QEMU Lock (BQL) nomenclature. It's a little strange that the actual QemuMutex variable that embodies the BQL is called qemu_global_mutex instead of qemu_bql. Rename it for consistency. Signed-off-by: Stefan Hajnoczi --- system/cpus.c | 20

[PATCH 2/6] qemu/main-loop: rename QEMU_IOTHREAD_LOCK_GUARD to QEMU_BQL_LOCK_GUARD

2023-11-29 Thread Stefan Hajnoczi
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 --- include/qemu/main-loop.h | 20 ++-- hw/i386/kvm/xen_evtchn.c | 14 +++--- hw/i386/kvm/xen_gnttab.c |

[PATCH 12/12] block: remove outdated AioContext locking comments

2023-11-29 Thread Stefan Hajnoczi
the substance unchanged and just removed mention of the AioContext. Signed-off-by: Stefan Hajnoczi --- include/block/block-common.h | 3 -- include/block/block-io.h | 9 ++-- include/block/block_int-common.h | 2 - block.c | 73

[PATCH 11/12] job: remove outdated AioContext locking comments

2023-11-29 Thread Stefan Hajnoczi
The AioContext lock no longer exists. Signed-off-by: Stefan Hajnoczi --- include/qemu/job.h | 20 1 file changed, 20 deletions(-) diff --git a/include/qemu/job.h b/include/qemu/job.h index e502787dd8..9ea98b5927 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h

[PATCH 10/12] scsi: remove outdated AioContext lock comment

2023-11-29 Thread Stefan Hajnoczi
The SCSI subsystem no longer uses the AioContext lock. Request processing runs exclusively in the BlockBackend's AioContext since "scsi: only access SCSIDevice->requests from one thread" and hence the lock is unnecessary. Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c

[PATCH 06/12] scsi: remove AioContext locking

2023-11-29 Thread Stefan Hajnoczi
The AioContext lock no longer has any effect. Remove it. Signed-off-by: Stefan Hajnoczi --- include/hw/virtio/virtio-scsi.h | 14 -- hw/scsi/scsi-bus.c | 2 -- hw/scsi/scsi-disk.c | 28 hw/scsi/virtio-scsi.c | 18

[PATCH 07/12] aio-wait: draw equivalence between AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED()

2023-11-29 Thread Stefan Hajnoczi
Now that the AioContext lock no longer exists, AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED() are equivalent. A future patch will get rid of AIO_WAIT_WHILE_UNLOCKED(). Signed-off-by: Stefan Hajnoczi --- include/block/aio-wait.h | 16 1 file changed, 4 insertions(+), 12

[PATCH 04/12] graph-lock: remove AioContext locking

2023-11-29 Thread Stefan Hajnoczi
Stop acquiring/releasing the AioContext lock in bdrv_graph_wrlock()/bdrv_graph_unlock() since the lock no longer has any effect. The distinction between bdrv_graph_wrunlock() and bdrv_graph_wrunlock_ctx() becomes meaningless and they can be collapsed into one function. Signed-off-by: Stefan

[PATCH 09/12] docs: remove AioContext lock from IOThread docs

2023-11-29 Thread Stefan Hajnoczi
Encourage the use of locking primitives and stop mentioning the AioContext lock since it is being removed. Signed-off-by: Stefan Hajnoczi --- docs/devel/multiple-iothreads.txt | 45 +++ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/docs/devel

[PATCH 08/12] aio: remove aio_context_acquire()/aio_context_release() API

2023-11-29 Thread Stefan Hajnoczi
who helped with this effort, including Eric Blake, code reviewer extraordinaire, and others who I've forgotten to mention. Signed-off-by: Stefan Hajnoczi --- include/block/aio.h | 17 - util/async.c| 10 -- 2 files changed, 27 deletions(-) diff --git a/include/block/aio.h

[PATCH 00/12] aio: remove AioContext lock

2023-11-29 Thread Stefan Hajnoczi
comments. Based-on: 20231123194931.171598-1-stefa...@redhat.com ("[PATCH 0/4] scsi: eliminate AioContext lock") Since SCSI needs to stop relying on the AioContext lock before we can remove the lock. Stefan Hajnoczi (12): virtio-scsi: replace AioContext lock with tmf_bh_lock tes

[PATCH 03/12] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-11-29 Thread Stefan Hajnoczi
incrementally. I have performed "make check" and qemu-iotests stress tests across x86-64, ppc64le, and aarch64 to confirm that there are no failures as a result of eliminating the lock. Signed-off-by: Stefan Hajnoczi --- util/async.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 01/12] virtio-scsi: replace AioContext lock with tmf_bh_lock

2023-11-29 Thread Stefan Hajnoczi
aio_wait_bh_oneshot(). This avoids more locking to protect the virtqueue and SCSI layer state. Signed-off-by: Stefan Hajnoczi --- include/hw/virtio/virtio-scsi.h | 3 +- hw/scsi/virtio-scsi.c | 62 ++--- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git

[PATCH 02/12] tests: remove aio_context_acquire() tests

2023-11-29 Thread Stefan Hajnoczi
The aio_context_acquire() API is being removed. Drop the test case that calls the API. Signed-off-by: Stefan Hajnoczi --- tests/unit/test-aio.c | 67 +-- 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/tests/unit/test-aio.c b/tests/unit/test

Re: [PULL 00/15] xenfv.for-upstream queue

2023-11-07 Thread Stefan Hajnoczi
Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes. signature.asc Description: PGP signature

Re: [PULL 0/7] xenfv-stable queue

2023-11-06 Thread Stefan Hajnoczi
Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes. signature.asc Description: PGP signature

Re: [RFC PATCH v3 08/78] hw/block: add fallthrough pseudo-keyword

2023-10-16 Thread Stefan Hajnoczi
aplane/xen-block.c | 4 ++-- > hw/block/m25p80.c | 2 +- > hw/block/onenand.c | 2 +- > hw/block/pflash_cfi01.c| 1 + > hw/block/pflash_cfi02.c| 6 -- > 5 files changed, 9 insertions(+), 6 deletions(-) Reviewed-by: Stefan Hajnoczi

[PATCH v3 3/4] virtio: use defer_call() in virtio_irqfd_notify()

2023-09-13 Thread Stefan Hajnoczi
-playbooks/-/tree/blk_io_plug-irqfd This duplicates the BH that virtio-blk uses for batching. The next commit will remove it. Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- block/io_uring.c | 6 ++ block/linux-aio.c | 4 hw/virtio/virtio.c | 13

[PATCH v3 2/4] util/defer-call: move defer_call() to util/

2023-09-13 Thread Stefan Hajnoczi
c, my_obj); <-- another ... defer_call_end(); <-- end of section, my_func(my_obj) is called once Suggested-by: Ilya Maximets Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi --- MAINTAINERS | 3 ++- include/qemu/defer-call.h | 16 ++

[PATCH v3 1/4] block: rename blk_io_plug_call() API to defer_call()

2023-09-13 Thread Stefan Hajnoczi
-by: Philippe Mathieu-Daudé Reviewed-by: Paul Durrant Signed-off-by: Stefan Hajnoczi --- include/sysemu/block-backend-io.h | 6 +- block/blkio.c | 8 +-- block/io_uring.c | 4 +- block/linux-aio.c | 4 +- block/nvme.c

[PATCH v3 4/4] virtio-blk: remove batch notification BH

2023-09-13 Thread Stefan Hajnoczi
. Modern drivers enable EVENT_IDX. Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 48 + 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index

[PATCH v3 0/4] virtio-blk: use blk_io_plug_call() instead of notification BH

2023-09-13 Thread Stefan Hajnoczi
are available here: https://gitlab.com/stefanha/virt-playbooks/-/tree/blk_io_plug-irqfd Stefan Hajnoczi (4): block: rename blk_io_plug_call() API to defer_call() util/defer-call: move defer_call() to util/ virtio: use defer_call() in virtio_irqfd_notify() virtio-blk: remove batch notification BH

Re: [PATCH v2 2/4] util/defer-call: move defer_call() to util/

2023-09-13 Thread Stefan Hajnoczi
On Fri, Aug 18, 2023 at 10:31:40AM +0200, Philippe Mathieu-Daudé wrote: > Hi Stefan, > > On 17/8/23 17:58, Stefan Hajnoczi wrote: > > The networking subsystem may wish to use defer_call(), so move the code > > to util/ where it can be reused. > > > > As a r

Re: [PATCH 4/7] block/dirty-bitmap: Clean up local variable shadowing

2023-08-31 Thread Stefan Hajnoczi
else rename variables. > > Signed-off-by: Markus Armbruster > --- > block/monitor/bitmap-qmp-cmds.c | 2 +- > block/qcow2-bitmap.c| 3 +-- > 2 files changed, 2 insertions(+), 3 deletions(-) Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature

Re: [PATCH 5/7] block/vdi: Clean up local variable shadowing

2023-08-31 Thread Stefan Hajnoczi
else rename variables. > > Signed-off-by: Markus Armbruster > --- > block/vdi.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature

Re: [PATCH 6/7] block: Clean up local variable shadowing

2023-08-31 Thread Stefan Hajnoczi
5 files changed, 25 insertions(+), 25 deletions(-) Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature

[PATCH v2 4/4] virtio-blk: remove batch notification BH

2023-08-17 Thread Stefan Hajnoczi
. Modern drivers enable EVENT_IDX. Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 48 + 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index da36fcfd0b..f83bb0f116

[PATCH v2 3/4] virtio: use defer_call() in virtio_irqfd_notify()

2023-08-17 Thread Stefan Hajnoczi
-playbooks/-/tree/blk_io_plug-irqfd This duplicates the BH that virtio-blk uses for batching. The next commit will remove it. Signed-off-by: Stefan Hajnoczi --- block/io_uring.c | 6 ++ block/linux-aio.c | 4 hw/virtio/virtio.c | 11 ++- util/thread-pool.c | 5 + 4 files

[PATCH v2 2/4] util/defer-call: move defer_call() to util/

2023-08-17 Thread Stefan Hajnoczi
c, my_obj); <-- another ... defer_call_end(); <-- end of section, my_func(my_obj) is called once Suggested-by: Ilya Maximets Signed-off-by: Stefan Hajnoczi --- MAINTAINERS | 3 ++- include/qemu/defer-call.h | 15 +++ include/sysemu/block-backend-io.h |

[PATCH v2 1/4] block: rename blk_io_plug_call() API to defer_call()

2023-08-17 Thread Stefan Hajnoczi
-by: Stefan Hajnoczi --- include/sysemu/block-backend-io.h | 6 +- block/blkio.c | 8 +-- block/io_uring.c | 4 +- block/linux-aio.c | 4 +- block/nvme.c | 4 +- block/plug.c | 109

[PATCH v2 0/4] virtio-blk: use blk_io_plug_call() instead of notification BH

2023-08-17 Thread Stefan Hajnoczi
layer configuration) compared to no completion batching. iodepth=1 decreases by ~1% but this could be noise. Benchmark details are available here: https://gitlab.com/stefanha/virt-playbooks/-/tree/blk_io_plug-irqfd Stefan Hajnoczi (4): block: rename blk_io_plug_call() API to defer_call() util

Re: [PATCH] xen-block: fix segv on unrealize

2023-06-06 Thread Stefan Hajnoczi
Sorry! Reviewed-by: Stefan Hajnoczi

[PULL 1/8] block: add blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
()/blk_io_unplug() no longer require a BlockBackend argument because the plug state is now thread-local. Later patches convert block drivers to blk_io_plug_call() and then we can finally remove .bdrv_co_io_plug() once all block drivers have been converted. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake

[PULL 8/8] qapi: add '@fdset' feature for BlockdevOptionsVirtioBlkVhostVdpa

2023-06-01 Thread Stefan Hajnoczi
Hajnoczi Signed-off-by: Stefano Garzarella Message-id: 20230530071941.8954-3-sgarz...@redhat.com Signed-off-by: Stefan Hajnoczi --- qapi/block-core.json | 6 ++ meson.build | 4 2 files changed, 10 insertions(+) diff --git a/qapi/block-core.json b/qapi/block-core.json index

[PULL 6/8] block: remove bdrv_co_io_plug() API

2023-06-01 Thread Stefan Hajnoczi
No block driver implements .bdrv_co_io_plug() anymore. Get rid of the function pointers. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id: 20230530180959.1108766-7-stefa...@redhat.com Signed-off-by: Stefan Hajnoczi

[PULL 5/8] block/linux-aio: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
to laio_unplug_fn(). It is not obvious that this condition affects performance in practice, so I am removing it instead of trying to come up with a more complex mechanism to preserve the condition. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Acked-by: Kevin Wolf Reviewed-by: Stefano

[PULL 2/8] block/nvme: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id

[PULL 7/8] block/blkio: use qemu_open() to support fd passing for virtio-blk

2023-06-01 Thread Stefan Hajnoczi
() to open the `path`, so we can handle fd passing from the management layer through the "/dev/fdset/N" special path. Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefano Garzarella Message-id: 20230530071941.8954-2-sgarz...@redhat.com Signed-off-by: Stefan Hajnoczi --- block/bl

[PULL 4/8] block/io_uring: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id

[PULL 3/8] block/blkio: convert to blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
Stop using the .bdrv_co_io_plug() API because it is not multi-queue block layer friendly. Use the new blk_io_plug_call() API to batch I/O submission instead. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Acked-by: Kevin Wolf Message-id

[PULL 0/8] Block patches

2023-06-01 Thread Stefan Hajnoczi
() series Stefan Hajnoczi (6): block: add blk_io_plug_call() API block/nvme: convert to blk_io_plug_call() API block/blkio: convert to blk_io_plug_call() API block/io_uring: convert to blk_io_plug_call() API block/linux-aio

Re: [PATCH v3 0/6] block: add blk_io_plug_call() API

2023-06-01 Thread Stefan Hajnoczi
On Tue, May 30, 2023 at 02:09:53PM -0400, Stefan Hajnoczi wrote: > v3 > - Patch 5: Mention why dev_max_batch condition was dropped [Stefano] > v2 > - Patch 1: "is not be freed" -> "is not freed" [Eric] > - Patch 2: Remove unused nvme_process_completion_

Re: [PATCH v3 0/6] block: add blk_io_plug_call() API

2023-05-31 Thread Stefan Hajnoczi
Hi Kevin, Do you want to review the thread-local blk_io_plug() patch series or should I merge it? Thanks, Stefan signature.asc Description: PGP signature

  1   2   3   4   >