From: Paul Durrant <Paul.Durrant@citrix.com>
To: Joao Martins <joao.m.martins@oracle.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>
Subject: Re: [RFC] netif: staging grants for requests
Date: Fri, 6 Jan 2017 09:33:57 +0000 [thread overview]
Message-ID: <61a6676e5cf5443690bd1eb0a796d9e5@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <58518B40.3050408@oracle.com>
> -----Original Message-----
> From: Joao Martins [mailto:joao.m.martins@oracle.com]
> Sent: 14 December 2016 18:11
> To: xen-devel@lists.xenproject.org
> Cc: David Vrabel <david.vrabel@citrix.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; Wei Liu <wei.liu2@citrix.com>; Paul Durrant
> <Paul.Durrant@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>
> Subject: [RFC] netif: staging grants for requests
>
> Hey,
>
> Back in the Xen hackaton '16 networking session there were a couple of ideas
> brought up. One of them was about exploring permanently mapped grants
> between
> xen-netback/xen-netfront.
>
> I started experimenting and came up with sort of a design document (in
> pandoc)
> on what it would like to be proposed. This is meant as a seed for discussion
> and also requesting input to know if this is a good direction. Of course, I
> am willing to try alternatives that we come up beyond the contents of the
> spec, or any other suggested changes ;)
>
> Any comments or feedback is welcome!
>
Hi,
Sorry for the delay... I've been OOTO for three weeks.
I like the general approach or pre-granting buffers for RX so that the backend can simply memcpy and tell the frontend which buffer a packet appears in but IIUC you are proposing use of a single pre-granted area for TX also, which would presumably require the frontend to always copy on the TX side? I wonder if we might go for a slightly different scheme...
The assumption is that the working set of TX buffers in the guest OS is fairly small (which is probably true for a small number of heavily used sockets and an OS that uses a slab allocator)...
The guest TX code maintains a hash table of buffer addresses to grant refs. When a packet is sent the code looks to see if it has already granted the buffer and re-uses the existing ref if so, otherwise it grants the buffer and adds the new ref into the table.
The backend also maintains a hash of grant refs to addresses and, whenever it sees a new ref, it grant maps it and adds the address into the table. Otherwise it does a hash lookup and thus has a buffer address it can immediately memcpy from.
If the frontend wants the backend to release a grant ref (e.g. because it's starting to run out of grant table) then a control message can be used to ask for it back, at which point the backend removes the ref from its cache and unmaps it.
Using this scheme we allow a guest OS to still use either a zero-copy approach if it wishes to do so, or a static pre-grant... or something between (e.g. pre-grant for headers, zero copy for bulk data).
Does that sound reasonable?
Paul
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-06 9:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 18:11 [RFC] netif: staging grants for requests Joao Martins
2017-01-04 13:54 ` Wei Liu
2017-01-05 20:27 ` Joao Martins
2017-01-04 19:40 ` Stefano Stabellini
2017-01-05 11:54 ` Wei Liu
2017-01-05 20:27 ` Joao Martins
2017-01-06 0:30 ` Stefano Stabellini
2017-01-06 17:13 ` Joao Martins
2017-01-06 19:02 ` Stefano Stabellini
2017-01-06 9:33 ` Paul Durrant [this message]
2017-01-06 19:18 ` Stefano Stabellini
2017-01-06 20:19 ` Joao Martins
2017-01-09 9:03 ` Paul Durrant
2017-01-09 18:25 ` Stefano Stabellini
2017-01-06 20:08 ` Joao Martins
2017-01-09 8:56 ` Paul Durrant
2017-01-09 13:01 ` Joao Martins
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=61a6676e5cf5443690bd1eb0a796d9e5@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=joao.m.martins@oracle.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).