All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: kvm@vger.kernel.org, mst@redhat.com,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: RAPOPORT@il.ibm.com, yang.zhang.wz@gmail.com,
	Jason Wang <jasowang@redhat.com>
Subject: [PATCH V3 1/3] vhost: introduce vhost_has_work()
Date: Fri, 26 Feb 2016 16:42:42 +0800	[thread overview]
Message-ID: <1456476164-17242-2-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1456476164-17242-1-git-send-email-jasowang@redhat.com>

This path introduces a helper which can give a hint for whether or not
there's a work queued in the work list. This could be used for busy
polling code to exit the busy loop.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vhost.c | 7 +++++++
 drivers/vhost/vhost.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ad2146a..90ac092 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -245,6 +245,13 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 }
 EXPORT_SYMBOL_GPL(vhost_work_queue);
 
+/* A lockless hint for busy polling code to exit the loop */
+bool vhost_has_work(struct vhost_dev *dev)
+{
+	return !list_empty(&dev->work_list);
+}
+EXPORT_SYMBOL_GPL(vhost_has_work);
+
 void vhost_poll_queue(struct vhost_poll *poll)
 {
 	vhost_work_queue(poll->dev, &poll->work);
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index d3f7674..43284ad 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -37,6 +37,7 @@ struct vhost_poll {
 
 void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
 void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+bool vhost_has_work(struct vhost_dev *dev);
 
 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 		     unsigned long mask, struct vhost_dev *dev);
-- 
2.5.0

WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: kvm@vger.kernel.org, mst@redhat.com,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: yang.zhang.wz@gmail.com, RAPOPORT@il.ibm.com
Subject: [PATCH V3 1/3] vhost: introduce vhost_has_work()
Date: Fri, 26 Feb 2016 16:42:42 +0800	[thread overview]
Message-ID: <1456476164-17242-2-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1456476164-17242-1-git-send-email-jasowang@redhat.com>

This path introduces a helper which can give a hint for whether or not
there's a work queued in the work list. This could be used for busy
polling code to exit the busy loop.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vhost.c | 7 +++++++
 drivers/vhost/vhost.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ad2146a..90ac092 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -245,6 +245,13 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 }
 EXPORT_SYMBOL_GPL(vhost_work_queue);
 
+/* A lockless hint for busy polling code to exit the loop */
+bool vhost_has_work(struct vhost_dev *dev)
+{
+	return !list_empty(&dev->work_list);
+}
+EXPORT_SYMBOL_GPL(vhost_has_work);
+
 void vhost_poll_queue(struct vhost_poll *poll)
 {
 	vhost_work_queue(poll->dev, &poll->work);
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index d3f7674..43284ad 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -37,6 +37,7 @@ struct vhost_poll {
 
 void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
 void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
+bool vhost_has_work(struct vhost_dev *dev);
 
 void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 		     unsigned long mask, struct vhost_dev *dev);
-- 
2.5.0

  reply	other threads:[~2016-02-26  8:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26  8:42 [PATCH V3 0/3] basic busy polling support for vhost_net Jason Wang
2016-02-26  8:42 ` Jason Wang
2016-02-26  8:42 ` Jason Wang [this message]
2016-02-26  8:42   ` [PATCH V3 1/3] vhost: introduce vhost_has_work() Jason Wang
2016-02-26  8:42 ` [PATCH V3 2/3] vhost: introduce vhost_vq_avail_empty() Jason Wang
2016-02-26  8:42   ` Jason Wang
2016-02-26  8:42 ` [PATCH V3 3/3] vhost_net: basic polling support Jason Wang
2016-02-26  8:42   ` Jason Wang
2016-02-28 14:09   ` Michael S. Tsirkin
2016-02-28 14:09     ` Michael S. Tsirkin
2016-02-29  5:15     ` Jason Wang
2016-02-29  5:15       ` Jason Wang
2016-02-29  9:03       ` Michael S. Tsirkin
2016-02-29  9:03         ` Michael S. Tsirkin
2016-02-28 21:56   ` Christian Borntraeger
2016-02-28 21:56     ` Christian Borntraeger
2016-02-29  5:17     ` Jason Wang
2016-02-29  5:17       ` Jason Wang
2016-02-26 16:45 ` [PATCH V3 0/3] basic busy polling support for vhost_net David Miller
2016-02-26 16:45   ` David Miller
2016-02-28  9:12   ` Michael S. Tsirkin
2016-02-28  9:12     ` Michael S. Tsirkin

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=1456476164-17242-2-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=RAPOPORT@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=yang.zhang.wz@gmail.com \
    /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 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.