devices: vhost_user_frontend: panic if worker fails

If the worker exits early with an error, then the device is
disfunctional: we can't detect if the device disconnected and
we can't handle IRQ resample requests (needed for aarch64).

Also tweaked some error messages.

TEST=start VM using vhost-user block device without https://crrev.com/c/5937871 an witness crash instead of just a log

Change-Id: I8f6832481a578c5f7dcec27d6c5df430f2d5b348
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5941521
Auto-Submit: Frederick Mayle <fmayle@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Frederick Mayle 2024-10-17 13:33:46 -07:00 committed by crosvm LUCI
parent 9861eeb943
commit 2c73ec1f07
2 changed files with 6 additions and 7 deletions

View file

@ -371,9 +371,10 @@ impl VhostUserFrontend {
backend_req_handler,
backend_client,
};
if let Err(e) = worker.run(interrupt) {
error!("failed to run {} worker: {:#}", label, e);
}
worker
.run(interrupt)
.with_context(|| format!("{label}: vhost_user_frontend worker failed"))
.unwrap();
worker.backend_req_handler
}));
}

View file

@ -125,9 +125,7 @@ impl Worker {
let _ = wait_ctx.delete(backend_req_handler.get_close_notifier());
self.backend_req_handler = None;
}
Err(e) => {
bail!("failed to handle a vhost-user request: {}", e);
}
Err(e) => return Err(e).context("failed to handle vhost-user request"),
}
}
#[cfg(target_os = "windows")]
@ -149,7 +147,7 @@ impl Worker {
warn!("event besides hungup should not be notified");
continue;
}
panic!("Backend device disconnected");
bail!("Backend device disconnected early");
}
}
}