Skip to content

Commit 017d015

Browse files
committed
add logging
1 parent 1666280 commit 017d015

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

src/vmm/src/devices/virtio/balloon/device.rs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::sync::atomic::AtomicUsize;
88
use std::sync::Arc;
99
use std::time::Duration;
1010

11-
use logger::{error, IncMetric, METRICS};
11+
use logger::{debug, error, IncMetric, METRICS};
1212
use serde::Serialize;
1313
use timerfd::{ClockId, SetTimeFlags, TimerFd, TimerState};
1414
use utils::eventfd::EventFd;
@@ -158,6 +158,7 @@ impl Balloon {
158158
stats_polling_interval_s: u16,
159159
restored: bool,
160160
) -> Result<Balloon, BalloonError> {
161+
debug!("creating new balloon");
161162
let mut avail_features = 1u64 << VIRTIO_F_VERSION_1;
162163

163164
if deflate_on_oom {
@@ -207,32 +208,45 @@ impl Balloon {
207208
}
208209

209210
pub(crate) fn process_inflate_queue_event(&mut self) -> Result<(), BalloonError> {
211+
debug!("balloon: inflate queue event");
210212
self.queue_evts[INFLATE_INDEX]
211213
.read()
212214
.map_err(BalloonError::EventFd)?;
213-
self.process_inflate()
215+
self.process_inflate()?;
216+
debug!("balloon: inflate queue event done");
217+
Ok(())
214218
}
215219

216220
pub(crate) fn process_deflate_queue_event(&mut self) -> Result<(), BalloonError> {
221+
debug!("balloon: deflate queue event");
217222
self.queue_evts[DEFLATE_INDEX]
218223
.read()
219224
.map_err(BalloonError::EventFd)?;
220-
self.process_deflate_queue()
225+
self.process_deflate_queue()?;
226+
debug!("balloon: deflate queue event done");
227+
Ok(())
221228
}
222229

223230
pub(crate) fn process_stats_queue_event(&mut self) -> Result<(), BalloonError> {
231+
debug!("balloon: process stats queue event");
224232
self.queue_evts[STATS_INDEX]
225233
.read()
226234
.map_err(BalloonError::EventFd)?;
227-
self.process_stats_queue()
235+
self.process_stats_queue()?;
236+
debug!("balloon: process stats queue event finished");
237+
Ok(())
228238
}
229239

230240
pub(crate) fn process_stats_timer_event(&mut self) -> Result<(), BalloonError> {
241+
debug!("balloon: process stats timer event");
231242
self.stats_timer.read();
232-
self.trigger_stats_update()
243+
self.trigger_stats_update()?;
244+
debug!("balloon: process stats timer event done");
245+
Ok(())
233246
}
234247

235248
pub(crate) fn process_inflate(&mut self) -> Result<(), BalloonError> {
249+
debug!("balloon: process inflate queue");
236250
// This is safe since we checked in the event handler that the device is activated.
237251
let mem = self.device_state.mem().unwrap();
238252
METRICS.balloon.inflate_count.inc();
@@ -316,14 +330,19 @@ impl Balloon {
316330
}
317331
}
318332

333+
debug!("balloon: process inflate queue finished, interrupting...");
334+
319335
if needs_interrupt {
320336
self.signal_used_queue()?;
321337
}
322338

339+
debug!("balloon: process inflate queue finally finished");
340+
323341
Ok(())
324342
}
325343

326344
pub(crate) fn process_deflate_queue(&mut self) -> Result<(), BalloonError> {
345+
debug!("balloon: process deflate queue");
327346
// This is safe since we checked in the event handler that the device is activated.
328347
let mem = self.device_state.mem().unwrap();
329348
METRICS.balloon.deflate_count.inc();
@@ -339,13 +358,17 @@ impl Balloon {
339358
}
340359

341360
if needs_interrupt {
342-
self.signal_used_queue()
361+
debug!("balloon: process deflate queue finished, interrupting...");
362+
self.signal_used_queue()?;
363+
debug!("balloon: process deflate queue finished");
364+
Ok(())
343365
} else {
344366
Ok(())
345367
}
346368
}
347369

348370
pub(crate) fn process_stats_queue(&mut self) -> std::result::Result<(), BalloonError> {
371+
debug!("balloon: process stats queue");
349372
// This is safe since we checked in the event handler that the device is activated.
350373
let mem = self.device_state.mem().unwrap();
351374
METRICS.balloon.stats_updates_count.inc();
@@ -380,6 +403,8 @@ impl Balloon {
380403
self.stats_desc_index = Some(head.index);
381404
}
382405

406+
debug!("balloon: process stats queue finished");
407+
383408
Ok(())
384409
}
385410

src/vmm/src/devices/virtio/balloon/event_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Balloon {
3636
}
3737

3838
fn process_activate_event(&self, ops: &mut EventOps) {
39-
debug!("balloon: activate event");
39+
debug!("balloon: activate eventeeeee");
4040
if let Err(err) = self.activate_evt.read() {
4141
error!("Failed to consume balloon activate event: {:?}", err);
4242
}

src/vmm/src/persist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::device_manager::persist::{DeviceStates, Error as DevicePersistError};
3636
use crate::devices::virtio::TYPE_NET;
3737
use crate::memory_snapshot::{mem_dump_dirty, GuestMemoryState, SnapshotMemory};
3838
use crate::resources::VmResources;
39-
use crate::rpc_interface::LoadSnapshotError;
39+
4040
#[cfg(target_arch = "x86_64")]
4141
use crate::version_map::FC_V0_23_SNAP_VERSION;
4242
use crate::version_map::{FC_V1_0_SNAP_VERSION, FC_V1_1_SNAP_VERSION, FC_VERSION_TO_SNAP_VERSION};

0 commit comments

Comments
 (0)