Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/hyperlight_host/src/hypervisor/virtual_machine/mshv/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ impl VirtualMachine for MshvVm {
let instruction_length = io_message.header.instruction_length() as u64;
let is_write = io_message.header.intercept_access_type != 0;

// VmAction::Halt always means "I'm done", regardless of
// whether a timer is active. The next guest dispatch
// rewrites RIP via set_regs(), so skip the RIP advance on
// this hot path.
if is_write && port_number == VmAction::Halt as u16 {
// Stop the timer thread before returning.
#[cfg(feature = "hw-interrupts")]
{
if let Some(mut t) = self.timer.take() {
t.stop();
}
}
return Ok(VmExit::Halt());
}

// mshv, unlike kvm, does not automatically increment RIP.
if let Some(page) = self
.vcpu_fd
Expand All @@ -245,19 +260,6 @@ impl VirtualMachine for MshvVm {
.map_err(|e| RunVcpuError::IncrementRip(e.into()))?;
}

// VmAction::Halt always means "I'm done", regardless
// of whether a timer is active.
if is_write && port_number == VmAction::Halt as u16 {
// Stop the timer thread before returning.
#[cfg(feature = "hw-interrupts")]
{
if let Some(mut t) = self.timer.take() {
t.stop();
}
}
return Ok(VmExit::Halt());
}

#[cfg(feature = "hw-interrupts")]
{
if is_write {
Expand Down
Loading