summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--devices/src/virtio/vhost/net.rs10
-rw-r--r--devices/src/virtio/vhost/vsock.rs10
-rw-r--r--devices/src/virtio/vhost/worker.rs6
3 files changed, 10 insertions, 16 deletions
diff --git a/devices/src/virtio/vhost/net.rs b/devices/src/virtio/vhost/net.rs
index 1107e9f..e9dcf14 100644
--- a/devices/src/virtio/vhost/net.rs
+++ b/devices/src/virtio/vhost/net.rs
@@ -197,6 +197,7 @@ where
                                     vhost_interrupt,
                                     interrupt,
                                     acked_features,
+                                    kill_evt,
                                 );
                                 let activate_vqs = |handle: &U| -> Result<()> {
                                     for idx in 0..NUM_QUEUES {
@@ -214,13 +215,8 @@ where
                                     }
                                     Ok(())
                                 };
-                                let result = worker.run(
-                                    queue_evts,
-                                    QUEUE_SIZES,
-                                    kill_evt,
-                                    activate_vqs,
-                                    cleanup_vqs,
-                                );
+                                let result =
+                                    worker.run(queue_evts, QUEUE_SIZES, activate_vqs, cleanup_vqs);
                                 if let Err(e) = result {
                                     error!("net worker thread exited with error: {}", e);
                                 }
diff --git a/devices/src/virtio/vhost/vsock.rs b/devices/src/virtio/vhost/vsock.rs
index 99af8ce..03826ff 100644
--- a/devices/src/virtio/vhost/vsock.rs
+++ b/devices/src/virtio/vhost/vsock.rs
@@ -168,6 +168,7 @@ impl VirtioDevice for Vsock {
                                 interrupts,
                                 interrupt,
                                 acked_features,
+                                kill_evt,
                             );
                             let activate_vqs = |handle: &VhostVsockHandle| -> Result<()> {
                                 handle.set_cid(cid).map_err(Error::VhostVsockSetCid)?;
@@ -175,13 +176,8 @@ impl VirtioDevice for Vsock {
                                 Ok(())
                             };
                             let cleanup_vqs = |_handle: &VhostVsockHandle| -> Result<()> { Ok(()) };
-                            let result = worker.run(
-                                queue_evts,
-                                QUEUE_SIZES,
-                                kill_evt,
-                                activate_vqs,
-                                cleanup_vqs,
-                            );
+                            let result =
+                                worker.run(queue_evts, QUEUE_SIZES, activate_vqs, cleanup_vqs);
                             if let Err(e) = result {
                                 error!("vsock worker thread exited with error: {:?}", e);
                             }
diff --git a/devices/src/virtio/vhost/worker.rs b/devices/src/virtio/vhost/worker.rs
index 9450929..630edaa 100644
--- a/devices/src/virtio/vhost/worker.rs
+++ b/devices/src/virtio/vhost/worker.rs
@@ -20,6 +20,7 @@ pub struct Worker<T: Vhost> {
     vhost_handle: T,
     vhost_interrupt: Vec<EventFd>,
     acked_features: u64,
+    kill_evt: EventFd,
 }
 
 impl<T: Vhost> Worker<T> {
@@ -29,6 +30,7 @@ impl<T: Vhost> Worker<T> {
         vhost_interrupt: Vec<EventFd>,
         interrupt: Interrupt,
         acked_features: u64,
+        kill_evt: EventFd,
     ) -> Worker<T> {
         Worker {
             interrupt,
@@ -36,6 +38,7 @@ impl<T: Vhost> Worker<T> {
             vhost_handle,
             vhost_interrupt,
             acked_features,
+            kill_evt,
         }
     }
 
@@ -43,7 +46,6 @@ impl<T: Vhost> Worker<T> {
         &mut self,
         queue_evts: Vec<EventFd>,
         queue_sizes: &[u16],
-        kill_evt: EventFd,
         activate_vqs: F1,
         cleanup_vqs: F2,
     ) -> Result<()>
@@ -104,7 +106,7 @@ impl<T: Vhost> Worker<T> {
 
         let poll_ctx: PollContext<Token> = PollContext::build_with(&[
             (self.interrupt.get_resample_evt(), Token::InterruptResample),
-            (&kill_evt, Token::Kill),
+            (&self.kill_evt, Token::Kill),
         ])
         .map_err(Error::CreatePollContext)?;