lkml.org 
[lkml]   [2012]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/5] virtio: add functions for piecewise addition of buffers
On Tue, Dec 18, 2012 at 03:32:15PM +0100, Paolo Bonzini wrote:
> Il 18/12/2012 14:59, Michael S. Tsirkin ha scritto:
> >>> Can't we track state internally to the virtqueue? Exposing it
> >>> seems to buy us nothing since you can't call add_buf between
> >>> start and end anyway.
> >>
> >> I wanted to keep the state for these functions separate from the
> >> rest. I don't think it makes much sense to move it to struct
> >> virtqueue unless virtqueue_add_buf is converted to use the new API
> >> (doesn't make much sense, could even be a tad slower).
> >
> > Why would it be slower?
>
> virtqueue_add_buf could be slower if it used the new API. That's
> because of the overhead of writing and reading from struct
> virtqueue_buf, instead of using variables in registers.

Yes but we'll get rid of virtqueue_buf.

> >> On the other hand moving it there would eliminate the dependency
> >> on virtio_ring.h. Rusty, what do you think?
> >>
> >>> And idea: in practice virtio scsi seems to always call
> >>> sg_init_one, no? So how about we pass in void* or something and
> >>> avoid using sg and count? This would make it useful for -net
> >>> BTW.
> >>
> >> It also passes the scatterlist from the LLD. It calls sg_init_one
> >> for the request/response headers.
> >
> > Try adding a _single variant. You might see unrolling a loop gives
> > more of a benefit than this whole optimization.
>
> Makes sense, I'll try. However, note that I *do* need the
> infrastructure in this patch because virtio-scsi could never use a
> hypothetical virtqueue_add_buf_single; requests always have at least 2
> buffers for the headers.
>
> However I could add virtqueue_add_sg_single and use it for those
> headers.

Right.

> The I/O buffer can keep using virtqueue_add_sg.
>
> Paolo


\
 
 \ /
  Last update: 2012-12-18 16:41    [W:0.061 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site