From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TipC3-0002wC-Ma for qemu-devel@nongnu.org; Wed, 12 Dec 2012 11:30:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TipBr-00059i-Gb for qemu-devel@nongnu.org; Wed, 12 Dec 2012 11:29:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TipBr-00059T-8v for qemu-devel@nongnu.org; Wed, 12 Dec 2012 11:29:47 -0500 Date: Wed, 12 Dec 2012 18:32:55 +0200 From: "Michael S. Tsirkin" Message-ID: <20121212163255.GC17446@redhat.com> References: <1355144985-12897-1-git-send-email-stefanha@redhat.com> <1355144985-12897-5-git-send-email-stefanha@redhat.com> <20121211141820.GB18753@redhat.com> <20121212155547.GC16956@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121212155547.GC16956@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 04/12] dataplane: add virtqueue vring code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, Blue Swirl , khoa@us.ibm.com, Paolo Bonzini , Asias He On Wed, Dec 12, 2012 at 04:55:47PM +0100, Stefan Hajnoczi wrote: > On Tue, Dec 11, 2012 at 04:18:20PM +0200, Michael S. Tsirkin wrote: > > On Mon, Dec 10, 2012 at 02:09:37PM +0100, Stefan Hajnoczi wrote: > > > + iov->iov_base = hostmem_lookup(&vring->hostmem, desc.addr, desc.len, > > > + desc.flags & VRING_DESC_F_WRITE); > > > + if (!iov->iov_base) { > > > + error_report("Failed to map indirect descriptor" > > > + "addr %#" PRIx64 " len %u", > > > + (uint64_t)desc.addr, desc.len); > > > + vring->broken = true; > > > + return -EFAULT; > > > + } > > > + iov->iov_len = desc.len; > > > + iov++; > > > > Hmm, this assumes a descriptor can not cross a memory > > region boundary. Is this really guaranteed? > > vhost does not make such assumptions. > > Just responded in the other subthread. > > hw/virtio.c doesn't split across memory region boundaries. This suggest > we don't hit this in practice. If it does we'll print the error and > disable the device until virtio reset. > > I can add it to my TODO list. hw/virtio.c also uses exit(1) for > guest-triggerable errors at runtime and I'd like it to do something like > vring->broken above. > > IMO it's not worth trying to perfect these things here. The next step > after this series should be looking at thread-safe memory API so that we > can use hw/virtio.c and improve it for all users. > > Stefan OK