Skip to content

Commit 44f4180

Browse files
ShadowCursebchalios
authored andcommitted
fix: kick vsock during VM resume
We need to kick vsock queue during resume in order for a VM to process `TRANSPORT_RESET_EVENT` we sent during snapshot creation. Otherwise it will wait for it forever. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 264667a commit 44f4180

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/vmm/src/device_manager/mmio.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use crate::devices::virtio::device::VirtioDevice;
3333
use crate::devices::virtio::mmio::MmioTransport;
3434
use crate::devices::virtio::net::Net;
3535
use crate::devices::virtio::rng::Entropy;
36-
use crate::devices::virtio::vsock::TYPE_VSOCK;
36+
use crate::devices::virtio::vsock::{Vsock, VsockUnixBackend, TYPE_VSOCK};
3737
use crate::devices::virtio::{TYPE_BALLOON, TYPE_BLOCK, TYPE_NET, TYPE_RNG};
3838
use crate::devices::BusDevice;
3939
#[cfg(target_arch = "x86_64")]
@@ -486,6 +486,16 @@ impl MMIODeviceManager {
486486
// so for Vsock we don't support connection persistence through snapshot.
487487
// Any in-flight packets or events are simply lost.
488488
// Vsock is restored 'empty'.
489+
// The only reason we still `kick` it is to make guest process
490+
// `TRANSPORT_RESET_EVENT` event we sent during snapshot creation.
491+
let vsock = virtio
492+
.as_mut_any()
493+
.downcast_mut::<Vsock<VsockUnixBackend>>()
494+
.unwrap();
495+
if vsock.is_activated() {
496+
info!("kick vsock {id}.");
497+
vsock.signal_used_queue().unwrap();
498+
}
489499
}
490500
TYPE_RNG => {
491501
let entropy = virtio.as_mut_any().downcast_mut::<Entropy>().unwrap();

0 commit comments

Comments
 (0)