qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23
@ 2014-01-23 11:53 Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops Paolo Bonzini
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel

Anthony,

the following changes since commit 1cf892ca2689c84960b4ce4d2723b6bee453711c:

  SPARC: Fix LEON3 power down instruction (2014-01-15 15:37:33 +1000)

are available in the git repository at:

  git://github.com/bonzini/qemu.git scsi-next

for you to fetch changes up to 1cb27d9233d572826b45bd8498d2fab1b6f01df9:

  scsi: Support TEST UNIT READY in the dummy LUN0 (2014-01-16 13:09:50 +0100)

Paolo
----------------------------------------------------------------
Eric Farman (2):
      virtio-scsi: Cleanup of I/Os that never started
      virtio-scsi: Prevent assertion on missed events

Jeff Cody (1):
      block: add .bdrv_reopen_prepare() stub for iscsi

Paolo Bonzini (2):
      scsi: Assign cancel_io vector for scsi_disk_emulate_ops
      scsi: Support TEST UNIT READY in the dummy LUN0

 block/iscsi.c         | 9 +++++++++
 hw/scsi/scsi-bus.c    | 2 ++
 hw/scsi/scsi-disk.c   | 1 +
 hw/scsi/virtio-scsi.c | 6 +++++-
 4 files changed, 17 insertions(+), 1 deletion(-)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops
  2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
@ 2014-01-23 11:53 ` Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 2/5] virtio-scsi: Cleanup of I/Os that never started Paolo Bonzini
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Farman, qemu-stable

Some emulated disk operations (MODE SELECT, UNMAP, WRITE SAME)
can trigger asynchronous I/Os.  Provide the cancel_io callback
to ensure that AIOCBs are properly cleaned up.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
[Tweak commit message. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index bce617c..ee1f5eb 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2306,6 +2306,7 @@ static const SCSIReqOps scsi_disk_emulate_reqops = {
     .send_command = scsi_disk_emulate_command,
     .read_data    = scsi_disk_emulate_read_data,
     .write_data   = scsi_disk_emulate_write_data,
+    .cancel_io    = scsi_cancel_io,
     .get_buf      = scsi_get_buf,
 };
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 2/5] virtio-scsi: Cleanup of I/Os that never started
  2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops Paolo Bonzini
@ 2014-01-23 11:53 ` Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 3/5] virtio-scsi: Prevent assertion on missed events Paolo Bonzini
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Farman, qemu-stable

From: Eric Farman <farman@linux.vnet.ibm.com>

There is still a small window that occurs when a cancel I/O affects
an asynchronous I/O operation that hasn't started.  In other words,
when the residual data length equals the expected data length.

Today, the routine virtio_scsi_command_complete fails because the
VirtIOSCSIReq pointer (from the hba_private field in SCSIRequest)
was cleared earlier when virtio_scsi_complete_req was called by
the virtio_scsi_request_cancelled routine.  As a result, the
virtio_scsi_command_complete routine needs to simply return when
it is processing a SCSIRequest block that was marked canceled.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6dcdd1b..1da98cd 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -306,6 +306,10 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
     VirtIOSCSIReq *req = r->hba_private;
     uint32_t sense_len;
 
+    if (r->io_canceled) {
+        return;
+    }
+
     req->resp.cmd->response = VIRTIO_SCSI_S_OK;
     req->resp.cmd->status = status;
     if (req->resp.cmd->status == GOOD) {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 3/5] virtio-scsi: Prevent assertion on missed events
  2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 2/5] virtio-scsi: Cleanup of I/Os that never started Paolo Bonzini
@ 2014-01-23 11:53 ` Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 4/5] block: add .bdrv_reopen_prepare() stub for iscsi Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 5/5] scsi: Support TEST UNIT READY in the dummy LUN0 Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Farman, qemu-stable

From: Eric Farman <farman@linux.vnet.ibm.com>

In some cases, an unplug can cause events to be dropped, which
leads to an assertion failure when preparing to notify the guest
kernel.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 1da98cd..6610b3a 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -520,7 +520,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
     evt->event = event;
     evt->reason = reason;
     if (!dev) {
-        assert(event == VIRTIO_SCSI_T_NO_EVENT);
+        assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
     } else {
         evt->lun[0] = 1;
         evt->lun[1] = dev->id;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 4/5] block: add .bdrv_reopen_prepare() stub for iscsi
  2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2014-01-23 11:53 ` [Qemu-devel] [PULL 3/5] virtio-scsi: Prevent assertion on missed events Paolo Bonzini
@ 2014-01-23 11:53 ` Paolo Bonzini
  2014-01-23 11:53 ` [Qemu-devel] [PULL 5/5] scsi: Support TEST UNIT READY in the dummy LUN0 Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jeff Cody

From: Jeff Cody <jcody@redhat.com>

To suppport reopen(), the .bdrv_reopen_prepare() stub must exist.
iSCSI does not have anything that needs to be done to support reopen,
so we can just implement the _prepare() stub.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/iscsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index c0ea0c4..5976bd1 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1326,6 +1326,14 @@ static void iscsi_close(BlockDriverState *bs)
     memset(iscsilun, 0, sizeof(IscsiLun));
 }
 
+/* We have nothing to do for iSCSI reopen, stub just returns
+ * success */
+static int iscsi_reopen_prepare(BDRVReopenState *state,
+                                BlockReopenQueue *queue, Error **errp)
+{
+    return 0;
+}
+
 static int iscsi_truncate(BlockDriverState *bs, int64_t offset)
 {
     IscsiLun *iscsilun = bs->opaque;
@@ -1434,6 +1442,7 @@ static BlockDriver bdrv_iscsi = {
     .bdrv_close      = iscsi_close,
     .bdrv_create     = iscsi_create,
     .create_options  = iscsi_create_options,
+    .bdrv_reopen_prepare  = iscsi_reopen_prepare,
 
     .bdrv_getlength  = iscsi_getlength,
     .bdrv_get_info   = iscsi_get_info,
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 5/5] scsi: Support TEST UNIT READY in the dummy LUN0
  2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2014-01-23 11:53 ` [Qemu-devel] [PULL 4/5] block: add .bdrv_reopen_prepare() stub for iscsi Paolo Bonzini
@ 2014-01-23 11:53 ` Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2014-01-23 11:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

SeaBIOS waits for LUN0 to respond to the TEST UNIT READY command
in order to decide whether it should part of the boot sequence.
If LUN0 does not respond to the command, boot is delayed by up
to 5 seconds.  This currently happens when there is no LUN0 on
a target.  Fix that by adding a trivial implementation of the
command.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 3496c0b..50b89ad 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -469,6 +469,8 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf)
             r->req.dev->sense_is_ua = false;
         }
         break;
+    case TEST_UNIT_READY:
+        break;
     default:
         scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
         scsi_req_complete(req, CHECK_CONDITION);
-- 
1.8.3.1

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

end of thread, other threads:[~2014-01-23 11:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 11:53 [Qemu-devel] [PULL 0/5] SCSI changes for 2014-01-23 Paolo Bonzini
2014-01-23 11:53 ` [Qemu-devel] [PULL 1/5] scsi: Assign cancel_io vector for scsi_disk_emulate_ops Paolo Bonzini
2014-01-23 11:53 ` [Qemu-devel] [PULL 2/5] virtio-scsi: Cleanup of I/Os that never started Paolo Bonzini
2014-01-23 11:53 ` [Qemu-devel] [PULL 3/5] virtio-scsi: Prevent assertion on missed events Paolo Bonzini
2014-01-23 11:53 ` [Qemu-devel] [PULL 4/5] block: add .bdrv_reopen_prepare() stub for iscsi Paolo Bonzini
2014-01-23 11:53 ` [Qemu-devel] [PULL 5/5] scsi: Support TEST UNIT READY in the dummy LUN0 Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).