[RFC,v3,5/8] vhost: annotate need reply handling
Commit Message
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(+)
Comments
On 4/11/22 13:00, David Marchand wrote:
> 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 --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index ee276a28f1..d101d5072f 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)
> + __rte_no_thread_safety_analysis
> {
> 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)
> + __rte_no_thread_safety_analysis
> {
> struct vhu_msg_context msg_reply;
> int ret;
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
@@ -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)
+ __rte_no_thread_safety_analysis
{
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)
+ __rte_no_thread_safety_analysis
{
struct vhu_msg_context msg_reply;
int ret;