Re: QEMU PIC indirection patch for in-kernel APIC work

Avi Kivity
2007-04-09T07:10:20Z

Rusty Russell wrote:
> On Sun, 2007-04-08 at 08:36 +0300, Avi Kivity wrote:
>
>> Rusty Russell wrote:
>>
>>> Hi Avi,
>>>
>>> I don't think you've thought about this very hard. The receive copy is
>>> completely independent with whether the packet is going to the guest via
>>> a kernel driver or via userspace, so not relevant.
>>>
>>>
>> A packet received in the kernel cannot be made available to userspace in
>> a safe manner without a copy, as it will not be aligned with page
>> boundaries, so userspace cannot examine the packet until after one copy
>> has occured.
>>
>
> Hi Avi!
>
> I'm a little puzzled by your response. Hmm...
>
> lguest's userspace network frontend does exactly as many copies as
> Ingo's in-host-kernel code. One from the Guest, one to the Guest.
>
>

kvm pvnet is suboptimal now. The number of copies could be reduced by
two (to zero), by constructing an skb that points to guest memory.
Right now, this can only be done in-kernel.

With current userspace networking interfaces, one cannot build a network
device that has less than one copy on transmit, because sendmsg() *must*
copy the data (as there is no completion notification). sendfilev(),
even if it existed, cannot be used: it is copyless, but lacks completion
notification. It is useful only on unchanging data like read-only files.

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.