-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for PVH direct boot API #3155
Conversation
When I ran
I made sure the
These files gained Oracle copyrights which I'm guessing the test is objecting to? |
One user-facing change which I wasn't sure about: With this code, if a kernel specifies a PVH entry point, Firecracker will use it. If a kernel has both regular and PVH entry points, we could theoretically see a change in behaviour. My inclination is to say that this is the right thing to do, but if the Firecracker core team prefers I'm totally fine with it being an option (probably specified at the same time as the kernel is specified, via API or JSON). I'd have to dig into the code more to figure out how to do this, though. |
Updated patch removed a few vestigal lines from the original work two years ago. |
Rebased on latest main in order to pick up the gitlint fix. |
61c5aa0
to
2914c95
Compare
Rebased to latest main; minor tweaks needed to keep clippy happy. |
Rebased on the latest main. |
a46191f
to
74e7102
Compare
399dc9e
to
9421770
Compare
Fixed a couple more style nits and added a commit to allow the Oracle copyright. |
Any updates on this? There seems to be conflicts now 😕 |
Sorry, I've been busy with FreeBSD release engineering -- I promise I'll get back to this so it can get merged! |
Hey Colin, thanks for being so patient with us. As talked about on Slack, I've pointed this PR towards a feature branch so that we can get this PR merged without having to wait for the ci artifacts work to complete. That way you won't have to continuously rebase this PR. I'll be adding all required testing (freebsd boot test using artifacts build using your instructions, a test booting linux with pvh and a performance test to for booting linux with pvh) to the feature branch later once that work is unblocked, and if all goes well we might be able to land this for the next firecracker release 🥳 |
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 looks great! I just had some style-related comments. I want to go through the boot protocol again a bit more closely, but I couldn't find a proper resource describing the ABI.
For example, I couldn't find (easily) info about the GDT setup you're doing and the memory layout. (If you have other links, it would be useful).
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 <[email protected]> Co-authored-by: Alejandro Jimenez <[email protected]>
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 <[email protected]> Co-authored-by: Alejandro Jimenez <[email protected]>
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 <[email protected]> Co-authored-by: Alejandro Jimenez <[email protected]>
The PVH boot support bits are under Oracle copyright. Signed-off-by: Colin Percival <[email protected]>
While I'm here, clarify that the existing instructions are for building a Linux kernel and rootfs. Signed-off-by: Colin Percival <[email protected]>
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 <[email protected]>
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_XEN_PVH=y option boot. Signed-off-by: Colin Percival <[email protected]>
Patches updated and rebased on the latest main. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## feature/pvh #3155 +/- ##
===============================================
- Coverage 82.65% 82.65% -0.01%
===============================================
Files 221 221
Lines 28169 28330 +161
===============================================
+ Hits 23283 23416 +133
- Misses 4886 4914 +28
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Thank you! |
Actually, thank you Colin. I will work with Patrick to add the proper testing, so that we can get this merged to |
@cperciva Many thanks for this. Can I ask a (perhaps silly) question? I have a FreeBSD CI pipeline that currently uses VirtualBox, and is a bit of a pain for several reasons. It uses jails. Is there any limitation around jails and vnet stacks imposed by using firecracker VMs? |
@mcgaw Firecracker won't be aware of your jails, and your jails won't know that their host is running inside Firecracker. If you're using multiple IP addresses you might need some networking magic on the Linux host to get all of those routed into the FreeBSD/Firecracker guest, but aside from that it should just work. |
That's brilliant - I'm looking forward to road testing it. Thanks! |
Has this work been merged yet? FYI this allows to boot both FreeBSD and NetBSD on firecracker. |
Changes
This updates patches submitted two years ago (#1818). Some of that work ended up in linux-loader; much of the rest needed to be refactored to adjust for changes in the tree.
As this is my first significant contribution to Firecracker (and my first time using Rust!) this PR probably requires more careful review than most. Also, I haven't updated any documentation or added integration tests; I'm guessing it would be good to have a "does FreeBSD boot" test? Happy to do more work here but I'll need someone to lead me through the process.
Reason
Supporting PVH boot makes it possible for FreeBSD to boot in Firecracker. (cf. #3041).
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
The original author of the patches (now credited as co-authored-by) provided the same confirmation in his original PR.
PR Checklist
git commit -s
).unsafe
code is documented.CHANGELOG.md
.rust-vmm
.