[Devel] (no subject)

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jan 9 22:25:51 MSK 2024


<20230626232307.97930-7-michael.christie at oracle.com>
Subject: [PATCH RHEL9 COMMIT] ms/vhost: take worker or vq for flushing

The commit is pushed to "branch-rh9-5.14.0-362.8.1.vz9.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-362.8.1.vz9.35.5
------>
commit b33e9080a1e99b2043b1aa6e918b27e0ce346564
Author: Mike Christie <michael.christie at oracle.com>
Date:   Thu Jan 4 20:02:15 2024 +0300

    ms/vhost: take worker or vq for flushing
    
    This patch has the core work flush function take a worker. When we
    support multiple workers we can then flush each worker during device
    removal, stoppage, etc. It also adds a helper to flush specific
    virtqueues, so vhost-scsi can flush IO vqs from it's ctl vq.
    
    Signed-off-by: Mike Christie <michael.christie at oracle.com>
    Message-Id: <20230626232307.97930-7-michael.christie at oracle.com>
    Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
    
    ========
    
    (cherry picked from ms commit a6fc04739be7)
    https://virtuozzo.atlassian.net/browse/PSBM-152375
    https://virtuozzo.atlassian.net/browse/PSBM-139414
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
    
    Feature: vhost-blk: in-kernel accelerator for virtio-blk guests
---
 drivers/vhost/vhost.c | 15 +++++++++++++--
 drivers/vhost/vhost.h |  1 +
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index f12e8ff91632..1df207e59056 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -265,16 +265,27 @@ bool vhost_vq_work_queue(struct vhost_virtqueue *vq, struct vhost_work *work)
 }
 EXPORT_SYMBOL_GPL(vhost_vq_work_queue);
 
-void vhost_dev_flush(struct vhost_dev *dev)
+static void vhost_worker_flush(struct vhost_worker *worker)
 {
 	struct vhost_flush_struct flush;
 
 	init_completion(&flush.wait_event);
 	vhost_work_init(&flush.work, vhost_flush_work);
 
-	if (vhost_work_queue(dev, &flush.work))
+	if (vhost_worker_queue(worker, &flush.work))
 		wait_for_completion(&flush.wait_event);
 }
+
+void vhost_vq_flush(struct vhost_virtqueue *vq)
+{
+	vhost_worker_flush(vq->worker);
+}
+EXPORT_SYMBOL_GPL(vhost_vq_flush);
+
+void vhost_dev_flush(struct vhost_dev *dev)
+{
+	vhost_worker_flush(dev->worker);
+}
 EXPORT_SYMBOL_GPL(vhost_dev_flush);
 
 /* A lockless hint for busy polling code to exit the loop */
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index cd249b8d1861..11b85f7701e0 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -198,6 +198,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *,
 		      struct vhost_log *log, unsigned int *log_num);
 void vhost_discard_vq_desc(struct vhost_virtqueue *, int n);
 
+void vhost_vq_flush(struct vhost_virtqueue *vq);
 bool vhost_vq_work_queue(struct vhost_virtqueue *vq, struct vhost_work *work);
 bool vhost_vq_has_work(struct vhost_virtqueue *vq);
 bool vhost_vq_is_setup(struct vhost_virtqueue *vq);


More information about the Devel mailing list