All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] virtio: synchronize callbacks after device reset
@ 2026-09-11 12:37 Michael S. Tsirkin
  2026-09-11 12:37 ` [PATCH 2/2] virtio_pci: drop extra callback sync Michael S. Tsirkin
  2026-09-11 12:44 ` [PATCH 1/2] virtio: synchronize callbacks after device reset sashiko-bot
  0 siblings, 2 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2026-09-11 12:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Karl Mehltretter, Jason Wang, Eugenio Pérez, Xuan Zhuo,
	virtualization

virtio_reset_device says:
	Note: this guarantees that vq callbacks are not in progress
but in practice, only virtio pci correctly synchronizes the cbs.

On other transports, a callback that is already executing, keeps running
while the driver tears down the state it uses.

Add virtio_synchronize_cbs to virtio_reset_device fixing this for all
transports that correctly implement synchronize_cbs().

Reported-by: Karl Mehltretter <kmehltretter@gmail.com>
Link: https://lore.kernel.org/all/20260818040433.66986-1-kmehltretter@gmail.com/
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/virtio/virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index b6c9e927bef5..a8588d7ad109 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -264,6 +264,8 @@ void virtio_reset_device(struct virtio_device *dev)
 #endif
 
 	dev->config->reset(dev);
+	/* Flush pending VQ/configuration callbacks. */
+	virtio_synchronize_cbs(dev);
 }
 EXPORT_SYMBOL_GPL(virtio_reset_device);
 
-- 
MST


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-11 19:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 12:37 [PATCH 1/2] virtio: synchronize callbacks after device reset Michael S. Tsirkin
2026-09-11 12:37 ` [PATCH 2/2] virtio_pci: drop extra callback sync Michael S. Tsirkin
2026-09-11 12:57   ` sashiko-bot
2026-09-11 19:38     ` Michael S. Tsirkin
2026-09-11 12:44 ` [PATCH 1/2] virtio: synchronize callbacks after device reset sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.