Skip to content

Commit be64e09

Browse files
committed
Make sure run_vcpu does not create spans
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 027fa17 commit be64e09

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ impl Hypervisor for HypervLinuxDriver {
559559
)
560560
}
561561

562-
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
562+
// Note, this function should not be instrumented with a span as it is called after setting up guest trace span
563563
fn run_vcpu(&mut self) -> Result<VmExit> {
564564
const HALT: hv_message_type = hv_message_type_HVMSG_X64_HALT;
565565
const IO_PORT: hv_message_type = hv_message_type_HVMSG_X64_IO_PORT_INTERCEPT;

src/hyperlight_host/src/hypervisor/hyperv_windows.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ impl Hypervisor for HypervWindowsDriver {
474474
)
475475
}
476476

477+
// Note, this function should not be instrumented with a span as it is called after setting up guest trace span
477478
#[expect(non_upper_case_globals, reason = "Windows API constant are lower case")]
478479
fn run_vcpu(&mut self) -> Result<VmExit> {
479480
let mut exit_context: WHV_RUN_VP_EXIT_CONTEXT = Default::default();

src/hyperlight_host/src/hypervisor/kvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl Hypervisor for KVMDriver {
548548
)
549549
}
550550

551-
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
551+
// Note, this function should not be instrumented with a span as it is called after setting up guest trace span
552552
fn run_vcpu(&mut self) -> Result<VmExit> {
553553
match self.vcpu_fd.run() {
554554
Ok(VcpuExit::Hlt) => Ok(VmExit::Halt()),

src/hyperlight_host/src/hypervisor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pub(crate) trait Hypervisor: Debug + Send {
223223
// - Signals will interrupt the guest (RUNNING_BIT=true), causing VmExit::Cancelled()
224224
// - If the guest completes before any signals arrive, kill() may have no effect
225225
// - If there are more iterations to do (IO/host func, etc.), the next iteration will be cancelled
226-
let exit_reason = self.run_vcpu();
226+
let exit_reason = self.run_vcpu(); // Note, this function must not create any spans as it is called after setting up guest trace span
227227

228228
// End current host trace by closing the current span that captures traces
229229
// happening when a guest exits and re-enters.

0 commit comments

Comments
 (0)