]> www.infradead.org Git - users/jedix/linux-maple.git/commit
virtio: fix up virtio_disable_cb
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 13 Apr 2021 05:19:16 +0000 (01:19 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 4 May 2021 08:19:59 +0000 (04:19 -0400)
commit41e0088d136537e88ee84eb1ef05514cec50b26d
treef00bd3d916a6694902ece48f75d2b0f339437885
parent0c077be4da36d1a1110b7f3184de0662aeaafe44
virtio: fix up virtio_disable_cb

virtio_disable_cb is currently a nop for split ring with event index.
This is because it used to be always called from a callback when we know
device won't trigger more events until we update the index.  However,
now that we run with interrupts enabled a lot we also poll without a
callback so that is different: disabling callbacks will help reduce the
number of spurious interrupts.
Further, if using event index with a packed ring, and if being called
from a callback, we actually do disable interrupts which is unnecessary.

Fix both issues by tracking whenever we get a callback. If that is
the case disabling interrupts with event index can be a nop.
If not the case disable interrupts. Note: with a split ring
there's no explicit "no interrupts" value. For now we write
a fixed value so our chance of triggering an interupt
is 1/ring size. It's probably better to write something
related to the last used index there to reduce the chance
even further. For now I'm keeping it simple.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_ring.c