RE: issue about virtio-net driver to suppoprt vhost mergeable buffer with zero-copy to support PS mode

2010-05-27 Thread Xin, Xiaohui
Michael,
What's you have suggested could avoid to taint the guest virtio-net driver. 
Really thanks!
For the two alternative, the first will do more trick with driver or net-core 
stuff. So currently, I prefer to try the second one. Anyway, let me have a good 
think of it. Thanks!

Thanks
Xiaohui

>-Original Message-
>From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of
>Michael S. Tsirkin
>Sent: Thursday, May 27, 2010 4:20 PM
>To: Xin, Xiaohui
>Cc: net...@vger.kernel.org; kvm@vger.kernel.org; linux-ker...@vger.kernel.org; 
>Herbert
>Xu
>Subject: Re: issue about virtio-net driver to suppoprt vhost mergeable buffer 
>with zero-copy
>to support PS mode
>
>On Thu, May 27, 2010 at 09:21:02AM +0800, Xin, Xiaohui wrote:
>> Michael,
>> I'm now looking into the vhost mergeable buffer, and I tried to use it to 
>> support PS mode
>with zero-copy. And I found an issue there that I have to modify the guest 
>virito-net driver.
>>
>> When guest virtio-net driver submits mergeable buffers, it submits multiple 
>> pages outside.
>In zero-copy case, vhost cannot know which page is used to put header, and 
>which page is
>used to put payload. Then vhost can only reserves 12 bytes for each page. That 
>means, the
>page_offset of the payload DMAed into the guest buffer is always 12 bytes. But 
>guest
>virtio-net driver always use offset 0 to put the data (See 
>receive_mergeable()). That's where
>the zero-copy use mergeable buffer must modify.
>>
>> Have I missed something here? And how do you think about it?
>>
>> Thanks
>> Xiaohui
>
>Maybe you can teach the hardware skip the first 12 bytes: qemu will
>call an ioctl telling hardware what the virtio header size is.
>This is how we plan to do it for tap.
>
>Alternatively, buffers can be used in any order.
>So we can have hardware use N buffers for the packet, and then
>have vhost put the header in buffer N+1.
>
>--
>MST
>--
>To unsubscribe from this list: send the line "unsubscribe kvm" in
>the body of a message to majord...@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: issue about virtio-net driver to suppoprt vhost mergeable buffer with zero-copy to support PS mode

2010-05-27 Thread Michael S. Tsirkin
On Thu, May 27, 2010 at 09:21:02AM +0800, Xin, Xiaohui wrote:
> Michael,
> I'm now looking into the vhost mergeable buffer, and I tried to use it to 
> support PS mode with zero-copy. And I found an issue there that I have to 
> modify the guest virito-net driver.
> 
> When guest virtio-net driver submits mergeable buffers, it submits multiple 
> pages outside. In zero-copy case, vhost cannot know which page is used to put 
> header, and which page is used to put payload. Then vhost can only reserves 
> 12 bytes for each page. That means, the page_offset of the payload DMAed into 
> the guest buffer is always 12 bytes. But guest virtio-net driver always use 
> offset 0 to put the data (See receive_mergeable()). That's where the 
> zero-copy use mergeable buffer must modify.
> 
> Have I missed something here? And how do you think about it?
> 
> Thanks 
> Xiaohui 

Maybe you can teach the hardware skip the first 12 bytes: qemu will
call an ioctl telling hardware what the virtio header size is.
This is how we plan to do it for tap.

Alternatively, buffers can be used in any order.
So we can have hardware use N buffers for the packet, and then
have vhost put the header in buffer N+1.

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html