Skip to content

Commit 34d3a07

Browse files
committed
soft_apic: Add some diagnostics (#4079)
We've had a few test flakes of openvmm_openhcl_uefi_x64_windows_datacenter_core_2022_x64_uefi_force_dma_bounce recently. Copilot says these diagnostics are necessary to be able to determine the root cause of the problem. (cherry picked from commit 322aed5)
1 parent 14ad42d commit 34d3a07

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

vm/devices/pci/pci_core/src/capabilities/msix.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ struct MsiInterruptInner {
140140
route: Option<MsiRoute>,
141141
pending: bool,
142142
enabled: bool,
143+
#[inspect(hex)]
143144
address: u64,
145+
#[inspect(hex)]
144146
data: u32,
145147
}
146148

@@ -269,7 +271,10 @@ impl InspectMut for MsixMessageTableEntry {
269271
.hex("data", self.state.data)
270272
.hex("control", self.state.control)
271273
.field("enabled", self.state.control & 1 == 0)
272-
.field("is_pending", self.check_is_pending(true));
274+
.field("is_pending", self.check_is_pending(true))
275+
// Delivery state, which can diverge from the table above (e.g. an
276+
// interrupt latched while masked).
277+
.field("msi", &self.msi);
273278
}
274279
}
275280

vmm_core/virt/src/x86/apic_software_device.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,14 @@ impl SignalMsi for ApicSoftwareDevice {
267267
if let Some(interrupt) = table.entries.get(index) {
268268
let target = interrupt.msi_params();
269269
self.target.signal_msi(None, target.address, target.data)
270+
} else {
271+
// A dropped MSI might leave the guest waiting forever for a device
272+
// notification, so make it visible.
273+
tracelimit::warn_ratelimited!(
274+
address,
275+
index,
276+
"dropping MSI for unregistered interrupt"
277+
);
270278
}
271279
}
272280
}

0 commit comments

Comments
 (0)