All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Xin, Xiaohui" <xiaohui.xin@intel.com>
To: Shirley Ma <mashirle@us.ibm.com>, Avi Kivity <avi@redhat.com>
Cc: David Miller <davem@davemloft.net>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"mst@redhat.com" <mst@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [RFC PATCH 2/2] macvtap: TX zero copy between guest and host kernel
Date: Wed, 15 Sep 2010 09:50:22 +0800	[thread overview]
Message-ID: <F2E9EB7348B8264F86B6AB8151CE2D792B8C8152A0@shsmsx502.ccr.corp.intel.com> (raw)
In-Reply-To: <1284476719.13351.35.camel@localhost.localdomain>

>From: Shirley Ma [mailto:mashirle@us.ibm.com]
>Sent: Tuesday, September 14, 2010 11:05 PM
>To: Avi Kivity
>Cc: David Miller; arnd@arndb.de; mst@redhat.com; Xin, Xiaohui; netdev@vger.kernel.org;
>kvm@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: Re: [RFC PATCH 2/2] macvtap: TX zero copy between guest and host kernel
>
>On Tue, 2010-09-14 at 11:12 +0200, Avi Kivity wrote:
>> >> +            base = (unsigned long)from->iov_base + offset1;
>> >> +            size = ((base&  ~PAGE_MASK) + len + ~PAGE_MASK)>>
>> PAGE_SHIFT;
>> >> +            num_pages = get_user_pages_fast(base, size,
>> 0,&page[i]);
>> >> +            if ((num_pages != size) ||
>> >> +                (num_pages>  MAX_SKB_FRAGS -
>> skb_shinfo(skb)->nr_frags))
>> >> +                    /* put_page is in skb free */
>> >> +                    return -EFAULT;
>> > What keeps the user from writing to these pages in it's address
>> space
>> > after the write call returns?
>> >
>> > A write() return of success means:
>> >
>> >       "I wrote what you gave to me"
>> >
>> > not
>> >
>> >       "I wrote what you gave to me, oh and BTW don't touch these
>> >           pages for a while."
>> >
>> > In fact "a while" isn't even defined in any way, as there is no way
>> > for the write() invoker to know when the networking card is done
>> with
>> > those pages.
>>
>> That's what io_submit() is for.  Then io_getevents() tells you what
>> "a
>> while" actually was.
>
>This macvtap zero copy uses iov buffers from vhost ring, which is
>allocated from guest kernel. In host kernel, vhost calls macvtap
>sendmsg. macvtap sendmsg calls get_user_pages_fast to pin these buffers'
>pages for zero copy.
>
>The patch is relying on how vhost handle these buffers. I need to look
>at vhost code (qemu) first for addressing the questions here.
>
>Thanks
>Shirley

I think what David said is what we have thought before in mp device.
Since we are not sure the exact time the tx buffer was wrote though DMA operation.
But the deadline is when the tx buffer was freed. So we only notify the vhost stuff
about the write when tx buffer freed. But the deadline is maybe too late for performance.

Thanks
Xiaohui 


  parent reply	other threads:[~2010-09-15  1:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 20:43 [RFC PATCH 0/1] macvtap TX zero copy between guest and host kernel Shirley Ma
2010-09-13 20:47 ` RFC PATCH 1/2] macvtap: A new sock zero copy flag Shirley Ma
2010-09-13 20:48 ` [RFC PATCH 2/2] macvtap: TX zero copy between guest and host kernel Shirley Ma
2010-09-14  3:17   ` David Miller
2010-09-14  9:12     ` Avi Kivity
2010-09-14 15:05       ` Shirley Ma
2010-09-14 15:21         ` Arnd Bergmann
2010-09-14 15:22           ` Michael S. Tsirkin
2010-09-14 16:00             ` Shirley Ma
2010-09-14 16:29               ` Michael S. Tsirkin
2010-09-14 17:02                 ` Shirley Ma
2010-09-14 18:27                   ` Michael S. Tsirkin
2010-09-14 18:49                     ` Shirley Ma
2010-09-14 19:01                       ` Michael S. Tsirkin
2010-09-14 19:20                         ` Shirley Ma
2010-09-15  5:31                           ` Michael S. Tsirkin
2010-09-14 19:36                         ` Shirley Ma
2010-09-15  5:12                           ` Michael S. Tsirkin
2010-09-15  6:21                             ` Shirley Ma
2010-09-15 10:10                               ` Michael S. Tsirkin
2010-09-15 14:52                                 ` Shirley Ma
2010-09-15 15:04                                   ` Michael S. Tsirkin
2010-09-15 15:39                                     ` Michael S. Tsirkin
2010-09-15 17:00                                       ` Shirley Ma
2010-09-15 17:30                                         ` Michael S. Tsirkin
2010-09-15 18:48                                           ` Shirley Ma
2010-09-29  3:24                                   ` Shirley Ma
2010-09-29  8:16                                     ` Michael S. Tsirkin
2010-09-29  8:28                                       ` Michael S. Tsirkin
2010-09-29 14:33                                         ` Shirley Ma
2010-09-29 14:56                                         ` Shirley Ma
2010-09-29 14:31                                       ` Shirley Ma
2010-09-29 14:37                                       ` Shirley Ma
2010-09-29 15:14                                     ` Michael S. Tsirkin
2010-09-29 15:23                                       ` Shirley Ma
2010-09-15  2:46                 ` Xin, Xiaohui
2010-09-15  9:58                   ` Michael S. Tsirkin
2010-09-16  8:18                     ` Xin, Xiaohui
2010-09-16 10:02                       ` Michael S. Tsirkin
2010-09-15  1:56           ` Xin, Xiaohui
2010-09-15  1:50         ` Xin, Xiaohui [this message]
2010-09-15  2:40           ` Shirley Ma
2010-09-15  2:55             ` Xin, Xiaohui
2010-09-15  5:27             ` Michael S. Tsirkin
2010-09-15  6:17               ` Shirley Ma
2010-09-14 12:05 ` [RFC PATCH 0/1] macvtap " Michael S. Tsirkin
2010-09-14 15:15   ` Shirley Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F2E9EB7348B8264F86B6AB8151CE2D792B8C8152A0@shsmsx502.ccr.corp.intel.com \
    --to=xiaohui.xin@intel.com \
    --cc=arnd@arndb.de \
    --cc=avi@redhat.com \
    --cc=davem@davemloft.net \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mashirle@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.