7th MirageOS hack retreat

by Charles-Edouard Lecat on May 6th, 2019

Let's talk sun, mint tea and OCaml: Yes, you got it, the MirageOS biennial retreat at Marrakesh!

For the 7th iteration of the retreat, the majority of the Tarides team took part in the trip to the camels country. This is a report about what we produced and enjoyed while there.

Charles-Edouard Lecat

That's it, my first MirageOS retreat is coming soon, let's jump in the plane and here I come. After a nice cab trip and an uncountable number of similar streets, I'm finally at the Riad which will host me for the next 5 days.

It now begins the time to do what I came for: Code, Eat, Sleep and Repeat

I mostly worked on Colombe, the OCaml implementation of the SMTP protocol for which I developed a simple client. Except some delayed problems (like the integration of the MIME protocol, the TLS wrapping and some others), the client was working perfectly :) Implementing it was actually really easy as the core of the SMTP protocol was done by @dinosaure who developed over time a really nice way of implementing this kind of API. And as I spend most of my time at Tarides working on his code, I feel really comfortable with it.

One of the awesome thing about this retreat was the people who came: There was so many interesting people, doing various thing, so each time someone had an interrogation, you could almost be sure that someone could help you in a way or another.

But sadly, as I arrived few days after everyone, and just before the week-end, the time flew away reaaaaaally fast, and I did not have the time to do some major code, but I'm already looking forward to the next retreat which, I am sure, will be even more fruitful and attract a lot of nice OCaml developers.

Until then, I will just dream about the awesome food I ate there ;)

Lucas Pluvinage

Second Mirage retreat for me, and this time I had plans: make a small web game with Mirage hosted by an ESP32 device. I figured out that there was not canonical way to make an HTTP/Websocket server with Mirage and I didn't want to stick to a particular library.

Instead, I took my time to develop mirage-http, an abstraction of HTTP that can either have cohttp or httpaf as a backend. On top of that, I've build mirage-websocket which is therefore an HTTP server-independant implementation of websockets (indeed this has a lot of redundancies with ocaml-websocket but for now it's a proof of concept). While making all this I discussed with @anmonteiro who's the Webservers/protocols expert for Mirage ! However I didn't have the time to build something on top of that, but this is still something that I would like achieve at some point.

I also became the "dune guy" as I'm working on the Mirage/dune integration, and helped some people with their build system struggles.

It was definitely a rich week, I've learnt a lot of things, enjoyed the sun, ate good food and contributed to the Mirage universe !

Jules Aguillon

This was my first retreat. It was the occasion to meet OCaml developers from all over the world. The food was great and the weather perfect.

I submitted some PRs to the OCaml compiler !

  • Hint on type error on int literal PR #2301. It's adding an hint when using int literals instead of other number literals (eg. 3 instead of 3. or 3L):
Line 2, characters 20-21:
2 | let _ = Int32.add a 3
                        ^
Error: This expression has type int but an expression was expected of type
          int32
        Hint: Did you mean `3l'?
  • Hint on type error on int operators PR #2307. Hint the user when using numerical operators for ints (eg. +) on other kind of numbers (eg. float, int64, etc..). For example:
Line 8, characters 8-9:
8 | let _ = x + 1.
            ^
Error: This expression has type float but an expression was expected of type
          int
Line 8, characters 10-11:
8 | let _ = x + 1.
              ^
  Hint: Did you mean to use `+.'?
  • Clean up int literal hint PR #2313. A little cleanup of the 2 previous PRs.
  • Hint when the expected type is wrapped in a ref PR #2319. An other PR adding an hint: When the user forgot to use the ! operator on ref values:
Line 2, characters 8-9:
2 | let b = a + 1
            ^
Error: This expression has type int ref
        but an expression was expected of type int
  Hint: This is a `ref', did you mean `!a'?

The first 3 are merged now.

Gabriel de Perthuis

For this retreat my plan was to do something a little different and work on Solo5.

Wodan, the storage layer I'm working on, needs two things from its backends which are not commonly implemented:

  • support for discarding unused blocks (first implemented in mirage-block-unix), and
  • support for barriers, which are ordering constraints between writes

Solo5 provides relevant mirage backends, which are themselves provided by various virtualised implementations. Discard was added to most of those, at least those that were common enough to be easily tested; we just added an "operation not supported" error code for the other cases.

The virtio implementation was interesting; recent additions to the spec allow discard support, but few virtual machine managers actually implement that on the backend side. I tried to integrate with the Chromium OS "crosvm" for that, and had a good time figuring out how it found the bootloader entry point (turns out the cpu was happily skipping past invalid instructions to find a slightly misaligned entry point), but ran out of time to figure out the rest of the integration, which seemed to be more complex that anticipated. Because of this virtio discard support will be skipped over for now.

I also visited the souk, which was an interesting experience. Turns out I'm bad at haggling, but I brought back interesting things anyway.

Conclusion

We'd like to thank Hannes Mehnert who organized this retreat and all the attendees who contributed to make it fruitful and inspiring. You want to take part in the next MirageOS retreat? Stay tuned here.