[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 for-7.1 5/9] nbd: use a QemuMutex to synchronize yanking,
From: |
Eric Blake |
Subject: |
Re: [PATCH v2 for-7.1 5/9] nbd: use a QemuMutex to synchronize yanking, reconnection and coroutines |
Date: |
Thu, 14 Apr 2022 14:33:50 -0500 |
User-agent: |
NeoMutt/20211029-34-be16c3 |
On Thu, Apr 14, 2022 at 07:57:52PM +0200, Paolo Bonzini wrote:
> The condition for waiting on the s->free_sema queue depends on
> both s->in_flight and s->state. The latter is currently using
> atomics, but this is quite dubious and probably wrong.
>
> Because s->state is written in the main thread too, for example by
> the yank callback, it cannot be protected by a CoMutex. Introduce a
> separate lock that can be used by nbd_co_send_request(); later on this
> lock will also be used for s->state. There will not be any contention
> on the lock unless there is a yank or reconnect, so this is not
> performance sensitive.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/nbd.c | 46 +++++++++++++++++++++++++++-------------------
> 1 file changed, 27 insertions(+), 19 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v2 for-7.1 2/9] nbd: mark more coroutine_fns, (continued)
- [PATCH v2 for-7.1 2/9] nbd: mark more coroutine_fns, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 3/9] nbd: remove peppering of nbd_client_connected, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 4/9] nbd: keep send_mutex/free_sema handling outside nbd_co_do_establish_connection, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 5/9] nbd: use a QemuMutex to synchronize yanking, reconnection and coroutines, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 7/9] nbd: move s->state under requests_lock, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 6/9] nbd: code motion and function renaming, Paolo Bonzini, 2022/04/14
- [PATCH v2 for-7.1 9/9] nbd: document what is protected by the CoMutexes, Paolo Bonzini, 2022/04/14