]> www.infradead.org Git - users/hch/misc.git/commit
vhost-scsi: log I/O queue write descriptors
authorDongli Zhang <dongli.zhang@oracle.com>
Thu, 3 Apr 2025 06:29:51 +0000 (23:29 -0700)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 18 Apr 2025 14:08:11 +0000 (10:08 -0400)
commitc7a90b2b56ab3f7ebf798588e914dee4144c4b2d
tree5c5ca582a7d2e4557ce1f3f8e4b7d6e5abd17382
parent08e455d43d6b4f7d80d9122adf5ba54b98e2304d
vhost-scsi: log I/O queue write descriptors

Log write descriptors for the I/O queue, leveraging vhost_scsi_get_desc()
and vhost_get_vq_desc() to retrieve the array of write descriptors to
obtain the log buffer.

In addition, introduce a vhost-scsi specific function to log vring
descriptors. In this function, the 'partial' argument is set to false, and
the 'len' argument is set to 0, because vhost-scsi always logs all pages
shared by a vring descriptor. Add WARN_ON_ONCE() since vhost-scsi doesn't
support VIRTIO_F_ACCESS_PLATFORM.

The per-cmd log buffer is allocated on demand in the submission path after
VHOST_F_LOG_ALL is set. Return -ENOMEM on allocation failure, in order to
send SAM_STAT_TASK_SET_FULL to the guest.

It isn't reclaimed in the completion path. Instead, it is reclaimed when
VHOST_F_LOG_ALL is removed, or during VHOST_SCSI_SET_ENDPOINT when all
commands are destroyed.

Store the log buffer during the submission path and log it in the
completion path. Logging is also required in the error handling path of the
submission process.

Suggested-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-Id: <20250403063028.16045-7-dongli.zhang@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
drivers/vhost/scsi.c