-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support for PVH boot protocol in Firecracker #5048
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5048 +/- ##
========================================
Coverage 83.19% 83.19%
========================================
Files 247 247
Lines 26641 26821 +180
========================================
+ Hits 22163 22313 +150
- Misses 4478 4508 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be to merge some commits and give them more standard names(feat:
, ...)?
src/vmm/src/arch/x86_64/mod.rs
Outdated
fn add_memmap_entry( | ||
memmap: &mut Vec<hvm_memmap_table_entry>, | ||
addr: u64, | ||
size: u64, | ||
mem_type: u32, | ||
) -> Result<(), ConfigurationError> { | ||
// Add the table entry to the vector | ||
memmap.push(hvm_memmap_table_entry { | ||
addr, | ||
size, | ||
type_: mem_type, | ||
reserved: 0, | ||
}); | ||
|
||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just inline this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this really better to be inlined. You are only saving 3 lines from this on the very first call to the function. Other calls to this function are already vertically formatted, so they take same amount of lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see any strong argument for doing it either way. I kinda like it as is because there's less visual clutter. Inlining it would also mean doing the constructing the struct at all 8 call sites, which involves explicitly writing out all fields, because outside of this functions the local variable names don't match up with the struct names.I
It doesnt need to return Result
though, I'll give you that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bchalios heya, could you weigh in here to resolve our deadlock? :D
Well, it's the merge of a feature branch, they're ought to be a little bit different from what we're used to. We never rewrote feature branches on merge to make the commit history more like a normal PR. I guess we could here because its small, but I don't really think we need/should. |
For the record: I'm totally fine with having my commit messages rewritten to match house style, if the Firecracker team wants to do this. I kept the original author's style for his commits that I reworked, and then just used FreeBSD commit message style for my own commits simply because that's what I'm used to. I know I'm a guest here. :-) |
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
In order to properly configure the initial vCPU register state and boot parameters in guest memory, we must specify which boot protocol to use with the kernel entry point address. On x86-64 (the only architecture where multiple boot protocols are supported) we print the protocol used to load the kernel at the debug log level. Create an EntryPoint struct that contains the required information. This structure will later be used in the vCPU configuration methods to set the appropriate initial conditions for the guest. This commit also splits the load_kernel function into an x86-64 specific version and an aarch64 specific version. Signed-off-by: Colin Percival <cperciva@freebsd.org> Co-authored-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Set the initial values of the KVM vCPU registers as specified in the PVH boot ABI: https://xenbits.xen.org/docs/unstable/misc/pvh.html Add stub bits for aarch64; PVH mode does not exist there. Signed-off-by: Colin Percival <cperciva@freebsd.org> Co-authored-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
okay I've folded all the lint fixes/etc into their respective commits. probably should've just done that in the first place whenever I rebased this branch anyway. |
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Fill the hvm_start_info and related structures as specified in the PVH boot protocol. Write the data structures to guest memory at the GPA that will be stored in %rbx when the guest starts. Signed-off-by: Colin Percival <cperciva@freebsd.org> Co-authored-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
The PVH boot support bits are under Oracle copyright. Signed-off-by: Colin Percival <cperciva@freebsd.org>
While I'm here, clarify that the existing instructions are for building a Linux kernel and rootfs. Signed-off-by: Colin Percival <cperciva@freebsd.org>
Brief description of the PVH boot mode. We defer to Xen for technical details of how CPU registers are set up upon kernel entry. Signed-off-by: Colin Percival <cperciva@freebsd.org> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Firecracker now supports PVH boot as an alternative to "Linux" boot on the x86_64 architecture. This makes it possible for FreeBSD to boot, and also affects how Linux kernels compiled with the CONFIG_PVH=y option boot. Signed-off-by: Colin Percival <cperciva@freebsd.org> Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Use test_api_happy_start to assert that the log message that indicates usage of PVH boot protocol is present. Only x86_64 guests support PVH boot, and on ARM we do not emit any log messages, so restrict the assertion to x86_64 platforms. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Hardcoding main means the test looks at the wrong range of commits for feature branches, which can result in problem if feature branches are long-lived. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
PR firecracker-microvm#5048 is the merge of the long-lived PVH feature branch. The commits on this branch were made long before we changes the gitlint rules to more closely follow Linux rules when it comes to sign-offs from co-authors (as used to not only not require them, but not allow them in the first place, meaning the first 3 commit in this PR are only signed by of Colin and me, but not the coauthor from a few years ago). Explicitly skip this test for this one PR. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
This is a rebased version of the feature/pvh feature branch contributed by @cperciva a while ago.
In Linux guests supporting the PVH protocol (which is all linux guests compiled with
CONFIG_PVH=y
, a default), Firecracker will now boot guests using the PVH boot protocol. Our performance testing has shown there to be no difference in performance to the old way of booting using the Linux boot protocol.Functionally, this means Firecracker can now boot FreeBSD guests (which only support the PVH boot protocol).
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
tools/devtool checkstyle
to verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md
.Runbook for Firecracker API changes.
integration tests.
TODO
.rust-vmm
.