diff mbox series

[RFC,v2,6/9] vhost: annotate need reply handling

Message ID 20220330134956.18927-7-david.marchand@redhat.com (mailing list archive)
State Superseded
Delegated to: David Marchand
Headers show
Series vhost lock annotations | expand

Commit Message

David Marchand March 30, 2022, 1:49 p.m. UTC
When a reply from the slave is required (VHOST_USER_NEED_REPLY flag),
a spinlock is taken before sending the message.
This spinlock is released if an error occurs when sending the message, and
once a reply is received.

A problem is that this lock is taken under a branch and annotating
conditionally held locks is not supported.
The code seems currently correct and, while we may rework the code,
it is easier to simply skip checks on slave_req_lock for those helpers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
 lib/vhost/vhost_user.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 0cfa2d6f82..273cce5e41 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2854,6 +2854,7 @@  send_vhost_reply(struct virtio_net *dev, int sockfd, struct vhu_msg_context *ctx
 static int
 send_vhost_slave_message(struct virtio_net *dev,
 		struct vhu_msg_context *ctx)
 	int ret;
@@ -3165,6 +3166,7 @@  vhost_user_msg_handler(int vid, int fd)
 static int process_slave_message_reply(struct virtio_net *dev,
 				       const struct vhu_msg_context *ctx)
 	struct vhu_msg_context msg_reply;
 	int ret;