devices: vvu-proxy: Reports an error happening in worker thread

BUG=none
TEST=run vvu

Change-Id: I80f05c7c0d066f458279f6908b4ba7296f873e49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3640878
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2022-05-12 04:53:48 +09:00 committed by Chromeos LUCI
parent 0124707336
commit 416a9cdd85

View file

@ -277,7 +277,7 @@ impl Worker {
// Represents if |slave_req_helper.endpoint| is being monitored for data // Represents if |slave_req_helper.endpoint| is being monitored for data
// from the Vhost-user sibling. // from the Vhost-user sibling.
let mut sibling_socket_polling_enabled = true; let mut sibling_socket_polling_enabled = true;
'wait: loop { loop {
let events = wait_ctx.wait().context("failed to wait for events")?; let events = wait_ctx.wait().context("failed to wait for events")?;
for event in events.iter().filter(|e| e.is_readable) { for event in events.iter().filter(|e| e.is_readable) {
match event.token { match event.token {
@ -305,8 +305,7 @@ impl Worker {
} }
Token::RxQueue => { Token::RxQueue => {
if let Err(e) = rx_queue_evt.read() { if let Err(e) = rx_queue_evt.read() {
error!("error reading rx queue Event: {}", e); bail!("error reading rx queue Event: {}", e);
break 'wait;
} }
// Rx buffers are available, now we should monitor the // Rx buffers are available, now we should monitor the
@ -324,34 +323,31 @@ impl Worker {
} }
Token::TxQueue => { Token::TxQueue => {
if let Err(e) = tx_queue_evt.read() { if let Err(e) = tx_queue_evt.read() {
error!("error reading tx queue event: {}", e); bail!("error reading tx queue event: {}", e);
break 'wait;
} }
self.process_tx(); self.process_tx();
} }
Token::SiblingKick { index } => { Token::SiblingKick { index } => {
if let Err(e) = self.process_sibling_kick(index) { if let Err(e) = self.process_sibling_kick(index) {
error!( bail!(
"error processing sibling kick for {}-th vring: {}", "error processing sibling kick for {}-th vring: {}",
index, e index,
e
); );
break 'wait;
} }
} }
Token::MainThread => { Token::MainThread => {
if let Err(e) = self.process_doorbell_message(&main_thread_tube) { if let Err(e) = self.process_doorbell_message(&main_thread_tube) {
error!("error processing doorbell message: {}", e); bail!("error processing doorbell message: {}", e);
break 'wait;
} }
} }
Token::Kill => { Token::Kill => {
let _ = kill_evt.read(); let _ = kill_evt.read();
break 'wait; return Ok(());
} }
} }
} }
} }
Ok(())
} }
// Processes data from the Vhost-user sibling and forwards to the driver via Rx buffers. // Processes data from the Vhost-user sibling and forwards to the driver via Rx buffers.