From: Dongli Zhang <dongli.zhang@oracle.com>
To: virtualization@lists.linux.dev, kvm@vger.kernel.org,
netdev@vger.kernel.org
Cc: mst@redhat.com, jasowang@redhat.com, michael.christie@oracle.com,
pbonzini@redhat.com, stefanha@redhat.com, eperezma@redhat.com,
joao.m.martins@oracle.com, joe.jin@oracle.com,
si-wei.liu@oracle.com, linux-kernel@vger.kernel.org
Subject: [PATCH v3 8/9] vhost-scsi: log event queue write descriptors
Date: Wed, 2 Apr 2025 23:29:53 -0700 [thread overview]
Message-ID: <20250403063028.16045-9-dongli.zhang@oracle.com> (raw)
In-Reply-To: <20250403063028.16045-1-dongli.zhang@oracle.com>
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>
---
drivers/vhost/scsi.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 1a1a4cd95ace..08e38f866a2c 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -571,6 +571,8 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
struct virtio_scsi_event *event = &evt->event;
struct virtio_scsi_event __user *eventp;
+ struct vhost_log *vq_log;
+ unsigned int log_num;
unsigned out, in;
int head, ret;
@@ -581,9 +583,19 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
again:
vhost_disable_notify(&vs->dev, vq);
+
+ vq_log = unlikely(vhost_has_feature(vq, VHOST_F_LOG_ALL)) ?
+ vq->log : NULL;
+
+ /*
+ * Reset 'log_num' since vhost_get_vq_desc() may reset it only
+ * after certain condition checks.
+ */
+ log_num = 0;
+
head = vhost_get_vq_desc(vq, vq->iov,
ARRAY_SIZE(vq->iov), &out, &in,
- NULL, NULL);
+ vq_log, &log_num);
if (head < 0) {
vs->vs_events_missed = true;
return;
@@ -613,6 +625,8 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
vhost_add_used_and_signal(&vs->dev, vq, head, 0);
else
vq_err(vq, "Faulted on vhost_scsi_send_event\n");
+
+ vhost_scsi_log_write(vq, vq_log, log_num);
}
static void vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)
--
2.39.3
next prev parent reply other threads:[~2025-04-03 6:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 6:29 [PATCH v3 0/9] vhost-scsi: log write descriptors for live migration (and three bugfix) Dongli Zhang
2025-04-03 6:29 ` [PATCH v3 1/9] vhost-scsi: protect vq->log_used with vq->mutex Dongli Zhang
2025-04-03 6:29 ` [PATCH v3 2/9] vhost-scsi: Fix vhost_scsi_send_bad_target() Dongli Zhang
2025-04-03 6:29 ` [PATCH v3 3/9] vhost-scsi: Fix vhost_scsi_send_status() Dongli Zhang
2025-04-03 6:29 ` [PATCH v3 4/9] vhost: modify vhost_log_write() for broader users Dongli Zhang
2025-04-16 7:58 ` Dongli Zhang
2025-04-21 3:08 ` Jason Wang
2025-04-03 6:29 ` [PATCH v3 5/9] vhost-scsi: adjust vhost_scsi_get_desc() to log vring descriptors Dongli Zhang
2025-04-03 6:29 ` [PATCH v3 6/9] vhost-scsi: log I/O queue write descriptors Dongli Zhang
2025-04-06 21:41 ` Mike Christie
2025-04-03 6:29 ` [PATCH v3 7/9] vhost-scsi: log control " Dongli Zhang
2025-04-06 21:43 ` Mike Christie
2025-04-03 6:29 ` Dongli Zhang [this message]
2025-04-03 6:29 ` [PATCH v3 9/9] vhost: add WARNING if log_num is more than limit Dongli Zhang
2025-04-14 16:32 ` Michael S. Tsirkin
2025-04-14 16:52 ` Dongli Zhang
2025-04-14 18:39 ` Michael S. Tsirkin
2025-04-14 20:52 ` Dongli Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250403063028.16045-9-dongli.zhang@oracle.com \
--to=dongli.zhang@oracle.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=joe.jin@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.christie@oracle.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=si-wei.liu@oracle.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).