[RFC PATCH 0/4] aio: AIO_CONTEXT_ACQUIRE_GUARD() macro experiment

Philippe Mathieu-Daudé posted 4 patches 2 years, 6 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211005185807.4134557-1-philmd@redhat.com
include/block/aio.h    | 24 ++++++++++++++++++++++++
hw/block/virtio-blk.c  | 26 ++++++++++++--------------
hw/scsi/scsi-disk.c    | 13 ++++---------
hw/scsi/scsi-generic.c |  6 +++---
4 files changed, 43 insertions(+), 26 deletions(-)
[RFC PATCH 0/4] aio: AIO_CONTEXT_ACQUIRE_GUARD() macro experiment
Posted by Philippe Mathieu-Daudé 2 years, 6 months ago
Experiment to use glib g_autoptr/autofree features with
AIO context.
Since this is a RFC, only few examples are provided.

TODO: Document the macros in docs/devel/multiple-iothreads.txt

Philippe Mathieu-Daudé (4):
  block/aio: Add automatically released aio_context variants
  hw/scsi/scsi-disk: Use automatic AIO context lock
  hw/scsi/scsi-generic: Use automatic AIO context lock
  hw/block/virtio-blk: Use automatic AIO context lock

 include/block/aio.h    | 24 ++++++++++++++++++++++++
 hw/block/virtio-blk.c  | 26 ++++++++++++--------------
 hw/scsi/scsi-disk.c    | 13 ++++---------
 hw/scsi/scsi-generic.c |  6 +++---
 4 files changed, 43 insertions(+), 26 deletions(-)

-- 
2.31.1


Re: [RFC PATCH 0/4] aio: AIO_CONTEXT_ACQUIRE_GUARD() macro experiment
Posted by Stefan Hajnoczi 2 years, 6 months ago
On Tue, Oct 05, 2021 at 08:58:03PM +0200, Philippe Mathieu-Daudé wrote:
> Experiment to use glib g_autoptr/autofree features with
> AIO context.
> Since this is a RFC, only few examples are provided.
> 
> TODO: Document the macros in docs/devel/multiple-iothreads.txt
> 
> Philippe Mathieu-Daudé (4):
>   block/aio: Add automatically released aio_context variants
>   hw/scsi/scsi-disk: Use automatic AIO context lock
>   hw/scsi/scsi-generic: Use automatic AIO context lock
>   hw/block/virtio-blk: Use automatic AIO context lock
> 
>  include/block/aio.h    | 24 ++++++++++++++++++++++++
>  hw/block/virtio-blk.c  | 26 ++++++++++++--------------
>  hw/scsi/scsi-disk.c    | 13 ++++---------
>  hw/scsi/scsi-generic.c |  6 +++---
>  4 files changed, 43 insertions(+), 26 deletions(-)

This is nice. Two things:

1. Emanuele is working on eliminating aio_context_acquire/release(), so
   a big effort to convert existing code to using guards could be wasted
   energy and cause conflicts with his patches.

2. A few callers anticipate that the AioContext of their BDS may change
   between acquire/release. Care needs to be taken when converting to
   preserve the semantics but most instances should be safe to convert.

Stefan
Re: [RFC PATCH 0/4] aio: AIO_CONTEXT_ACQUIRE_GUARD() macro experiment
Posted by Philippe Mathieu-Daudé 2 years, 6 months ago
On 10/7/21 15:15, Stefan Hajnoczi wrote:
> On Tue, Oct 05, 2021 at 08:58:03PM +0200, Philippe Mathieu-Daudé wrote:
>> Experiment to use glib g_autoptr/autofree features with
>> AIO context.
>> Since this is a RFC, only few examples are provided.
>>
>> TODO: Document the macros in docs/devel/multiple-iothreads.txt
>>
>> Philippe Mathieu-Daudé (4):
>>   block/aio: Add automatically released aio_context variants
>>   hw/scsi/scsi-disk: Use automatic AIO context lock
>>   hw/scsi/scsi-generic: Use automatic AIO context lock
>>   hw/block/virtio-blk: Use automatic AIO context lock
>>
>>  include/block/aio.h    | 24 ++++++++++++++++++++++++
>>  hw/block/virtio-blk.c  | 26 ++++++++++++--------------
>>  hw/scsi/scsi-disk.c    | 13 ++++---------
>>  hw/scsi/scsi-generic.c |  6 +++---
>>  4 files changed, 43 insertions(+), 26 deletions(-)
> 
> This is nice. Two things:
> 
> 1. Emanuele is working on eliminating aio_context_acquire/release(), so
>    a big effort to convert existing code to using guards could be wasted
>    energy and cause conflicts with his patches.

Thanks for the update, I'll wait Emanuele effort to land.

> 2. A few callers anticipate that the AioContext of their BDS may change
>    between acquire/release. Care needs to be taken when converting to
>    preserve the semantics but most instances should be safe to convert.
> 
> Stefan
>