mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
vmm_vhost: Check for errors on vhost-user SLEEP
If a device fails to sleep we never handle it and continue snapshotting. This causes a corrupt snapshot to be made with silent failure on boot. I noticed this for the vhost-user GPU, whenever there is a failure to recover the queue, this failure was not preventing the snapshot. BUG=b:300501737 TEST=snapshotted downstream and checked error prevents snapshot Change-Id: I7573805c37ba9bb66495ff2f256e706a33907361 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5247322 Reviewed-by: Noah Gold <nkgold@google.com> Commit-Queue: Idan Raiter <idanr@google.com>
This commit is contained in:
parent
1d7627ddbe
commit
48d18bb1f5
2 changed files with 10 additions and 2 deletions
9
third_party/vmm_vhost/src/master.rs
vendored
9
third_party/vmm_vhost/src/master.rs
vendored
|
@ -251,7 +251,14 @@ impl Master {
|
|||
/// Put the device to sleep.
|
||||
pub fn sleep(&self) -> Result<()> {
|
||||
let hdr = self.send_request_header(MasterReq::SLEEP, None)?;
|
||||
self.wait_for_ack(&hdr)
|
||||
let reply = self.recv_reply::<VhostUserSuccess>(&hdr)?;
|
||||
if !reply.success() {
|
||||
Err(VhostUserError::SleepError(anyhow!(
|
||||
"Device process responded with a failure on SLEEP."
|
||||
)))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Wake the device up.
|
||||
|
|
|
@ -722,7 +722,8 @@ impl<S: VhostUserSlaveReqHandler> SlaveReqHandler<S> {
|
|||
}
|
||||
Ok(MasterReq::SLEEP) => {
|
||||
let res = self.backend.sleep();
|
||||
self.slave_req_helper.send_ack_message(&hdr, res.is_ok())?;
|
||||
let msg = VhostUserSuccess::new(res.is_ok());
|
||||
self.slave_req_helper.send_reply_message(&hdr, &msg)?;
|
||||
}
|
||||
Ok(MasterReq::WAKE) => {
|
||||
let res = self.backend.wake();
|
||||
|
|
Loading…
Reference in a new issue