qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 09/12] iov: add iov_get_ptr() to reference ve


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v3 09/12] iov: add iov_get_ptr() to reference vector data
Date: Thu, 22 Nov 2012 12:38:45 +0200

On Thu, Nov 22, 2012 at 10:52:27AM +0100, Paolo Bonzini wrote:
> Il 22/11/2012 10:45, Michael S. Tsirkin ha scritto:
> > All this looks suspiciously like premature optimization to me.
> > Do we have data to show avoiding header copy is a win?
> 
> The code is a little simpler, because we know the footer is 1 byte only.
> 
> Paolo

Yes but the APIs don't make sense in the generic case
of >1 byte: users will have to code up two paths for when
the buffer they want to access gets scattered across.
So this looks like a future source of errors:
it's better to avoid poking at guest memory directly.

If the point is to avoid scanning iov vector when data is towards the
end of the iov, then this does sound reasonable.  In that case IMHO we
should just have accessors that work back from end of the iov. E.g.

size_t iov_from_buf_end(const struct iovec *iov, unsigned int iov_cnt,
                        size_t offset, const void *buf, size_t bytes)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]