Re: [PATCH] virtio_ring: fix packed ring event may missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2019/10/22 上午1:10, Marvin Liu wrote:
When callback is delayed, virtio expect that vhost will kick when
rolling over event offset. Recheck should be taken as used index may
exceed event offset between status check and driver event update.

However, it is possible that flags was not modified if descriptors are
chained or in_order feature was negotiated. So flags at event offset
may not be valid for descriptor's status checking. Fix it by using last
used index as replacement. Tx queue will be stopped if there's not
enough freed buffers after recheck.

Signed-off-by: Marvin Liu <yong.liu@xxxxxxxxx>

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index bdc08244a648..a8041e451e9e 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1499,9 +1499,6 @@ static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq)
  		 * counter first before updating event flags.
  		 */
  		virtio_wmb(vq->weak_barriers);
-	} else {
-		used_idx = vq->last_used_idx;
-		wrap_counter = vq->packed.used_wrap_counter;
  	}
if (vq->packed.event_flags_shadow == VRING_PACKED_EVENT_FLAG_DISABLE) {
@@ -1518,7 +1515,9 @@ static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq)
  	 */
  	virtio_mb(vq->weak_barriers);
- if (is_used_desc_packed(vq, used_idx, wrap_counter)) {
+	if (is_used_desc_packed(vq,
+				vq->last_used_idx,
+				vq->packed.used_wrap_counter)) {
  		END_USE(vq);
  		return false;
  	}


Hi Marvin:

Two questions:

1) Do we support IN_ORDER in kernel driver?

2) Should we check IN_ORDER in this case otherwise we may end up with interrupt storm when IN_ORDER is not negotiated?

Thanks


_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux