zuoboqun 16f6804c46 vhost_net: fix assertion triggered by batch of host notifiers processing
When the backend of vhost_net restarts during the vm is running, vhost_net
is stopped and started. The virtio_device_grab_ioeventfd() fucntion in
vhost_net_enable_notifiers() will result in a call to
virtio_bus_set_host_notifier()(assign=false).

And now virtio_device_grab_ioeventfd() is batched in a single transaction
with virtio_bus_set_host_notifier()(assign=true).

This triggers the following assertion:

kvm_mem_ioeventfd_del: error deleting ioeventfd: Bad file descriptor

This patch moves virtio_device_grab_ioeventfd() out of the batch to fix
this problem.

To be noted that the for loop to release ioeventfd should start from i+1,
not i, because the i-th ioeventfd has already been released in
vhost_dev_disable_notifiers_nvqs().

Fixes: 6166799f6 ("vhost_net: configure all host notifiers in a single MR transaction")
Signed-off-by: Zuo Boqun <zuoboqun@baidu.com>
Reported-by: Gao Shiyuan <gaoshiyuan@baidu.com>

Message-Id: <20241115080312.3184-1-zuoboqun@baidu.com>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-11-26 16:35:51 -05:00
..
2023-03-10 15:35:38 +08:00
2023-09-20 07:54:34 +03:00
2024-03-12 19:28:32 +08:00
2024-06-04 15:14:25 +08:00
2023-09-20 07:54:34 +03:00
2023-11-13 15:33:37 +08:00
2024-03-12 19:28:31 +08:00
2023-12-30 07:38:06 +11:00
2023-12-30 07:38:06 +11:00
2023-12-30 07:38:06 +11:00
2023-12-30 07:38:06 +11:00
2019-08-16 13:31:52 +02:00
2024-06-04 15:14:25 +08:00
2023-05-23 15:20:15 +08:00
2024-03-12 19:28:32 +08:00
2023-09-20 07:54:34 +03:00
2023-12-30 07:38:06 +11:00