Skip to content

Commit

Permalink
openhcl: log how large the saved state buffer is for servicing (#400) (
Browse files Browse the repository at this point in the history
…#431)

We know how large it is, but log it so it's discoverable. 

In the future, we are probably moving to a model where we do not send
the saved state to the host. This will help us decide how large to size
a reserved memory range inside OpenHCL.

Cherry pick of #400
  • Loading branch information
chris-oo authored Dec 6, 2024
1 parent 457960b commit ac04938
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openhcl/underhill_core/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,11 @@ impl UnderhillVmWorker {
mesh::payload::decode(&saved_state_buf)
.context("failed to decode servicing state")?,
);
tracing::info!("received servicing state from host");

tracing::info!(
saved_state_len = saved_state_buf.len(),
"received servicing state from host"
);
}

let is_post_servicing = servicing_state.is_some();
Expand Down
3 changes: 3 additions & 0 deletions vm/devices/get/guest_emulation_device/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ pub struct GuestEmulationDevice {
vmgs: Vec<u8>,
#[inspect(with = "Option::is_some")]
save_restore_buf: Option<Vec<u8>>,
last_save_restore_buf_len: usize,
}

impl GuestEmulationDevice {
Expand All @@ -203,6 +204,7 @@ impl GuestEmulationDevice {
vmgs: vec![0; VMGS_CAPACITY],
save_restore_buf: None,
waiting_for_vtl0_start: Vec::new(),
last_save_restore_buf_len: 0,
}
}

Expand Down Expand Up @@ -386,6 +388,7 @@ impl<T: RingMem + Unpin> GedChannel<T> {
let saved_state_size = buffer.len();
if *written >= saved_state_size {
self.state = GedState::Ready;
state.last_save_restore_buf_len = saved_state_size;
state.save_restore_buf = None;
continue;
}
Expand Down

0 comments on commit ac04938

Please sign in to comment.