pcie and dma in mirageos
play

PCIe and DMA in MirageOS Fabian Bonk Wednesday 20 th May, 2020 - PowerPoint PPT Presentation

Chair of Network Architectures and Services Department of Informatics Technical University of Munich PCIe and DMA in MirageOS Fabian Bonk Wednesday 20 th May, 2020 Chair of Network Architectures and Services Department of Informatics


  1. Chair of Network Architectures and Services Department of Informatics Technical University of Munich PCIe and DMA in MirageOS Fabian Bonk Wednesday 20 th May, 2020 Chair of Network Architectures and Services Department of Informatics Technical University of Munich

  2. Chair of Network Architectures and Services Department of Informatics Technical University of Munich What is MirageOS? MirageOS is a library operating system that constructs unikernels for secure, high- performance network applications across a variety of cloud computing and mobile platforms. F. Bonk — PCIe and DMA in MirageOS 2

  3. Unikernels What’s a Unikernel? • Entire application compiled into bootable VM image • Include necessary operating system functionality via libraries F. Bonk — PCIe and DMA in MirageOS 3

  4. Unikernels Unikernels vs. virtual machines [1] F. Bonk — PCIe and DMA in MirageOS 4

  5. Unikernels Why Unikernels? • high degree of separation • low resource usage • flexible runtime(s) (run on hypervisors, standard OS, microcontrollers) • safety benefits of high-level languages • fewer loc → fewer bugs F. Bonk — PCIe and DMA in MirageOS 5

  6. MirageOS F. Bonk — PCIe and DMA in MirageOS 6

  7. MirageOS OCaml unikernel operating system https://mirage.io/ • written in OCaml • generates Xen (incl. QubesOS) and Solo5 (KVM) Unikernels • can also generate standard executables (Linux, macOS, ...) • 172 173 repos on GitHub F. Bonk — PCIe and DMA in MirageOS 7

  8. MirageOS OCaml unikernel operating system https://mirage.io/ • written in OCaml • generates Xen (incl. QubesOS) and Solo5 (KVM) Unikernels • can also generate standard executables (Linux, macOS, ...) • 172 173 repos on GitHub F. Bonk — PCIe and DMA in MirageOS 8

  9. Example: Echo server open Lwt . Infix module Main ( S : Mirage_stack . V4 ) = struct (* RFC 862 - read payloads and repeat them back *) let rec echo flow = S . TCPV4 .read flow >>= function | Error _ | Ok ` Eof -> S . TCPV4 .close flow | Ok ` Data buf -> S . TCPV4 .write flow buf >>= function | Error _ -> S . TCPV4 .close flow | Ok () -> echo flow let start s = S .listen_tcpv4 s ~port:7 echo; S .listen s end F. Bonk — PCIe and DMA in MirageOS 9

  10. Layering Q: What is a HTTPS stack really? F. Bonk — PCIe and DMA in MirageOS 10

  11. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! F. Bonk — PCIe and DMA in MirageOS 10

  12. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? F. Bonk — PCIe and DMA in MirageOS 10

  13. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! F. Bonk — PCIe and DMA in MirageOS 10

  14. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? F. Bonk — PCIe and DMA in MirageOS 10

  15. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? A: Some code on top of an IP stack! F. Bonk — PCIe and DMA in MirageOS 10

  16. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? A: Some code on top of an IP stack! Q: What is an IP stack really? F. Bonk — PCIe and DMA in MirageOS 10

  17. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? A: Some code on top of an IP stack! Q: What is an IP stack really? A: Some code on top of an Ethernet stack! F. Bonk — PCIe and DMA in MirageOS 10

  18. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? A: Some code on top of an IP stack! Q: What is an IP stack really? A: Some code on top of an Ethernet stack! Q: What is an Ethernet stack really? F. Bonk — PCIe and DMA in MirageOS 10

  19. Layering Q: What is a HTTPS stack really? A: Some code on top of a TLS stack! Q: What is a TLS stack really? A: Some code on top of a TCP stack! Q: What is a TCP stack really? A: Some code on top of an IP stack! Q: What is an IP stack really? A: Some code on top of an Ethernet stack! Q: What is an Ethernet stack really? A: Some code on top of a network device! F. Bonk — PCIe and DMA in MirageOS 10

  20. Layering Let’s do some functional programming! F. Bonk — PCIe and DMA in MirageOS 11

  21. Layering Let’s do some functional programming! HTTPS stack : F. Bonk — PCIe and DMA in MirageOS 11

  22. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface F. Bonk — PCIe and DMA in MirageOS 11

  23. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : F. Bonk — PCIe and DMA in MirageOS 11

  24. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface F. Bonk — PCIe and DMA in MirageOS 11

  25. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : F. Bonk — PCIe and DMA in MirageOS 11

  26. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface F. Bonk — PCIe and DMA in MirageOS 11

  27. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : F. Bonk — PCIe and DMA in MirageOS 11

  28. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : Ethernet interface → IP interface F. Bonk — PCIe and DMA in MirageOS 11

  29. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : Ethernet interface → IP interface Ethernet stack : F. Bonk — PCIe and DMA in MirageOS 11

  30. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : Ethernet interface → IP interface Ethernet stack : Network device → Ethernet interface F. Bonk — PCIe and DMA in MirageOS 11

  31. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : Ethernet interface → IP interface Ethernet stack : Network device → Ethernet interface Network device : F. Bonk — PCIe and DMA in MirageOS 11

  32. Layering Let’s do some functional programming! HTTPS stack : TLS interface → HTTP interface TLS stack : TCP interface → TLS interface TCP stack : IP interface → TCP interface IP stack : Ethernet interface → IP interface Ethernet stack : Network device → Ethernet interface Network device : magic F. Bonk — PCIe and DMA in MirageOS 11

  33. Layering Network stack, assemble! module HTTPS_Interface = HTTP ( TLS ( TCP ( IP ( Ethernet ( TAP_device ))))) F. Bonk — PCIe and DMA in MirageOS 12

  34. Layering Network stack, assemble! module HTTPS_Interface = HTTP ( TLS ( TCP ( IP ( Ethernet ( TAP_device ))))) or module HTTPS_Interface = HTTP ( TLS ( TCP_socket )) F. Bonk — PCIe and DMA in MirageOS 12

  35. Layering Network stack, assemble! module HTTPS_Interface = HTTP ( TLS ( TCP ( IP ( Ethernet ( TAP_device ))))) or module HTTPS_Interface = HTTP ( TLS ( TCP_socket )) How about this? module HTTPS_Interface = HTTP ( TLS ( TCP ( IP ( Ethernet ( Network_driver ( PCIe_device )))))) F. Bonk — PCIe and DMA in MirageOS 12

  36. Structure Linux MirageOS User Application mirage-net-unix mirage-block-unix TAP block device F. Bonk — PCIe and DMA in MirageOS 13

  37. Example: Echo server open Lwt . Infix module Main ( S : Mirage_stack . V4 ) = struct (* RFC 862 - read payloads and repeat them back *) let rec echo flow = S . TCPV4 .read flow >>= function | Error _ | Ok ` Eof -> S . TCPV4 .close flow | Ok ` Data buf -> S . TCPV4 .write flow buf >>= function | Error _ -> S . TCPV4 .close flow | Ok () -> echo flow let start s = S .listen_tcpv4 s ~port:7 echo; S .listen s end F. Bonk — PCIe and DMA in MirageOS 14

  38. Example: Echo server How to build: Build a normal binary and use a TAP device and the OCaml network stack: $ mirage configure -t unix --net direct && make Build a normal binary and use the OS network stack: $ mirage configure -t unix --net socket && make Build a standalone Unikernel for deployment on Solo5/KVM: $ mirage configure -t hvt && make F. Bonk — PCIe and DMA in MirageOS 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend