[Devel] [PATCH RHEL9 COMMIT] Revert "drivers/vhost: adjust vhost to flush all workers"

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 16 17:03:17 MSK 2022


The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.9
------>
commit 610d6983f0ca75ded43cf7301d7e247c3516c3f4
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Nov 16 15:56:17 2022 +0300

    Revert "drivers/vhost: adjust vhost to flush all workers"
    
    This reverts commit 34ad7f1ca277f9cac97fa1accfb466afe13b316e.
    
    Will apply v5 of the patchset.
    https://jira.sw.ru/browse/PSBM-139414
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/vhost/vhost.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index bcdbbec06ddf..968601325a37 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -246,19 +246,15 @@ static void vhost_work_queue_at_worker(struct vhost_worker *w,
 
 void vhost_work_dev_flush(struct vhost_dev *dev)
 {
-	struct vhost_flush_struct flush[VHOST_MAX_WORKERS];
-	int i, nworkers;
+	struct vhost_flush_struct flush;
 
-	nworkers = READ_ONCE(dev->nworkers);
+	if (dev->workers[0].worker) {
+		init_completion(&flush.wait_event);
+		vhost_work_init(&flush.work, vhost_flush_work);
 
-	for (i = 0; i < nworkers; i++) {
-		init_completion(&flush[i].wait_event);
-		vhost_work_init(&flush[i].work, vhost_flush_work);
-		vhost_work_queue_at_worker(&dev->workers[i], &flush[i].work);
+		vhost_work_queue(dev, &flush.work);
+		wait_for_completion(&flush.wait_event);
 	}
-
-	for (i = 0; i < nworkers; i++)
-		wait_for_completion(&flush[i].wait_event);
 }
 EXPORT_SYMBOL_GPL(vhost_work_dev_flush);
 


More information about the Devel mailing list