From: Mike Christie <michael.christie@oracle.com> To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org Cc: Mike Christie <michael.christie@oracle.com> Subject: [PATCH V5 04/12] vhost: take worker or vq instead of dev for flushing Date: Mon, 6 Dec 2021 20:51:09 -0600 [thread overview] Message-ID: <20211207025117.23551-5-michael.christie@oracle.com> (raw) In-Reply-To: <20211207025117.23551-1-michael.christie@oracle.com> This patch has the core work flush function take a worker for when we support multiple workers. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/vhost/vhost.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 86192e1658af..e5f5acc7e648 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -246,6 +246,20 @@ static void vhost_work_queue_on(struct vhost_worker *worker, } } +static void vhost_work_flush_on(struct vhost_worker *worker) +{ + struct vhost_flush_struct flush; + + if (!worker) + return; + + init_completion(&flush.wait_event); + vhost_work_init(&flush.work, vhost_flush_work); + + vhost_work_queue_on(worker, &flush.work); + wait_for_completion(&flush.wait_event); +} + void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) { vhost_work_queue_on(dev->worker, work); @@ -260,15 +274,7 @@ EXPORT_SYMBOL_GPL(vhost_vq_work_queue); void vhost_work_dev_flush(struct vhost_dev *dev) { - struct vhost_flush_struct flush; - - if (dev->worker) { - init_completion(&flush.wait_event); - vhost_work_init(&flush.work, vhost_flush_work); - - vhost_work_queue(dev, &flush.work); - wait_for_completion(&flush.wait_event); - } + vhost_work_flush_on(dev->worker); } EXPORT_SYMBOL_GPL(vhost_work_dev_flush); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Mike Christie <michael.christie@oracle.com> To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org Subject: [PATCH V5 04/12] vhost: take worker or vq instead of dev for flushing Date: Mon, 6 Dec 2021 20:51:09 -0600 [thread overview] Message-ID: <20211207025117.23551-5-michael.christie@oracle.com> (raw) In-Reply-To: <20211207025117.23551-1-michael.christie@oracle.com> This patch has the core work flush function take a worker for when we support multiple workers. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/vhost/vhost.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 86192e1658af..e5f5acc7e648 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -246,6 +246,20 @@ static void vhost_work_queue_on(struct vhost_worker *worker, } } +static void vhost_work_flush_on(struct vhost_worker *worker) +{ + struct vhost_flush_struct flush; + + if (!worker) + return; + + init_completion(&flush.wait_event); + vhost_work_init(&flush.work, vhost_flush_work); + + vhost_work_queue_on(worker, &flush.work); + wait_for_completion(&flush.wait_event); +} + void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) { vhost_work_queue_on(dev->worker, work); @@ -260,15 +274,7 @@ EXPORT_SYMBOL_GPL(vhost_vq_work_queue); void vhost_work_dev_flush(struct vhost_dev *dev) { - struct vhost_flush_struct flush; - - if (dev->worker) { - init_completion(&flush.wait_event); - vhost_work_init(&flush.work, vhost_flush_work); - - vhost_work_queue(dev, &flush.work); - wait_for_completion(&flush.wait_event); - } + vhost_work_flush_on(dev->worker); } EXPORT_SYMBOL_GPL(vhost_work_dev_flush); -- 2.25.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-12-07 2:51 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-07 2:51 [PATCH V5 00/12] vhost: multiple worker support Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 01/12] vhost: add vhost_worker pointer to vhost_virtqueue Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 02/12] vhost, vhost-net: add helper to check if vq has work Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 03/12] vhost: take worker or vq instead of dev for queueing Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` Mike Christie [this message] 2021-12-07 2:51 ` [PATCH V5 04/12] vhost: take worker or vq instead of dev for flushing Mike Christie 2021-12-07 2:51 ` [PATCH V5 05/12] vhost: convert poll work to be vq based Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 06/12] vhost-sock: convert to vhost_vq_work_queue Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 07/12] vhost-scsi: make SCSI cmd completion per vq Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 08/12] vhost-scsi: convert to vhost_vq_work_queue Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 09/12] vhost: remove vhost_work_queue Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 10/12] vhost-scsi: flush IO vqs then send TMF rsp Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 11/12] vhost: allow userspace to create workers Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-07 2:51 ` [PATCH V5 12/12] vhost: allow worker attachment after initial setup Mike Christie 2021-12-07 2:51 ` Mike Christie 2021-12-08 4:24 ` [PATCH V5 00/12] vhost: multiple worker support Jason Wang 2021-12-08 4:24 ` Jason Wang
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=20211207025117.23551-5-michael.christie@oracle.com \ --to=michael.christie@oracle.com \ --cc=jasowang@redhat.com \ --cc=linux-scsi@vger.kernel.org \ --cc=mst@redhat.com \ --cc=sgarzare@redhat.com \ --cc=stefanha@redhat.com \ --cc=target-devel@vger.kernel.org \ --cc=virtualization@lists.linux-foundation.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.