Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Oct 2012 23:03:42 +0000 (UTC)
From:      Peter Grehan <grehan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241469 - head/sys/dev/virtio
Message-ID:  <201210112303.q9BN3gpb000620@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grehan
Date: Thu Oct 11 23:03:42 2012
New Revision: 241469
URL: http://svn.freebsd.org/changeset/base/241469

Log:
  Patch from Bryan to fix a virtqueue issue:
  
      virtqueue: Fix non-indirect virtqueues
  
      We really must walk the entire descriptor chain in order
      to append the to be free'd chain to the existing free
      chain.
  
  Submitted by:	Bryan Venteicher (bryanv@daemoninthecloset.org)
  Reported by:	cognet

Modified:
  head/sys/dev/virtio/virtqueue.c

Modified: head/sys/dev/virtio/virtqueue.c
==============================================================================
--- head/sys/dev/virtio/virtqueue.c	Thu Oct 11 23:02:35 2012	(r241468)
+++ head/sys/dev/virtio/virtqueue.c	Thu Oct 11 23:03:42 2012	(r241469)
@@ -780,8 +780,8 @@ vq_ring_free_chain(struct virtqueue *vq,
 		VQ_RING_ASSERT_CHAIN_TERM(vq);
 
 	vq->vq_free_cnt += dxp->ndescs;
+	dxp->ndescs--;
 
-#ifdef INVARIANTS
 	if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) {
 		while (dp->flags & VRING_DESC_F_NEXT) {
 			VQ_RING_ASSERT_VALID_IDX(vq, dp->next);
@@ -789,10 +789,9 @@ vq_ring_free_chain(struct virtqueue *vq,
 			dxp->ndescs--;
 		}
 	}
-	VQASSERT(vq, dxp->ndescs == 1,
+
+	VQASSERT(vq, dxp->ndescs == 0,
 	    "failed to free entire desc chain, remaining: %d", dxp->ndescs);
-#endif
-	dxp->ndescs = 0;
 
 	/*
 	 * We must append the existing free chain, if any, to the end of



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210112303.q9BN3gpb000620>