From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiof8-0006BB-MC for qemu-devel@nongnu.org; Wed, 12 Dec 2012 10:56:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tiof1-0004aV-5a for qemu-devel@nongnu.org; Wed, 12 Dec 2012 10:55:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tiof0-0004aK-Sd for qemu-devel@nongnu.org; Wed, 12 Dec 2012 10:55:51 -0500 Date: Wed, 12 Dec 2012 16:55:47 +0100 From: Stefan Hajnoczi Message-ID: <20121212155547.GC16956@stefanha-thinkpad.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121211141820.GB18753@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: "Michael S. Tsirkin" Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, Blue Swirl , khoa@us.ibm.com, Paolo Bonzini , Asias He 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