From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: yang.zhang.wz@gmail.com, RAPOPORT@il.ibm.com,
kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH V3 3/3] vhost_net: basic polling support
Date: Mon, 29 Feb 2016 13:15:48 +0800 [thread overview]
Message-ID: <56D3D404.6080600@redhat.com> (raw)
In-Reply-To: <20160228140937.GA8855@redhat.com>
On 02/28/2016 10:09 PM, Michael S. Tsirkin wrote:
> On Fri, Feb 26, 2016 at 04:42:44PM +0800, Jason Wang wrote:
>> > This patch tries to poll for new added tx buffer or socket receive
>> > queue for a while at the end of tx/rx processing. The maximum time
>> > spent on polling were specified through a new kind of vring ioctl.
>> >
>> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> Looks good overall, but I still see one problem.
>
>> > ---
>> > drivers/vhost/net.c | 79 +++++++++++++++++++++++++++++++++++++++++++---
>> > drivers/vhost/vhost.c | 14 ++++++++
>> > drivers/vhost/vhost.h | 1 +
>> > include/uapi/linux/vhost.h | 6 ++++
>> > 4 files changed, 95 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> > index 9eda69e..c91af93 100644
>> > --- a/drivers/vhost/net.c
>> > +++ b/drivers/vhost/net.c
>> > @@ -287,6 +287,44 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
>> > rcu_read_unlock_bh();
>> > }
>> >
>> > +static inline unsigned long busy_clock(void)
>> > +{
>> > + return local_clock() >> 10;
>> > +}
>> > +
>> > +static bool vhost_can_busy_poll(struct vhost_dev *dev,
>> > + unsigned long endtime)
>> > +{
>> > + return likely(!need_resched()) &&
>> > + likely(!time_after(busy_clock(), endtime)) &&
>> > + likely(!signal_pending(current)) &&
>> > + !vhost_has_work(dev) &&
>> > + single_task_running();
> So I find it quite unfortunate that this still uses single_task_running.
> This means that for example a SCHED_IDLE task will prevent polling from
> becoming active, and that seems like a bug, or at least
> an undocumented feature :).
Yes, it may need more thoughts.
>
> Unfortunately this logic affects the behaviour as observed
> by userspace, so we can't merge it like this and tune
> afterwards, since otherwise mangement tools will start
> depending on this logic.
>
>
How about remove single_task_running() first here and optimize on top?
We probably need something like this to handle overcommitment.
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
RAPOPORT@il.ibm.com, yang.zhang.wz@gmail.com
Subject: Re: [PATCH V3 3/3] vhost_net: basic polling support
Date: Mon, 29 Feb 2016 13:15:48 +0800 [thread overview]
Message-ID: <56D3D404.6080600@redhat.com> (raw)
In-Reply-To: <20160228140937.GA8855@redhat.com>
On 02/28/2016 10:09 PM, Michael S. Tsirkin wrote:
> On Fri, Feb 26, 2016 at 04:42:44PM +0800, Jason Wang wrote:
>> > This patch tries to poll for new added tx buffer or socket receive
>> > queue for a while at the end of tx/rx processing. The maximum time
>> > spent on polling were specified through a new kind of vring ioctl.
>> >
>> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> Looks good overall, but I still see one problem.
>
>> > ---
>> > drivers/vhost/net.c | 79 +++++++++++++++++++++++++++++++++++++++++++---
>> > drivers/vhost/vhost.c | 14 ++++++++
>> > drivers/vhost/vhost.h | 1 +
>> > include/uapi/linux/vhost.h | 6 ++++
>> > 4 files changed, 95 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> > index 9eda69e..c91af93 100644
>> > --- a/drivers/vhost/net.c
>> > +++ b/drivers/vhost/net.c
>> > @@ -287,6 +287,44 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
>> > rcu_read_unlock_bh();
>> > }
>> >
>> > +static inline unsigned long busy_clock(void)
>> > +{
>> > + return local_clock() >> 10;
>> > +}
>> > +
>> > +static bool vhost_can_busy_poll(struct vhost_dev *dev,
>> > + unsigned long endtime)
>> > +{
>> > + return likely(!need_resched()) &&
>> > + likely(!time_after(busy_clock(), endtime)) &&
>> > + likely(!signal_pending(current)) &&
>> > + !vhost_has_work(dev) &&
>> > + single_task_running();
> So I find it quite unfortunate that this still uses single_task_running.
> This means that for example a SCHED_IDLE task will prevent polling from
> becoming active, and that seems like a bug, or at least
> an undocumented feature :).
Yes, it may need more thoughts.
>
> Unfortunately this logic affects the behaviour as observed
> by userspace, so we can't merge it like this and tune
> afterwards, since otherwise mangement tools will start
> depending on this logic.
>
>
How about remove single_task_running() first here and optimize on top?
We probably need something like this to handle overcommitment.
next prev parent reply other threads:[~2016-02-29 5:15 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 ` [PATCH V3 1/3] vhost: introduce vhost_has_work() Jason Wang
2016-02-26 8:42 ` 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 [this message]
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=56D3D404.6080600@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.