Skip to content

Commit

Permalink
net/vhost: fix Rx interrupt
Browse files Browse the repository at this point in the history
[ upstream commit 7995bf4c295464c3a4c3f4ac500f890ab55567e7 ]

In the situation when a port was started while no virtio driver was
connected, Rx interrupts were broken.
They were also broken after a virtio driver reconnects.

There were several issues mixed in:
- this driver was not exposing a fixed file descriptor per Rx queue,
  If a virtio driver was not connected yet, each Rx queue vector was
  pointing at a -1 fd, and an application could interpret this as a lack
  of Rx interrupt support,
- when a virtio driver later (re)connected, this net/vhost driver was
  hacking into the EAL layer epoll fd to remove a old vring kickfd and
  insert the new vring kickfd. This hack constitutes a layer violation
  plus users of rte_eth_dev_rx_intr_ctl_q_get_fd() were not notified of
  this change,
- in the case of reconnection, because the interrupt handle was
  reallocated, a 0 fd was failing to be removed from the EAL layer
  epoll fd, which resulted in never fixing the EAL epoll fd,

To fix Rx interrupts:
- allocating (eth_vhost_install_intr) / releasing
  (eth_vhost_uninstall_intr) the interrupt handle is moved when
  starting / closing the port, while setting / resetting per rxq fd is
  triggered by vhost events via some new helpers (see
  eth_vhost_configure_intr and eth_vhost_unconfigure_intr),
- a "proxy" epoll fd is created per Rx queue at the time the interrupt
  handle is allocated, so applications can start waiting for events on
  those fds, even before a virtio driver initialises,
- when available, vring kickd are populated in the "proxy" epoll fd,

Bugzilla ID: 1135
Fixes: 3f8ff12 ("vhost: support interrupt mode")
Fixes: 3d4cd4b ("net/vhost: fix interrupt mode")
Fixes: d61138d ("drivers: remove direct access to interrupt handle")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Tested-by: Dukai Yuan <dukaix.yuan@intel.com>
  • Loading branch information
david-marchand authored and kevintraynor committed Mar 21, 2023
1 parent a38b2e5 commit 1585556
Showing 1 changed file with 127 additions and 191 deletions.

0 comments on commit 1585556

Please sign in to comment.