Skip to content

Commit 4cac386

Browse files
Copilotludfjig
andcommitted
Update comments to include Windows cancellation scenario
Co-authored-by: ludfjig <4257730+ludfjig@users.noreply.github.com>
1 parent 84b5e9b commit 4cac386

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/hyperlight_host/src/hypervisor/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ impl VirtualCPU {
469469
}
470470
Ok(HyperlightExit::Cancelled()) => {
471471
// If cancellation was not requested for this specific guest function call,
472-
// the vcpu was interrupted by a stale cancellation from a previous call
472+
// the vcpu was interrupted by a stale cancellation. This can occur when:
473+
// - Linux: A signal from a previous call arrives late
474+
// - Windows: WHvCancelRunVirtualProcessor called right after vcpu exits but RUNNING_BIT is still true
473475
if !cancel_requested && !debug_interrupted {
474476
// Track that an erroneous vCPU kick occurred
475477
metrics::counter!(METRIC_ERRONEOUS_VCPU_KICKS).increment(1);

src/hyperlight_host/src/metrics/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ pub(crate) static METRIC_GUEST_ERROR_LABEL_CODE: &str = "code";
2121
// Counter metric that counts the number of times a guest function was called due to timing out
2222
pub(crate) static METRIC_GUEST_CANCELLATION: &str = "guest_cancellations_total";
2323

24-
// Counter metric that counts the number of times a vCPU was erroneously kicked by a stale signal
25-
// This happens when a signal from a previous guest call arrives late and interrupts a new call
24+
// Counter metric that counts the number of times a vCPU was erroneously kicked by a stale cancellation
25+
// This can happen in two scenarios:
26+
// 1. Linux: A signal from a previous guest call arrives late and interrupts a new call
27+
// 2. Windows: WHvCancelRunVirtualProcessor is called right after vCPU exits but RUNNING_BIT is still true
2628
pub(crate) static METRIC_ERRONEOUS_VCPU_KICKS: &str = "erroneous_vcpu_kicks_total";
2729

2830
// Histogram metric that measures the duration of guest function calls

0 commit comments

Comments
 (0)