From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D67E641B9E; Wed, 1 Feb 2023 12:16:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6F0842D48; Wed, 1 Feb 2023 12:16:04 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 8F52A42D0B for ; Wed, 1 Feb 2023 12:16:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675250163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TCCOUdVbh6jnQrrKIYzLb1VcbhQ5FcWsYUp9/MInLbo=; b=e8IU47wzpuDdPyoTXOAEY/Z3r3XC5ufwgvTXcqxSWvEpYwJYANO1g1gVDU/PiNOJ5pnFdc Sq6mapOX0uhIe4YShy+n8/Rlb9ULqJUJ+JJltUh3ThJG5InAZnXQlMb8QkWeW4XJpjE0KH 7o8Z/NI44y2idSXoBTyxvSvEp+0aFoc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-ENogrSDEOmqe4TgT3onheQ-1; Wed, 01 Feb 2023 06:16:02 -0500 X-MC-Unique: ENogrSDEOmqe4TgT3onheQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 981D8380606C; Wed, 1 Feb 2023 11:16:01 +0000 (UTC) Received: from dmarchan.redhat.com (ovpn-192-67.brq.redhat.com [10.40.192.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17043140EBF4; Wed, 1 Feb 2023 11:15:59 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, stephen@networkplumber.org, chenbo.xia@intel.com, jiayu.hu@intel.com, yuanx.wang@intel.com, xuan.ding@intel.com, mb@smartsharesystems.com Subject: [PATCH v5 4/9] vhost: annotate virtqueue access lock Date: Wed, 1 Feb 2023 12:14:06 +0100 Message-Id: <20230201111411.1509520-5-david.marchand@redhat.com> In-Reply-To: <20230201111411.1509520-1-david.marchand@redhat.com> References: <20220328121758.26632-1-david.marchand@redhat.com> <20230201111411.1509520-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Morten Brørup Reviewed-by: Maxime Coquelin --- 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 3f6c5df900..c57f092975 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -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; diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index 2a75cda7b6..f05e379316 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