Skip to content

Commit ac9dcca

Browse files
Dongli Zhangmstsirkin
authored andcommitted
vhost-scsi: log event queue write descriptors
Log write descriptors for the event queue, leveraging vhost_get_vq_desc() to retrieve the array of write descriptors to obtain the log buffer. There is only one path for event queue. Suggested-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Message-Id: <20250403063028.16045-9-dongli.zhang@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent a94c96a commit ac9dcca

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/vhost/scsi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
571571
struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
572572
struct virtio_scsi_event *event = &evt->event;
573573
struct virtio_scsi_event __user *eventp;
574+
struct vhost_log *vq_log;
575+
unsigned int log_num;
574576
unsigned out, in;
575577
int head, ret;
576578

@@ -581,9 +583,19 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
581583

582584
again:
583585
vhost_disable_notify(&vs->dev, vq);
586+
587+
vq_log = unlikely(vhost_has_feature(vq, VHOST_F_LOG_ALL)) ?
588+
vq->log : NULL;
589+
590+
/*
591+
* Reset 'log_num' since vhost_get_vq_desc() may reset it only
592+
* after certain condition checks.
593+
*/
594+
log_num = 0;
595+
584596
head = vhost_get_vq_desc(vq, vq->iov,
585597
ARRAY_SIZE(vq->iov), &out, &in,
586-
NULL, NULL);
598+
vq_log, &log_num);
587599
if (head < 0) {
588600
vs->vs_events_missed = true;
589601
return;
@@ -613,6 +625,8 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
613625
vhost_add_used_and_signal(&vs->dev, vq, head, 0);
614626
else
615627
vq_err(vq, "Faulted on vhost_scsi_send_event\n");
628+
629+
vhost_scsi_log_write(vq, vq_log, log_num);
616630
}
617631

618632
static void vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)

0 commit comments

Comments
 (0)