[v4,4/9] vhost: annotate virtqueue access lock
Checks
Commit Message
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.marchand@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(-)
Comments
On 1/19/23 19:46, David Marchand wrote:
> 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.marchand@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(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
@@ -2955,6 +2955,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;
@@ -2972,6 +2973,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;
@@ -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;