Skip to content
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

Restructure the code into a library #10

Merged
merged 155 commits into from
Sep 23, 2023
Merged

Restructure the code into a library #10

merged 155 commits into from
Sep 23, 2023

Conversation

Ivan-Velickovic
Copy link
Collaborator

@Ivan-Velickovic Ivan-Velickovic commented Jul 7, 2023

The following PR is a draft and attempts to re-work the entire project into a VMM library. The motivation for this is that coming up with a "one size fits all" generic VMM is not ideal. Instead, it is ideal to provide users with a library (and plenty of examples) which they then use to produce their own VMM for their use case (a minimal seL4CP VMM is only ~100 lines of code).

The reason I've made this a draft PR is so people know what to expect (and can provide feedback if they wish).

Yet to be done is the following:

  • Audit architecture specific parts of the VMM (once the RISC-V port is done this will confirm whether we've made the right abstractions)
    • Left for when we actually add a new architecture.
  • Eliminate most if not all of util.c and util.h
    • Maybe some minor clean up left, but all that's left really is the libc functions that we need. What to do about seL4CP projects that need libc functionality is a broader question and not just to do with VMM. It's fine to roll our own memset and memcpy but they are definitely not as performant as the optimised libc ones.
  • Restructure the examples.
    • All the library code in src/ and a separate top-level examples/ directory that contains all the example VMMs (e.g a simple generic one just for booting a basic Linux machine with serial input/output, a virtio example VMM, a passthrough example VMM etc).
  • Use newlib or a some pre-packaged libc instead of rolling our own memcpy and memset. So far I have no luck with getting newlib to work.
    • Attempted, failed. Will revisit at a later stage.
  • Examples of using other build systems. So the simple example will have at least Makefile, CMake and Zig to actually demonstrate how to incorporate the VMM into an existing project.
  • Update the manual and README accordingly.
  • CI needs to be updated once the examples are restructured.
  • See if Renode is in a good enough state to be used in examples or whether we just stick to QEMU for now.
  • Address Tim's issues/fixes with the manual

Questions to answer:

  • How to distribute and package library?
    • Dealing with this later once VMM becomes more stable (and actually ready for other people to use)
  • How to deal with large binary images for examples? Do we complicate the examples by having a separate top-level image directory to avoid blowing up the size of the repository? Is there actually much image re-use between the examples if we do this generalisation?
  • In general, how to handle information flow between the system description (e.g. guest RAM size) and the VMM code/library.
    • Am in the process of thinking about this, we are internally building more complex systems and will use those to inform how to deal with abstracting over the seL4CP system description.

@Ivan-Velickovic Ivan-Velickovic force-pushed the restructure branch 3 times, most recently from ca1f7fe to 46704f2 Compare July 10, 2023 10:13
@Ivan-Velickovic Ivan-Velickovic force-pushed the restructure branch 4 times, most recently from 921d0ab to a27a15d Compare August 2, 2023 14:27
@Ivan-Velickovic Ivan-Velickovic marked this pull request as ready for review August 3, 2023 04:31
This example has two build systems now, a Makefile as well as the Zig
build system for educational purposes.

Documentation to follow.
Ultimately I am sick of dealing with the various cross-compilers for GCC
and the different behaviour between cross-compilers that are supposed to
be doing the same thing (e.g. aarch64-none-elf and aarch64-linux-gnu).
This problem will only be worse when we add support for more architectures
to the VMM as every architecture is a separate set of binaries needed to
be installed.

With Clang and LLD, there are only *two* binaries needed for *all*
targets we will support. This is significantly easier to mantain and
less likely to result in weird toolchain bugs unlike with the various
GCC cross-compilers for the same target. If we were to use Zig's packaged
toolchain, we could even get away with having a single binary for compiling
all of our code.

Of course, we still want to support using GCC to compile the library
so after this patch we will still need to test that GCC works.
erichchan999 and others added 26 commits September 23, 2023 08:21
…no helper functions in uio.h written yet, changes made in QEMU not odroidc4
…unctionality, changed startup run order to be last (from S90 to S95)
Another thing that had to be lumped up in this commit was
updating to the latest rust-seL4 which also renames to
Microkit.
Still can't figure out this LazyPath dependency stuff. Very annoying.
Previously the LLVM archiver would print a warning that it was
creating an archive for the first time, this is fine for us and
not warning of any erroneous behaviour.
@Ivan-Velickovic Ivan-Velickovic merged commit eaefc34 into main Sep 23, 2023
@Ivan-Velickovic Ivan-Velickovic deleted the restructure branch September 23, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants