Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

[Xen-devel] Re: [PATCH RFC 3/3] Virtio draft III: example block driver

To: Avi Kivity <avi@xxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH RFC 3/3] Virtio draft III: example block driver
From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Date: Mon, 18 Jun 2007 18:08:15 +1000
Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>, Xen Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>, "jmk@xxxxxxxxxxxxxxxxxxx" <jmk@xxxxxxxxxxxxxxxxxxx>, kvm-devel <kvm-devel@xxxxxxxxxxxxxxxxxxxxx>, virtualization <virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Christian Borntraeger <cborntra@xxxxxxxxxx>, Latchesar Ionkov <lionkov@xxxxxxxx>, Suzanne McIntosh <skranjac@xxxxxxxxxx>, Jens Axboe <jens.axboe@xxxxxxxxxx>, Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Delivery-date: Mon, 18 Jun 2007 01:06:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <46754451.2010305@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1181217762.14054.192.camel@xxxxxxxxxxxxxxxxxxxxx> <1181999552.6237.255.camel@xxxxxxxxxxxxxxxxxxxxx> <1181999669.6237.257.camel@xxxxxxxxxxxxxxxxxxxxx> <1181999825.6237.260.camel@xxxxxxxxxxxxxxxxxxxxx> <1181999920.6237.263.camel@xxxxxxxxxxxxxxxxxxxxx> <46754451.2010305@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Sun, 2007-06-17 at 17:25 +0300, Avi Kivity wrote:
> Rusty Russell wrote:
> > +   /* Set up for reply. */
> > +   vblk->sg[0].page = virt_to_page(&vbr->in_hdr);
> > +   vblk->sg[0].offset = offset_in_page(&vbr->in_hdr);
> > +   vblk->sg[0].length = sizeof(vbr->in_hdr);
> > +   num = blk_rq_map_sg(q, vbr->req, vblk->sg+1);
> > +   vbr->out_hdr.id = vblk->vdev->ops->add_inbuf(vblk->vdev, vblk->sg,
> > +                                                1+num, vbr);
> > +   if (IS_ERR_VALUE(vbr->out_hdr.id))
> > +           goto full;
> > +
> > +   vblk->sg[0].page = virt_to_page(&vbr->out_hdr);
> > +   vblk->sg[0].offset = offset_in_page(&vbr->out_hdr);
> > +   vblk->sg[0].length = sizeof(vbr->out_hdr);
> > +
> > +   vbr->out_id = vblk->vdev->ops->add_outbuf(vblk->vdev, vblk->sg, 1,
> > +                                             vbr);
> 
> This strikes me as wasteful.  Why not set up a single descriptor which 
> contains both placement and the data itself?

We could actually do this for write, but not for read (where the length
& sector need to be sent to other end, and the data comes from other
end).

The strict separation of in and out in virtio is to support both
untrusted inter-guest I/O (admittedly not useful for block devices) and
socket-style hypercall interfaces.

Thanks,
Rusty.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>