From owner-svn-src-head@FreeBSD.ORG Thu Oct 11 23:03:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18912B8A; Thu, 11 Oct 2012 23:03:43 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C508FC0A; Thu, 11 Oct 2012 23:03:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9BN3gen000622; Thu, 11 Oct 2012 23:03:42 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9BN3gpb000620; Thu, 11 Oct 2012 23:03:42 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201210112303.q9BN3gpb000620@svn.freebsd.org> From: Peter Grehan Date: Thu, 11 Oct 2012 23:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241469 - head/sys/dev/virtio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2012 23:03:43 -0000 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