> -----Original Message-----
> From: David Marchand <david.march...@redhat.com>
> Sent: Tuesday, February 7, 2023 6:45 PM
> To: dev@dpdk.org
> Cc: maxime.coque...@redhat.com; step...@networkplumber.org; Xia, Chenbo
> <chenbo....@intel.com>; Hu, Jiayu <jiayu...@intel.com>; Wang, YuanX
> <yuanx.w...@intel.com>; Ding, Xuan <xuan.d...@intel.com>;
> m...@smartsharesystems.com
> Subject: [PATCH v6 4/9] vhost: annotate virtqueue access lock
> 
> vhost_user_lock/unlock_all_queue_pairs must be waived since clang
> annotations can't express taking a runtime number of locks.
> 
> vhost_queue_stats_update() requirement can be expressed with a required
> tag.
> 
> Signed-off-by: David Marchand <david.march...@redhat.com>
> Acked-by: Morten Brørup <m...@smartsharesystems.com>
> Reviewed-by: Maxime Coquelin <maxime.coque...@redhat.com>
> ---
> Changes since RFC v3:
> - removed annotations needed for vhost async which went to the next
>   patch,
> 
> ---
>  lib/vhost/vhost_user.c | 2 ++
>  lib/vhost/virtio_net.c | 4 +---
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 60ec1bf5f6..70d221b9f6 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2965,6 +2965,7 @@ vhost_user_check_and_alloc_queue_pair(struct
> virtio_net *dev,
> 
>  static void
>  vhost_user_lock_all_queue_pairs(struct virtio_net *dev)
> +     __rte_no_thread_safety_analysis
>  {
>       unsigned int i = 0;
>       unsigned int vq_num = 0;
> @@ -2982,6 +2983,7 @@ vhost_user_lock_all_queue_pairs(struct virtio_net
> *dev)
> 
>  static void
>  vhost_user_unlock_all_queue_pairs(struct virtio_net *dev)
> +     __rte_no_thread_safety_analysis
>  {
>       unsigned int i = 0;
>       unsigned int vq_num = 0;
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index cc9675ebe5..f2ab6dba15 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -52,12 +52,10 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx,
> uint32_t nr_vring)
>       return (is_tx ^ (idx & 1)) == 0 && idx < nr_vring;
>  }
> 
> -/*
> - * This function must be called with virtqueue's access_lock taken.
> - */
>  static inline void
>  vhost_queue_stats_update(struct virtio_net *dev, struct vhost_virtqueue
> *vq,
>               struct rte_mbuf **pkts, uint16_t count)
> +     __rte_exclusive_locks_required(&vq->access_lock)
>  {
>       struct virtqueue_stats *stats = &vq->stats;
>       int i;
> --
> 2.39.1

Reviewed-by: Chenbo Xia <chenbo....@intel.com> 

Reply via email to