Skip to content

Commit

Permalink
fix: kick vsock during VM resume
Browse files Browse the repository at this point in the history
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 <yegorlz@amazon.co.uk>
  • Loading branch information
ShadowCurse committed Sep 12, 2024
1 parent 2914d5a commit e6dba50
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/vmm/src/device_manager/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::devices::virtio::device::VirtioDevice;
use crate::devices::virtio::mmio::MmioTransport;
use crate::devices::virtio::net::Net;
use crate::devices::virtio::rng::Entropy;
use crate::devices::virtio::vsock::TYPE_VSOCK;
use crate::devices::virtio::vsock::{Vsock, VsockUnixBackend, TYPE_VSOCK};
use crate::devices::virtio::{TYPE_BALLOON, TYPE_BLOCK, TYPE_NET, TYPE_RNG};
use crate::devices::BusDevice;
#[cfg(target_arch = "x86_64")]
Expand Down Expand Up @@ -486,6 +486,16 @@ impl MMIODeviceManager {
// so for Vsock we don't support connection persistence through snapshot.
// Any in-flight packets or events are simply lost.
// Vsock is restored 'empty'.
// The only reason we still `kick` it is to make guest process
// `TRANSPORT_RESET_EVENT` event we sent during snapshot creation.
let vsock = virtio
.as_mut_any()
.downcast_mut::<Vsock<VsockUnixBackend>>()
.unwrap();
if vsock.is_activated() {
info!("kick vsock {id}.");
vsock.signal_used_queue().unwrap();
}
}
TYPE_RNG => {
let entropy = virtio.as_mut_any().downcast_mut::<Entropy>().unwrap();
Expand Down

0 comments on commit e6dba50

Please sign in to comment.