Skip to content

Commit e430451

Browse files
jasowangmstsirkin
authored andcommitted
vhost-net: flush batched before enabling notifications
Commit 8c2e6b2 ("vhost/net: Defer TX queue re-enable until after sendmsg") tries to defer the notification enabling by moving the logic out of the loop after the vhost_tx_batch() when nothing new is spotted. This caused unexpected side effects as the new logic is reused for several other error conditions. A previous patch reverted 8c2e6b2. Now, bring the performance back up by flushing batched buffers before enabling notifications. Reported-by: Jon Kohler <[email protected]> Cc: [email protected] Fixes: 8c2e6b2 ("vhost/net: Defer TX queue re-enable until after sendmsg") Signed-off-by: Jason Wang <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Message-Id: <[email protected]>
1 parent 4174152 commit e430451

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/vhost/net.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,11 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock)
780780
break;
781781
/* Nothing new? Wait for eventfd to tell us they refilled. */
782782
if (head == vq->num) {
783+
/* Flush batched packets to handle pending RX
784+
* work (if busyloop_intr is set) and to avoid
785+
* unnecessary virtqueue kicks.
786+
*/
787+
vhost_tx_batch(net, nvq, sock, &msg);
783788
if (unlikely(busyloop_intr)) {
784789
vhost_poll_queue(&vq->poll);
785790
} else if (unlikely(vhost_enable_notify(&net->dev,

0 commit comments

Comments
 (0)