Patch "virtio_net: Disable interrupts if napi_complete_done rescheduled napi" has been added to the 4.15-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
virtio_net: Disable interrupts if napi_complete_done rescheduled napi
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
virtio_net-disable-interrupts-if-napi_complete_done-rescheduled-napi.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Mar 16 15:11:08 CET 2018
From: Toshiaki Makita <[email protected]>
Date: Thu, 7 Dec 2017 13:15:15 +0900
Subject: virtio_net: Disable interrupts if napi_complete_done rescheduled napi
From: Toshiaki Makita <[email protected]>
[ Upstream commit fdaa767aefc1685f9a41e91f447c9aea94103df6 ]
Since commit 39e6c8208d7b ("net: solve a NAPI race") napi has been able to be rescheduled within napi_complete_done() even in non-busypoll case, but virtnet_poll() always enabled interrupts before complete, and when napi was rescheduled within napi_complete_done() it did not disable interrupts.
This caused more interrupts when event idx is disabled.
According to commit cbdadbbf0c79 ("virtio_net: fix race in RX VQ processing") we cannot place virtqueue_enable_cb_prepare() after NAPI_STATE_SCHED is cleared, so disable interrupts again if napi_complete_done() returned false.
Tested with vhost-user of OVS 2.7 on host, which does not have the event idx feature.
* Before patch:
$ netperf -t UDP_STREAM -H 192.168.150.253 -l 60 -- -m 1472 MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.150.253 () port 0 AF_INET Socket Message Elapsed Messages Size Size Time Okay Errors Throughput bytes bytes secs # # 10^6bits/sec
212992 1472 60.00 32763206 0 6430.32 212992 60.00 23384299 4589.56
Interrupts on guest: 9872369 Packets/interrupt: 2.37
* After patch
$ netperf -t UDP_STREAM -H 192.168.150.253 -l 60 -- -m 1472 MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.150.253 () port 0 AF_INET Socket Message Elapsed Messages Size Size Time Okay Errors Throughput bytes bytes secs # # 10^6bits/sec
212992 1472 60.00 32794646 0 6436.49 212992 60.00 32793501 6436.27
Interrupts on guest: 4941299 Packets/interrupt: 6.64
--- drivers/net/virtio_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/virtio_net.c +6 -3
@@ -261,9 +261,12 @@ static void virtqueue_napi_complete(struint opaque; opaque =virtqueue_enable_cb_prepare (vq); -if (napi_complete_done (napi, processed) && -unlikely (virtqueue_poll (vq, opaque))) -virtqueue_napi_schedule (napi, vq); +if (napi_complete_done (napi, processed)) { +if (unlikely (virtqueue_poll (vq, opaque))) +virtqueue_napi_schedule (napi, vq); + }else { +virtqueue_disable_cb (vq); + } }static void skb_xmit_done (struct virtqueue *vq)
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/virtio_net-disable-interrupts-if-napi_complete_done-rescheduled-napi.patch