[PATCH v7 0/7] coroutines: generate wrapper code

Vladimir Sementsov-Ogievskiy posted 7 patches 3 years, 10 months ago
Test docker-mingw@fedora passed
Test checkpatch passed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200610100336.23451-1-vsementsov@virtuozzo.com
Maintainers: Cleber Rosa <crosa@redhat.com>, Fam Zheng <fam@euphon.net>, Eduardo Habkost <ehabkost@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
There is a newer version of this series
Makefile                     |   8 +
block/block-gen.h            |  49 +++++
block/coroutines.h           |  65 +++++++
include/block/block.h        |  31 ++--
block.c                      |  97 ++--------
block/io.c                   | 336 +++++------------------------------
tests/test-bdrv-drain.c      |   2 +-
block/Makefile.objs          |   1 +
scripts/coroutine-wrapper.py | 180 +++++++++++++++++++
9 files changed, 388 insertions(+), 381 deletions(-)
create mode 100644 block/block-gen.h
create mode 100644 block/coroutines.h
create mode 100755 scripts/coroutine-wrapper.py
[PATCH v7 0/7] coroutines: generate wrapper code
Posted by Vladimir Sementsov-Ogievskiy 3 years, 10 months ago
Hi all!

The aim of the series is to reduce code-duplication and writing
parameters structure-packing by hand around coroutine function wrappers.

Benefits:
 - no code duplication
 - less indirection

v7: apply Eric's suggestions
02: fix grammar in commit msg, add Eric's r-b
04: - don't create separate header for generated_co_wrapper thing
    - inline aio_wait_kick() call
    - use json.dumps to make style for clang-format
05: - drop "#include "block/generated-co-wrapper.h" (since the header is removed)
    - add Eric's r-b

Vladimir Sementsov-Ogievskiy (7):
  block: return error-code from bdrv_invalidate_cache
  block/io: refactor coroutine wrappers
  block: declare some coroutine functions in block/coroutines.h
  scripts: add coroutine-wrapper.py
  block: generate coroutine-wrapper code
  block: drop bdrv_prwv
  block/io: refactor save/load vmstate

 Makefile                     |   8 +
 block/block-gen.h            |  49 +++++
 block/coroutines.h           |  65 +++++++
 include/block/block.h        |  31 ++--
 block.c                      |  97 ++--------
 block/io.c                   | 336 +++++------------------------------
 tests/test-bdrv-drain.c      |   2 +-
 block/Makefile.objs          |   1 +
 scripts/coroutine-wrapper.py | 180 +++++++++++++++++++
 9 files changed, 388 insertions(+), 381 deletions(-)
 create mode 100644 block/block-gen.h
 create mode 100644 block/coroutines.h
 create mode 100755 scripts/coroutine-wrapper.py

-- 
2.21.0


Re: [PATCH v7 0/7] coroutines: generate wrapper code
Posted by Stefan Hajnoczi 3 years, 9 months ago
On Wed, Jun 10, 2020 at 01:03:29PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Hi all!
> 
> The aim of the series is to reduce code-duplication and writing
> parameters structure-packing by hand around coroutine function wrappers.
> 
> Benefits:
>  - no code duplication
>  - less indirection

Please add documentation so others know when and how to use this.

I suggest adding a docs/devel/coroutine-wrapper.rst document and adding
a code comment to #define generated_co_wrapper pointing to the
documentation.

Please rename coroutine-wrapper.py to block-coroutine-wrapper.py since
it is specific to the block layer.

Stefan
Re: [PATCH v7 0/7] coroutines: generate wrapper code
Posted by Vladimir Sementsov-Ogievskiy 3 years, 9 months ago
27.07.2020 15:48, Stefan Hajnoczi wrote:
> On Wed, Jun 10, 2020 at 01:03:29PM +0300, Vladimir Sementsov-Ogievskiy wrote:
>> Hi all!
>>
>> The aim of the series is to reduce code-duplication and writing
>> parameters structure-packing by hand around coroutine function wrappers.
>>
>> Benefits:
>>   - no code duplication
>>   - less indirection
> 
> Please add documentation so others know when and how to use this.
> 
> I suggest adding a docs/devel/coroutine-wrapper.rst document and adding
> a code comment to #define generated_co_wrapper pointing to the
> documentation.
> 
> Please rename coroutine-wrapper.py to block-coroutine-wrapper.py since
> it is specific to the block layer.
> 

OK, will do. Thanks for taking a look!


-- 
Best regards,
Vladimir

Re: [PATCH v7 0/7] coroutines: generate wrapper code
Posted by Eric Blake 3 years, 8 months ago
On 7/27/20 7:59 AM, Vladimir Sementsov-Ogievskiy wrote:
> 27.07.2020 15:48, Stefan Hajnoczi wrote:
>> On Wed, Jun 10, 2020 at 01:03:29PM +0300, Vladimir Sementsov-Ogievskiy 
>> wrote:
>>> Hi all!
>>>
>>> The aim of the series is to reduce code-duplication and writing
>>> parameters structure-packing by hand around coroutine function wrappers.
>>>
>>> Benefits:
>>>   - no code duplication
>>>   - less indirection
>>
>> Please add documentation so others know when and how to use this.
>>
>> I suggest adding a docs/devel/coroutine-wrapper.rst document and adding
>> a code comment to #define generated_co_wrapper pointing to the
>> documentation.
>>
>> Please rename coroutine-wrapper.py to block-coroutine-wrapper.py since
>> it is specific to the block layer.
>>
> 
> OK, will do. Thanks for taking a look!

As this series touched Makefile to add a generated .c, you'll also need 
to rebase that part to apply on top of Paolo's meson conversion (cc'ing 
him if you need help figuring it out)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Re: [PATCH v7 0/7] coroutines: generate wrapper code
Posted by Paolo Bonzini 3 years, 8 months ago
On 20/08/20 03:33, Eric Blake wrote:
>>>
>>
>> OK, will do. Thanks for taking a look!
> 
> As this series touched Makefile to add a generated .c, you'll also need
> to rebase that part to apply on top of Paolo's meson conversion (cc'ing
> him if you need help figuring it out)

It should be trivial to do so using custom_target.

Paolo