Skip to content

Conversation

@josephlr
Copy link
Contributor

Depends on #23

We only use lazy_static for spin::Mutex, but that has a const fn constructor, so lazy_static isn't needed. See the individual commits for more detailed info.

The only significant change was adding a const fn implementation for Allocator::new, as Default::default is never const fn.

Binary sizes (release build, in bytes, log-serial = true, log-panic = false):

Before #23:    58848
After #23:     58600
This PR + #23: 40264 (down to 31656 with no logging)

The vast majority of these are not needed. This also makes it easier to:
  - Add code
  - Tell which sections actually are testing-dependent
This makes it harder to forget to append "\n" to log statments.
efi::console is also modified to take the lock outside of the loop.

Signed-off-by: Joe Richey <[email protected]>
The pml2 tables and stack are now explictly allocated about 1 MiB.

Signed-off-by: Joe Richey <[email protected]>
This allows us to define all of our long-mode assembly in a separate
file, making maintaince easier.

Signed-off-by: Joe Richey <[email protected]>
It turns out we don't need MMIO devices above 4 GiB.

Signed-off-by: Joe Richey <[email protected]>
The asm files use symbols in layout.ld, which won't exsist when tests
are run on the host (as it uses the host's linker script). This isn't an
issue for Rust code, as we have LTO enabled.

Signed-off-by: Joe Richey <[email protected]>
We can just get the address_space_gib symbol from the linker, which lets
us avoid the need for a separate ADDRESS_SPACE_GIB constant.

Signed-off-by: Joe Richey <[email protected]>
Logging to serial outputs on all panics significantly increases code
size. We add two (on by default) features to disable serial logging:
  - Everywhere
  - Just in panics

Signed-off-by: Joe Richey <[email protected]>
By upgrading to spin 0.5, we can just use the "const fn" Mutex::new.

Signed-off-by: Joe Richey <[email protected]>
This was done by removing depenance on `Default` and just manually
implementing a `const fn` `Allocator::new()`.

This now allows us to remove lazy_static as dependancy entirely.

Signed-off-by: Joe Richey <[email protected]>
Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, fantastic changes! These are really improving the code quality.

@rbradford rbradford merged commit 62f9772 into cloud-hypervisor:master Nov 13, 2019
@josephlr josephlr deleted the deps branch November 13, 2019 21:32
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