[RFC PATCH v3 2/8] vhost: annotate virtqueue access lock
Maxime Coquelin
maxime.coquelin at redhat.com
Thu Apr 21 17:25:11 CEST 2022
On 4/11/22 13:00, David Marchand wrote:
> This change simply annotates existing paths of the code leading to
> manipulations of the vq->access_lock.
>
> One small change is required: vhost_poll_enqueue_completed was getting
> a queue_id to get hold of the vq, while its callers already knew of
> the vq. For the annotation sake, vq is now directly passed.
It is anyway more consistent with the rest of the code to pass directly
the vq in internal API when queue ID is not needed.
> vhost_user_lock_all_queue_pairs and vhost_user_unlock_all_queue_pairs
> are skipped since vq->access_lock are conditionally held.
As discussed off-list, I wonder whether it could be possible to rework
the conditional lock holding using the static array and some macros so
that we could statically specify for each request if the lock is
required.
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
> lib/vhost/vhost.h | 2 ++
> lib/vhost/vhost_user.c | 2 ++
> lib/vhost/virtio_net.c | 16 ++++++++++++----
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Thanks,
Maxime
More information about the dev
mailing list