vhost-device icon indicating copy to clipboard operation
vhost-device copied to clipboard

vsock: Have two separate threads for handling TX and RX

Open techiepriyansh opened this issue 2 years ago • 4 comments

Currently, the VhostUserVsockBackend handles both TX and RX in a single thread. It would be nice to have two separate threads handling TX and RX.

Implementing this would involve the following:

  • Define two threads in VhostUserVsockBackend with the appropriate queue_masks: 1 for the RX thread and 2 for the TX thread.
  • Set the TX thread's vring worker to also listen for BACKEND_EVENTs by calling set_vring_worker during initialization in start_backend_server.
  • Handle RX or TX in VhostUserVsockBackend::handle_event depending on the thread_id.
  • Refactor the hashmaps and backend_rxq contained in VsockThreadBackend to be accessible by both the threads (maybe over an RwLock).
  • Make the option to choose between single-threaded or multi-threaded configurable by the user.

techiepriyansh avatar Apr 14 '23 07:04 techiepriyansh

Thank you for the analysis! If you have time and interest to start this work, go ahead, otherwise we'll do it later because it would be a great cleanup.

stefano-garzarella avatar Apr 17 '23 07:04 stefano-garzarella

Yes, I'll get to it in a few days.

techiepriyansh avatar Apr 17 '23 14:04 techiepriyansh

Hey i see this hasn't been picked up in quite some time. If no one is picking this up shall i do it?

ramyak-mehra avatar Jun 08 '24 16:06 ramyak-mehra

@ramyak-mehra great! yes please, go head.

IIUC @techiepriyansh is busy, but feel free to ping us if the situation is changed.

stefano-garzarella avatar Jun 10 '24 07:06 stefano-garzarella