public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH 0/1] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init
@ 2026-02-26 20:43 Joshua Daley
  2026-02-26 20:43 ` [PATCH 1/1] " Joshua Daley
  0 siblings, 1 reply; 7+ messages in thread
From: Joshua Daley @ 2026-02-26 20:43 UTC (permalink / raw)
  To: linux-scsi
  Cc: linux-kernel, virtualization, jdaley, mst, jasowang, pbonzini,
	stefanha, eperezma, James.Bottomley, martin.petersen, mjrosato,
	farman, frankja

This patch avoids a kernel warning that may occur if a virtio_scsi
controller is detached immediately following a disk detach. See the
commit message for details. The following are instructions to
produce the warning (without the proposed patch).

Timing matters--if all event work items call INIT_WORK before they are
flushed by cancel_work_sync, then the warning will not occur.

The warning will occur consistently if a sleep is added in
virtscsi_kick_event before the INIT_WORK call, like so:

#include <linux/delay.h>

static int virtscsi_kick_event(struct virtio_scsi *vscsi,
			       struct virtio_scsi_event_node *event_node)
{
    int err;
    struct scatterlist sg;
    unsigned long flags;

 -> msleep(1000);
    INIT_WORK(&event_node->work, virtscsi_handle_event);
	
    ...
}

Then, just detach a disk and its controller in quick succession:

virsh detach-device --domain <domain> disk.xml; \
virsh detach-device --domain <domain> controller.xml

where disk.xml and controller.xml are text files containing the XML
of the disk and controller.

Or, with the libvirt python module:

domain.detachDevice(str(disk_xml))
domain.detachDevice(str(controller_xml))

Joshua Daley (1):
  scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init

 drivers/scsi/virtio_scsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.34.1


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

end of thread, other threads:[~2026-03-09 23:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-26 20:43 [PATCH 0/1] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init Joshua Daley
2026-02-26 20:43 ` [PATCH 1/1] " Joshua Daley
2026-03-03 21:45   ` Eric Farman
2026-03-04 18:14     ` Joshua Daley
2026-03-09  3:06   ` Stefan Hajnoczi
2026-03-09 21:03     ` Joshua Daley
2026-03-09 23:07       ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox