Skip to content

Commit e322467

Browse files
committed
remove sending transport_reset event on snapshot creation
Signed-off-by: Amory Hoste <amory.hoste@gmail.com>
1 parent 53ba44f commit e322467

File tree

5 files changed

+6
-50
lines changed

5 files changed

+6
-50
lines changed

src/devices/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub mod pseudo;
1414
pub mod virtio;
1515

1616
pub use self::bus::{Bus, BusDevice, Error as BusError};
17-
use crate::virtio::{QueueError, VsockError};
17+
use crate::virtio::{QueueError};
1818
use logger::{error, IncMetric, METRICS};
1919

2020
// Function used for reporting error in terms of logging
@@ -43,6 +43,4 @@ pub enum Error {
4343
MalformedDescriptor,
4444
/// Error during queue processing.
4545
QueueError(QueueError),
46-
/// Vsock device error.
47-
VsockError(VsockError),
4846
}

src/devices/src/virtio/vsock/device.rs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::sync::Arc;
2626
use logger::{debug, error, warn, IncMetric, METRICS};
2727
use utils::byte_order;
2828
use utils::eventfd::EventFd;
29-
use vm_memory::{Bytes, GuestMemoryMmap};
29+
use vm_memory::{GuestMemoryMmap};
3030

3131
use super::super::super::Error as DeviceError;
3232
use super::super::{
@@ -41,8 +41,6 @@ pub(crate) const RXQ_INDEX: usize = 0;
4141
pub(crate) const TXQ_INDEX: usize = 1;
4242
pub(crate) const EVQ_INDEX: usize = 2;
4343

44-
pub(crate) const VIRTIO_VSOCK_EVENT_TRANSPORT_RESET: u32 = 0;
45-
4644
/// The virtio features supported by our vsock device:
4745
/// - VIRTIO_F_VERSION_1: the device conforms to at least version 1.0 of the VirtIO spec.
4846
/// - VIRTIO_F_IN_ORDER: the device returns used buffers in the same order that the driver makes
@@ -228,35 +226,6 @@ where
228226

229227
have_used
230228
}
231-
232-
// Send TRANSPORT_RESET_EVENT to driver. According to specs, the driver shuts down established
233-
// connections and the guest_cid configuration field is fetched again. Existing listen sockets remain
234-
// but their CID is updated to reflect the current guest_cid.
235-
pub fn send_transport_reset_event(&mut self) -> result::Result<(), DeviceError> {
236-
let mem = match self.device_state {
237-
DeviceState::Activated(ref mem) => mem,
238-
// This should never happen, it's been already validated in the caller function.
239-
DeviceState::Inactive => unreachable!(),
240-
};
241-
242-
let head = self.queues[EVQ_INDEX].pop(mem).ok_or_else(|| {
243-
METRICS.vsock.ev_queue_event_fails.inc();
244-
DeviceError::VsockError(VsockError::EmptyQueue)
245-
})?;
246-
247-
mem.write_obj::<u32>(VIRTIO_VSOCK_EVENT_TRANSPORT_RESET, head.addr)
248-
.unwrap_or_else(|e| error!("Failed to write virtio vsock reset event: {:?}", e));
249-
250-
self.queues[EVQ_INDEX]
251-
.add_used(mem, head.index, head.len)
252-
.unwrap_or_else(|e| {
253-
error!("Failed to add used descriptor {}: {}", head.index, e);
254-
});
255-
256-
self.signal_used_queue()?;
257-
258-
Ok(())
259-
}
260229
}
261230

262231
impl<B> VirtioDevice for Vsock<B>

src/devices/src/virtio/vsock/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ pub enum VsockError {
9999
BufDescTooSmall,
100100
/// The vsock data/buffer virtio descriptor is expected, but missing.
101101
BufDescMissing,
102-
/// Empty queue
103-
EmptyQueue,
104102
/// EventFd error
105103
EventFd(std::io::Error),
106104
/// Chained GuestMemoryMmap error.

src/vmm/src/device_manager/persist.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::sync::{Arc, Mutex};
99

1010
use super::mmio::*;
1111
use crate::EventManager;
12-
use logger::error;
1312

1413
#[cfg(target_arch = "aarch64")]
1514
use arch::DeviceType;
@@ -188,7 +187,7 @@ impl<'a> Persist<'a> for MMIODeviceManager {
188187

189188
let transport_state = mmio_transport.save();
190189

191-
let mut locked_device = mmio_transport.locked_device();
190+
let locked_device = mmio_transport.locked_device();
192191
match locked_device.device_type() {
193192
TYPE_BALLOON => {
194193
let balloon_state = locked_device
@@ -227,24 +226,16 @@ impl<'a> Persist<'a> for MMIODeviceManager {
227226
}
228227
TYPE_VSOCK => {
229228
let vsock = locked_device
230-
.as_mut_any()
229+
.as_any()
231230
// Currently, VsockUnixBackend is the only implementation of VsockBackend.
232-
.downcast_mut::<Vsock<VsockUnixBackend>>()
231+
.downcast_ref::<Vsock<VsockUnixBackend>>()
233232
.unwrap();
234233

235234
let vsock_state = VsockState {
236235
backend: vsock.backend().save(),
237236
frontend: vsock.save(),
238237
};
239238

240-
// Send Transport event to reset connections if device
241-
// is activated.
242-
if vsock.is_activated() {
243-
vsock.send_transport_reset_event().unwrap_or_else(|e| {
244-
error!("Failed to send reset transport event: {:?}", e);
245-
});
246-
}
247-
248239
states.vsock_device = Some(ConnectedVsockState {
249240
device_id: devid.clone(),
250241
device_state: vsock_state,

tools/devtool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# would help with reproducible builds (in addition to pinning Cargo.lock)
7070

7171
# Development container image (without tag)
72-
DEVCTR_IMAGE_NO_TAG="docker.io/amohoste/fcuvm_dev"
72+
DEVCTR_IMAGE_NO_TAG="docker.io/vhiveease/fcuvm_dev"
7373

7474
# Development container tag
7575
DEVCTR_IMAGE_TAG="v30"

0 commit comments

Comments
 (0)