diff --git a/CHANGELOG.md b/CHANGELOG.md index 22dbeb125..006576257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). and existing snapshots regenerated. Guest entry takes the random seed, host page size, and log level. * **Breaking:** Encode function calls with serde/postcard instead of FlatBuffers. +* Stop resetting guest FPU state between guest calls to improve performance. ### Fixed * Fix surrogate process creation for Windows paths containing Unicode or spaces. diff --git a/src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs b/src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs index 08cd88f4e..feeaf73d1 100644 --- a/src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs +++ b/src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs @@ -19,7 +19,7 @@ use crate::hypervisor::WindowsInterruptHandle; #[cfg(gdb)] use crate::hypervisor::gdb::{DebugCommChannel, DebugMsg, DebugResponse}; use crate::hypervisor::hyperlight_vm::get_guest_log_filter; -use crate::hypervisor::regs::{CommonFpu, CommonRegisters, CommonSpecialRegisters}; +use crate::hypervisor::regs::{CommonRegisters, CommonSpecialRegisters}; #[cfg(hvf)] use crate::hypervisor::virtual_machine::hvf::HvfVm; #[cfg(kvm)] @@ -164,9 +164,6 @@ impl HyperlightVm { self.vm .set_regs(®s) .map_err(DispatchGuestCallError::SetupRegs)?; - self.vm - .set_fpu(&CommonFpu::default()) - .map_err(DispatchGuestCallError::SetupRegs)?; let result = self .run(mem_mgr, host_funcs) .map_err(DispatchGuestCallError::Run); diff --git a/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs b/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs index b7c946bb0..dc194b9ba 100644 --- a/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs +++ b/src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs @@ -23,7 +23,7 @@ use crate::hypervisor::gdb::{ #[cfg(gdb)] use crate::hypervisor::gdb::{DebugError, DebugMemoryAccessError}; use crate::hypervisor::regs::{ - CommonDebugRegs, CommonFpu, CommonRegisters, CommonSpecialRegisters, MsrEntry, MsrResetState, + CommonDebugRegs, CommonRegisters, CommonSpecialRegisters, MsrEntry, MsrResetState, }; #[cfg(kvm)] use crate::hypervisor::virtual_machine::kvm::KvmVm; @@ -280,11 +280,6 @@ impl HyperlightVm { .set_regs(®s) .map_err(DispatchGuestCallError::SetupRegs)?; - // reset fpu - self.vm - .set_fpu(&CommonFpu::default()) - .map_err(DispatchGuestCallError::SetupRegs)?; - let result = self .run(mem_mgr, host_funcs) .map_err(DispatchGuestCallError::Run); @@ -856,7 +851,9 @@ mod tests { use super::*; #[cfg(kvm)] use crate::hypervisor::regs::FP_CONTROL_WORD_DEFAULT; - use crate::hypervisor::regs::{CommonSegmentRegister, CommonTableRegister, MXCSR_DEFAULT}; + use crate::hypervisor::regs::{ + CommonFpu, CommonSegmentRegister, CommonTableRegister, MXCSR_DEFAULT, + }; use crate::hypervisor::virtual_machine::VirtualMachine; use crate::mem::layout::SandboxMemoryLayout; use crate::mem::memory_region::MemoryRegionFlags; diff --git a/src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs b/src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs index 8f2ebc566..47c7db573 100644 --- a/src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs +++ b/src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs @@ -468,6 +468,7 @@ pub(crate) trait VirtualMachine: Debug + Send { #[allow(dead_code)] fn fpu(&self) -> std::result::Result; /// Set fpu regs + #[allow(dead_code)] fn set_fpu(&mut self, fpu: &CommonFpu) -> std::result::Result<(), RegisterError>; /// Get special regs #[allow(dead_code)]