-
Notifications
You must be signed in to change notification settings - Fork 185
petri: add minimal VM builder for performance testing #3012
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,7 @@ impl PetriVmConfigOpenVmm { | |
| mesh: &mesh, | ||
| openvmm_path, | ||
| uses_pipette_as_init: properties.uses_pipette_as_init, | ||
| enable_serial: properties.enable_serial, | ||
| }; | ||
|
|
||
| let mut chipset = VmManifestBuilder::new( | ||
|
|
@@ -175,11 +176,23 @@ impl PetriVmConfigOpenVmm { | |
| } | ||
| } | ||
|
|
||
| let SerialData { | ||
| mut emulated_serial_config, | ||
| serial_tasks: log_stream_tasks, | ||
| linux_direct_serial_agent, | ||
| } = setup.configure_serial(log_source)?; | ||
| let (emulated_serial_config, log_stream_tasks, linux_direct_serial_agent) = | ||
| if !properties.enable_serial { | ||
| // No emulated serial backends (OpenHCL VMBus serial stubs may still exist) | ||
| ([None, None, None, None], Vec::new(), None) | ||
| } else { | ||
| let SerialData { | ||
| emulated_serial_config, | ||
| serial_tasks, | ||
| linux_direct_serial_agent, | ||
| } = setup.configure_serial(log_source)?; | ||
| ( | ||
| emulated_serial_config, | ||
| serial_tasks, | ||
| linux_direct_serial_agent, | ||
| ) | ||
| }; | ||
| let mut emulated_serial_config = emulated_serial_config; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just make this mut on the previous line |
||
|
|
||
| let (video_dev, framebuffer, framebuffer_view) = match setup.config_video()? { | ||
| Some((v, fb, fba)) => { | ||
|
|
@@ -244,12 +257,15 @@ impl PetriVmConfigOpenVmm { | |
|
|
||
| // Configure the serial ports now that they have been updated by the | ||
| // OpenHCL configuration. | ||
| chipset = chipset.with_serial(emulated_serial_config); | ||
| // Set so that we don't pull serial data until the guest is | ||
| // ready. Otherwise, Linux will drop the input serial data | ||
| // on the floor during boot. | ||
| if matches!(firmware, Firmware::LinuxDirect { .. }) { | ||
| chipset = chipset.with_serial_wait_for_rts(); | ||
| if properties.enable_serial { | ||
| chipset = chipset.with_serial(emulated_serial_config); | ||
| // Set so that we don't pull serial data until the guest is | ||
| // ready. Otherwise, Linux will drop the input serial data | ||
| // on the floor during boot. | ||
| if matches!(firmware, Firmware::LinuxDirect { .. }) && !properties.uses_pipette_as_init | ||
| { | ||
| chipset = chipset.with_serial_wait_for_rts(); | ||
|
jstarks marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| // Extract video configuration | ||
|
|
@@ -262,28 +278,38 @@ impl PetriVmConfigOpenVmm { | |
| None => None, | ||
| }; | ||
|
|
||
| // Add the Hyper-V Shutdown IC | ||
| let (shutdown_ic_send, shutdown_ic_recv) = mesh::channel(); | ||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| ShutdownIcHandle { | ||
| recv: shutdown_ic_recv, | ||
| } | ||
| .into_resource(), | ||
| )); | ||
| // Add default VMBus devices (skipped in minimal mode). | ||
| let (shutdown_ic_send, kvp_ic_send) = if !properties.minimal_mode { | ||
| let (shutdown_ic_send, shutdown_ic_recv) = mesh::channel(); | ||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| ShutdownIcHandle { | ||
| recv: shutdown_ic_recv, | ||
| } | ||
| .into_resource(), | ||
| )); | ||
|
|
||
| // Add the Hyper-V KVP IC | ||
| let (kvp_ic_send, kvp_ic_recv) = mesh::channel(); | ||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| hyperv_ic_resources::kvp::KvpIcHandle { recv: kvp_ic_recv }.into_resource(), | ||
| )); | ||
| let (kvp_ic_send, kvp_ic_recv) = mesh::channel(); | ||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| hyperv_ic_resources::kvp::KvpIcHandle { recv: kvp_ic_recv }.into_resource(), | ||
| )); | ||
|
|
||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| hyperv_ic_resources::timesync::TimesyncIcHandle.into_resource(), | ||
| )); | ||
|
|
||
| // Add the Hyper-V timesync IC | ||
| vmbus_devices.push(( | ||
| DeviceVtl::Vtl0, | ||
| hyperv_ic_resources::timesync::TimesyncIcHandle.into_resource(), | ||
| )); | ||
| (shutdown_ic_send, kvp_ic_send) | ||
| } else { | ||
| // Minimal mode: no ICs. Create dummy senders so the fields | ||
| // are populated (calls to send_enlightened_shutdown will fail | ||
| // with a channel error, which is fine — minimal VMs shut down | ||
| // via reboot(2) directly). | ||
| let (shutdown_ic_send, _) = mesh::channel(); | ||
| let (kvp_ic_send, _) = mesh::channel(); | ||
| (shutdown_ic_send, kvp_ic_send) | ||
|
jstarks marked this conversation as resolved.
|
||
| }; | ||
|
|
||
| // Make a vmbus vsock path for pipette connections | ||
| let (vmbus_vsock_listener, vmbus_vsock_path) = make_vsock_listener()?; | ||
|
|
@@ -541,6 +567,7 @@ struct PetriVmConfigSetupCore<'a> { | |
| mesh: &'a Mesh, | ||
| openvmm_path: &'a ResolvedArtifact, | ||
| uses_pipette_as_init: bool, | ||
| enable_serial: bool, | ||
| } | ||
|
|
||
| struct SerialData { | ||
|
|
@@ -649,15 +676,21 @@ impl PetriVmConfigSetupCore<'_> { | |
| "/bin/sh" | ||
| }; | ||
|
|
||
| let serial_args = if self.enable_serial { | ||
| format!("{console} debug ") | ||
| } else { | ||
| String::new() | ||
| }; | ||
|
jstarks marked this conversation as resolved.
|
||
|
|
||
| let cmdline = | ||
| format!("{console} debug panic=-1 rdinit={init} {VIRTIO_VSOCK_BLACKLIST}"); | ||
| format!("{serial_args}panic=-1 rdinit={init} {VIRTIO_VSOCK_BLACKLIST}"); | ||
|
|
||
| LoadMode::Linux { | ||
| kernel, | ||
| initrd: Some(initrd), | ||
| cmdline, | ||
| custom_dsdt: None, | ||
| enable_serial: true, | ||
| enable_serial: self.enable_serial, | ||
| } | ||
| } | ||
| ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.