[PATCH v2 0/8] Block layer thread-safety, continued

Emanuele Giuseppe Esposito posted 8 patches 3 years ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210419085541.22310-1-eesposit@redhat.com
Maintainers: Markus Armbruster <armbru@redhat.com>, Xie Changlong <xiechanglong.d@gmail.com>, John Snow <jsnow@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Wen Congyang <wencongyang2@huawei.com>, Fam Zheng <fam@euphon.net>
block.c                   | 28 ++++++--------------
block/block-backend.c     |  4 ---
block/io.c                | 12 +++++++++
block/mirror.c            |  9 -------
block/replication.c       | 54 +++++++++------------------------------
block/write-threshold.c   | 39 ++++++++++++++--------------
blockdev.c                | 26 +++++++++----------
include/block/block.h     |  1 +
include/block/block_int.h | 42 +++++++++++++++++++++++++++++-
util/notify.c             | 13 +++++-----
10 files changed, 113 insertions(+), 115 deletions(-)
[PATCH v2 0/8] Block layer thread-safety, continued
Posted by Emanuele Giuseppe Esposito 3 years ago
This and the following serie of patches are based on Paolo's
v1 patches sent in 2017[*]. They have been ported to the current QEMU
version, but the goal remains the same: 
- make the block layer thread-safe (patches 1-5), and
- remove aio_context_acquire/release (patches 6-8).

[*] = https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg01398.html

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
v1 (2017) -> v2 (2021):
- v1 Patch "block-backup: add reqs_lock" has been dropped, because now
  is completely different from the old version and all functions
  that were affected by it have been moved or deleted. 
  It will be replaced by another serie that aims to thread safety to 
  block/block-copy.c
- remaining v1 patches will be integrated in next serie.
- Patch "block: do not acquire AioContext in check_to_replace_node"
  moves part of the logic of check_to_replace_node to the caller,
  so that the function can be included in the aio_context_acquire/release
  block that follows.

Emanuele Giuseppe Esposito (8):
  block: prepare write threshold code for thread safety
  block: protect write threshold QMP commands from concurrent requests
  util: use RCU accessors for notifiers
  block: make before-write notifiers thread-safe
  block: add a few more notes on locking
  block: do not acquire AioContext in check_to_replace_node
  block/replication: do not acquire AioContext
  block: do not take AioContext around reopen

 block.c                   | 28 ++++++--------------
 block/block-backend.c     |  4 ---
 block/io.c                | 12 +++++++++
 block/mirror.c            |  9 -------
 block/replication.c       | 54 +++++++++------------------------------
 block/write-threshold.c   | 39 ++++++++++++++--------------
 blockdev.c                | 26 +++++++++----------
 include/block/block.h     |  1 +
 include/block/block_int.h | 42 +++++++++++++++++++++++++++++-
 util/notify.c             | 13 +++++-----
 10 files changed, 113 insertions(+), 115 deletions(-)

-- 
2.30.2


Re: [PATCH v2 0/8] Block layer thread-safety, continued
Posted by Paolo Bonzini 3 years ago
On 19/04/21 10:55, Emanuele Giuseppe Esposito wrote:
> This and the following serie of patches are based on Paolo's
> v1 patches sent in 2017[*]. They have been ported to the current QEMU
> version, but the goal remains the same:
> - make the block layer thread-safe (patches 1-5), and
> - remove aio_context_acquire/release (patches 6-8).
> 
> [*] = https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg01398.html
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

This looks good to me, though the commit message of patch 8 needs to be 
rewritten.

Paolo

> ---
> v1 (2017) -> v2 (2021):
> - v1 Patch "block-backup: add reqs_lock" has been dropped, because now
>    is completely different from the old version and all functions
>    that were affected by it have been moved or deleted.
>    It will be replaced by another serie that aims to thread safety to
>    block/block-copy.c
> - remaining v1 patches will be integrated in next serie.
> - Patch "block: do not acquire AioContext in check_to_replace_node"
>    moves part of the logic of check_to_replace_node to the caller,
>    so that the function can be included in the aio_context_acquire/release
>    block that follows.
> 
> Emanuele Giuseppe Esposito (8):
>    block: prepare write threshold code for thread safety
>    block: protect write threshold QMP commands from concurrent requests
>    util: use RCU accessors for notifiers
>    block: make before-write notifiers thread-safe
>    block: add a few more notes on locking
>    block: do not acquire AioContext in check_to_replace_node
>    block/replication: do not acquire AioContext
>    block: do not take AioContext around reopen
> 
>   block.c                   | 28 ++++++--------------
>   block/block-backend.c     |  4 ---
>   block/io.c                | 12 +++++++++
>   block/mirror.c            |  9 -------
>   block/replication.c       | 54 +++++++++------------------------------
>   block/write-threshold.c   | 39 ++++++++++++++--------------
>   blockdev.c                | 26 +++++++++----------
>   include/block/block.h     |  1 +
>   include/block/block_int.h | 42 +++++++++++++++++++++++++++++-
>   util/notify.c             | 13 +++++-----
>   10 files changed, 113 insertions(+), 115 deletions(-)
>