New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy out-bound data into pre-shared pages #17
Conversation
Minor correction: it still doesn't allow the sender to reuse the pages because it needs to retransmit them if it gets suspended. |
|
Performance of UDP benchmark on ARM:
Notes:
The panic may be because I'm running a patched kernel to work around previous crashes, so I don't think it's worth reporting it. We should upgrade the ARM image builder to a newer stock kernel at some point. I also saw the old code once cause a dom0 kernel panic on x86_64 (which, unfortunately, I didn't capture because serial logging wasn't on), but that's also running a patched kernel. So, I think the new code should be better for older (and possibly newer) Linux kernels too. |
let rest_hd = Cstruct.shift hd first in | ||
(n + avail, rest_hd :: tl) | ||
) in | ||
aux dst 0 src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be useful to upstream this into Cstruct (more generally we need more Cstruct functions working on list of Cstructs I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Are we still supporting OCaml 4.00? If not, I'll just update the Travis tests. |
The original motivation for this is to make TLS support work. Currently, TLS copies the encrypted buffers into a large Io_page and TCP sends segment-sized Cstruct views of this buffer to the network. If any of these overlap a page boundary, the send will fail. With this patch, TLS can send ordinary unaligned buffers to TCP (avoiding a copy). The copy now happens in Netif. This some other advantages: - It avoids splitting requests across multiple grants (before, we sent the IP header and payload in separate pages). - It avoids the security problem of sharing unrelated data that happens to be in the same page. Now, netback will only ever see data explicitly sent to it. - It allows the sender to reuse pages as soon as Netif.write returns. Before, the pages were queued and the application could change them even as netback was reading them. Behaviour should now be deterministic. - It's faster (132 MB/s -> 181 MB/s for an x86_64 unikernel running under Xen in VirtualBox on my laptop).
Hm, since
I think we can drop 4.00. On Thu, Jan 15, 2015 at 3:11 PM, Thomas Leonard notifications@github.com
Dave Scott |
OK, dropped 4.00. Travis is now passing! |
One day we'll have a nice set of unit tests for this stuff (should be easier when I've completed functorising it like vchan)... One day |
Copy out-bound data into pre-shared pages
Would a quick release of this be useful? On Thu, Jan 15, 2015 at 4:11 PM, Thomas Leonard notifications@github.com
Dave Scott |
Yeah, being able to unit-test ring code would be pretty useful! I'd hold off doing a release until #15 is fixed too (looks trivial, but someone else should confirm). |
``` val blitv: t list -> t -> int * t list (** [blitv src dst] will copy the list of [src] buffers into [dst] and return a tuple of the total number of bytes written and a list of any uncopied buffers. [blitv] will never raise an exception, since it returns any uncopied bytes if the [dst] buffer is not big enough to fit the full list of [src] buffers. *) ``` via @talex5 in mirage/mirage-net-xen#17
) | ||
(** Copy from src to dst until src is exhausted or dst is full. | ||
* Returns the number of bytes copied and the remaining data from src, if any. *) | ||
(* TODO: replace this with Cstruct.buffer once that's released. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original motivation for this is to make TLS support work. Currently, TLS copies the encrypted buffers into a large Io_page, and TCP then sends segment-sized Cstruct views of this buffer to the network. If any of these overlap a page boundary, the send will fail.
With this patch, TLS can send ordinary unaligned buffers to TCP (avoiding a copy). The copy now happens in Netif.
This some other advantages:
the IP header and payload in separate pages).
to be in the same page. Now, netback will only ever see data
explicitly sent to it.
Before, the pages were queued and the application could change them
even as netback was reading them. Behaviour should now be
deterministic.
under Xen in VirtualBox on my laptop).