From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 154D25F1D for ; Thu, 31 Jan 2019 16:51:07 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51B048535D; Thu, 31 Jan 2019 15:51:06 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-200.ams2.redhat.com [10.36.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BFEE5C23E; Thu, 31 Jan 2019 15:50:54 +0000 (UTC) From: Kevin Traynor To: Ilya Maximets Cc: Shahaf Shuler , Maxime Coquelin , "Michael S . Tsirkin" , dpdk stable Date: Thu, 31 Jan 2019 15:48:49 +0000 Message-Id: <20190131154901.5383-41-ktraynor@redhat.com> In-Reply-To: <20190131154901.5383-1-ktraynor@redhat.com> References: <20190131154901.5383-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 31 Jan 2019 15:51:06 +0000 (UTC) Subject: [dpdk-stable] patch 'net/virtio: add barrier before reading the flags' has been queued to LTS release 18.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 15:51:07 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >>From 60b2f24165822233009a22a81e2bfa2d90650f12 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Wed, 9 Jan 2019 17:50:13 +0300 Subject: [PATCH] net/virtio: add barrier before reading the flags [ upstream commit d21d05c7a9c1c49ec927f961c4ab797a598af5ca ] Reading the used->flags could be reordered with avail->idx update. vhost in kernel disables notifications for the time of packets receiving, like this: 1. disable notify 2. process packets 3. enable notify 4. has more packets ? goto 1 In case of reordering, virtio driver could read the flags on step 2 while notifications disabled and update avail->idx after the step 4, i.e. vhost will exit the loop on step 4 with notifications enabled, but virtio will not notify. Fixes: c1f86306a026 ("virtio: add new driver") Reported-by: Shahaf Shuler Signed-off-by: Ilya Maximets Reviewed-by: Maxime Coquelin Acked-by: Michael S. Tsirkin --- drivers/net/virtio/virtqueue.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 26518ed98..2e2abf15b 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -337,4 +337,9 @@ static inline int virtqueue_kick_prepare(struct virtqueue *vq) { + /* + * Ensure updated avail->idx is visible to vhost before reading + * the used->flags. + */ + virtio_mb(); return !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY); } -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-31 15:44:06.699131544 +0000 +++ 0041-net-virtio-add-barrier-before-reading-the-flags.patch 2019-01-31 15:44:05.000000000 +0000 @@ -1,8 +1,10 @@ -From d21d05c7a9c1c49ec927f961c4ab797a598af5ca Mon Sep 17 00:00:00 2001 +From 60b2f24165822233009a22a81e2bfa2d90650f12 Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Wed, 9 Jan 2019 17:50:13 +0300 Subject: [PATCH] net/virtio: add barrier before reading the flags +[ upstream commit d21d05c7a9c1c49ec927f961c4ab797a598af5ca ] + Reading the used->flags could be reordered with avail->idx update. vhost in kernel disables notifications for the time of packets receiving, like this: @@ -18,21 +20,20 @@ notifications enabled, but virtio will not notify. Fixes: c1f86306a026 ("virtio: add new driver") -Cc: stable@dpdk.org Reported-by: Shahaf Shuler Signed-off-by: Ilya Maximets Reviewed-by: Maxime Coquelin Acked-by: Michael S. Tsirkin --- - drivers/net/virtio/virtqueue.h | 8 ++++++++ - 1 file changed, 8 insertions(+) + drivers/net/virtio/virtqueue.h | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h -index d8ae5cdec..dffa03669 100644 +index 26518ed98..2e2abf15b 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h -@@ -416,4 +416,9 @@ static inline int +@@ -337,4 +337,9 @@ static inline int virtqueue_kick_prepare(struct virtqueue *vq) { + /* @@ -42,14 +43,6 @@ + virtio_mb(); return !(vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY); } -@@ -424,4 +429,7 @@ virtqueue_kick_prepare_packed(struct virtqueue *vq) - uint16_t flags; - -+ /* -+ * Ensure updated data is visible to vhost before reading the flags. -+ */ - virtio_mb(); - flags = vq->ring_packed.device_event->desc_event_flags; -- 2.19.0