Skip to content

scsi: virtio_scsi: move INIT_WORK calls to virtscsi_probe

Joshua Daley linux-scsi lkml virtualization 4 versions – Applied

Status from this message: Applied to 7.1/scsi-staging, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 4 repliesApplied
  2. v33 patches 3 repliesSuperseded
  3. v23 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch5 repliesSuperseded

Changelog v2 -> v3 from the cover letter

- switched the order of patches 2 & 3 to fix compilation error.
- added reviewed-by tags.

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/2scsi: virtio_scsi: move INIT_WORK calls to virtscsi_probedrivers/scsi/virtio_scsi.c+4 -31 reply
2/2scsi: virtio_scsi: kick event_list unconditionallydrivers/scsi/virtio_scsi.c+6 -91 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchStefan Hajnoczi
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_probe

TITLE CHANGED! Original series title:
"scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init" Previous version:
https://lore.kernel.org/linux-scsi/[email protected]/T/#t

Changelog v3 -> v4:

[PATCH v3 1/3] scsi: virtio_scsi: kick event_list unconditionally
-> [PATCH v4 2/2] scsi: virtio_scsi: kick event_list unconditionally
- this patch now comes after moving the INIT_WORK calls, to address bisection concerns:
https://lore.kernel.org/linux-scsi/[email protected]/
- the code changes are a bit different given that the INIT_WORK calls are now moved into virtscsi_probe(), but the concept is the same.

[PATCH v3 2/3] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init -> [PATCH v4 1/2] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_probe
- the INIT_WORK calls are now moved to virtscsi_probe() to address concerns with suspend/resume. The title of the series is changed to reflect this.

[PATCH v3 3/3] scsi: virtio_scsi: remove unnecessary fn declaration
- squashed into [PATCH v4 1/2]

-----

v3 cover letter:

Changelog v2 -> v3:

- switched the order of patches 2 & 3 to fix compilation error.
- added reviewed-by tags.

-----

v2 cover letter:

Changelog v1 -> v2:

- Added 2 additional patches:
- [PATCH v2 1/3] scsi: virtio_scsi: kick event_list unconditionally
- Removes the conditions surrounding event_list operations (suggested by Stefan Hajnoczi [<[email protected]>](mailto:[email protected]))
- [PATCH v2 2/3] scsi: virtio_scsi: remove unnecessary fn declaration
- Removes virtscsi_handle_event() prototype (suggested by Eric Farman [<[email protected]>](mailto:[email protected]))

- [PATCH 1/1] -> [PATCH v2 3/3] scsi: virtio_scsi: move INIT_WORK calls to virtscsi_init
- Removed the condition surrounding INIT_WORK calls

-----

v1 cover letter:

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 (2):
scsi: virtio_scsi: move INIT_WORK calls to virtscsi_probe
scsi: virtio_scsi: kick event_list unconditionally

 drivers/scsi/virtio_scsi.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1