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. |
There was a problem hiding this comment.
could be useful to upstream this into Cstruct (more generally we need more Cstruct functions working on list of Cstructs I think)
|
|
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
There was a problem hiding this comment.
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).