]> git.ipfire.org Git - thirdparty/qemu.git/commit
vhost: Don't set vring call if guest notifier is unused
authorHuaitong Han <hanht2@chinatelecom.cn>
Thu, 22 May 2025 10:05:48 +0000 (18:05 +0800)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 2 Jun 2025 20:50:21 +0000 (23:50 +0300)
commit9ee786d9d850ef60838f031f9fbdd99a39bee124
treec536ff920b8859294e98bd10690e1e89a714fed6
parent010f9a472c8c762a727d72310f55db3258cda3d5
vhost: Don't set vring call if guest notifier is unused

The vring call fd is set even when the guest does not use MSI-X (e.g., in the
case of virtio PMD), leading to unnecessary CPU overhead for processing
interrupts.

The commit 96a3d98d2c("vhost: don't set vring call if no vector") optimized the
case where MSI-X is enabled but the queue vector is unset. However, there's an
additional case where the guest uses INTx and the INTx_DISABLED bit in the PCI
config is set, meaning that no interrupt notifier will actually be used.

In such cases, the vring call fd should also be cleared to avoid redundant
interrupt handling.

Fixes: 96a3d98d2c("vhost: don't set vring call if no vector")
Reported-by: Zhiyuan Yuan <yuanzhiyuan@chinatelecom.cn>
Signed-off-by: Jidong Xia <xiajd@chinatelecom.cn>
Signed-off-by: Huaitong Han <hanht2@chinatelecom.cn>
Message-Id: <20250522100548.212740-1-hanht2@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit a9403bfcd93025df7b1924d0cf34fbc408955b33)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/pci/pci.c
hw/virtio/virtio-pci.c
include/hw/pci/pci.h