search for: vhost_vq_avail_empty

Displaying 20 results from an estimated 236 matches for "vhost_vq_avail_empty".

2017 Jan 09
2
[PATCH V4 net-next 1/3] vhost: better detection of available buffers
On Mon, Jan 09, 2017 at 10:59:16AM +0800, Jason Wang wrote: > > > On 2017?01?07? 03:55, Michael S. Tsirkin wrote: > > On Fri, Jan 06, 2017 at 10:13:15AM +0800, Jason Wang wrote: > > > This patch tries to do several tweaks on vhost_vq_avail_empty() for a > > > better performance: > > > > > > - check cached avail index first which could avoid userspace memory access. > > > - using unlikely() for the failure of userspace access > > > - check vq->last_avail_idx instead of cached avail index as t...
2017 Jan 09
2
[PATCH V4 net-next 1/3] vhost: better detection of available buffers
On Mon, Jan 09, 2017 at 10:59:16AM +0800, Jason Wang wrote: > > > On 2017?01?07? 03:55, Michael S. Tsirkin wrote: > > On Fri, Jan 06, 2017 at 10:13:15AM +0800, Jason Wang wrote: > > > This patch tries to do several tweaks on vhost_vq_avail_empty() for a > > > better performance: > > > > > > - check cached avail index first which could avoid userspace memory access. > > > - using unlikely() for the failure of userspace access > > > - check vq->last_avail_idx instead of cached avail index as t...
2017 Jan 06
2
[PATCH V4 net-next 1/3] vhost: better detection of available buffers
On Fri, Jan 06, 2017 at 10:13:15AM +0800, Jason Wang wrote: > This patch tries to do several tweaks on vhost_vq_avail_empty() for a > better performance: > > - check cached avail index first which could avoid userspace memory access. > - using unlikely() for the failure of userspace access > - check vq->last_avail_idx instead of cached avail index as the last > step. > > This patch is need...
2017 Jan 06
2
[PATCH V4 net-next 1/3] vhost: better detection of available buffers
On Fri, Jan 06, 2017 at 10:13:15AM +0800, Jason Wang wrote: > This patch tries to do several tweaks on vhost_vq_avail_empty() for a > better performance: > > - check cached avail index first which could avoid userspace memory access. > - using unlikely() for the failure of userspace access > - check vq->last_avail_idx instead of cached avail index as the last > step. > > This patch is need...
2018 Jul 24
3
[PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...struct vhost_virtqueue *tvq, >>>>> + bool rx) >>>>> +{ >>>>> + struct socket *sock = rvq->private_data; >>>>> + >>>>> + if (rx) { >>>>> + if (!vhost_vq_avail_empty(&net->dev, tvq)) { >>>>> + vhost_poll_queue(&tvq->poll); >>>>> + } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { >>>>> + vhost_disable_notify(&net->dev, tvq); &gt...
2018 Jul 24
3
[PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...struct vhost_virtqueue *tvq, >>>>> + bool rx) >>>>> +{ >>>>> + struct socket *sock = rvq->private_data; >>>>> + >>>>> + if (rx) { >>>>> + if (!vhost_vq_avail_empty(&net->dev, tvq)) { >>>>> + vhost_poll_queue(&tvq->poll); >>>>> + } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { >>>>> + vhost_disable_notify(&net->dev, tvq); &gt...
2018 Jul 23
3
[PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...at gmail.com> > --- ... > +static void vhost_net_busy_poll_vq_check(struct vhost_net *net, > + struct vhost_virtqueue *rvq, > + struct vhost_virtqueue *tvq, > + bool rx) > +{ > + struct socket *sock = rvq->private_data; > + > + if (rx) { > + if (!vhost_vq_avail_empty(&net->dev, tvq)) { > + vhost_poll_queue(&tvq->poll); > + } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { > + vhost_disable_notify(&net->dev, tvq); > + vhost_poll_queue(&tvq->poll); > + } > + } else if ((sock && sk_has_...
2018 Jul 23
3
[PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...at gmail.com> > --- ... > +static void vhost_net_busy_poll_vq_check(struct vhost_net *net, > + struct vhost_virtqueue *rvq, > + struct vhost_virtqueue *tvq, > + bool rx) > +{ > + struct socket *sock = rvq->private_data; > + > + if (rx) { > + if (!vhost_vq_avail_empty(&net->dev, tvq)) { > + vhost_poll_queue(&tvq->poll); > + } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { > + vhost_disable_notify(&net->dev, tvq); > + vhost_poll_queue(&tvq->poll); > + } > + } else if ((sock && sk_has_...
2017 Sep 01
2
[PATCH net] vhost_net: correctly check tx avail during rx busy polling
We check tx avail through vhost_enable_notify() in the past which is wrong since it only checks whether or not guest has filled more available buffer since last avail idx synchronization which was just done by vhost_vq_avail_empty() before. What we really want is checking pending buffers in the avail ring. Fix this by calling vhost_vq_avail_empty() instead. This issue could be noticed by doing netperf TCP_RR benchmark as client from guest (but not host). With this fix, TCP_RR from guest to localhost restores from 1375.91 tr...
2017 Sep 01
2
[PATCH net] vhost_net: correctly check tx avail during rx busy polling
We check tx avail through vhost_enable_notify() in the past which is wrong since it only checks whether or not guest has filled more available buffer since last avail idx synchronization which was just done by vhost_vq_avail_empty() before. What we really want is checking pending buffers in the avail ring. Fix this by calling vhost_vq_avail_empty() instead. This issue could be noticed by doing netperf TCP_RR benchmark as client from guest (but not host). With this fix, TCP_RR from guest to localhost restores from 1375.91 tr...
2018 Jul 03
11
[PATCH v2 net-next 0/4] vhost_net: Avoid vq kicks during busyloop
Under heavy load vhost tx busypoll tend not to suppress vq kicks, which causes poor guest tx performance. The detailed scenario is described in commitlog of patch 2. Rx seems not to have that serious problem, but for consistency I made a similar change on rx to avoid rx wakeups (patch 3). Additionary patch 4 is to avoid rx kicks under heavy load during busypoll. Tx performance is greatly improved
2018 Aug 01
2
[PATCH net-next v7 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...gt; + if (sock->ops->peek_len) > + return sock->ops->peek_len(sock); > + > + return skb_queue_empty(&sk->sk_receive_queue); > +} > + > +static void vhost_net_busy_poll_try_queue(struct vhost_net *net, > + struct vhost_virtqueue *vq) > +{ > + if (!vhost_vq_avail_empty(&net->dev, vq)) { > + vhost_poll_queue(&vq->poll); > + } else if (unlikely(vhost_enable_notify(&net->dev, vq))) { > + vhost_disable_notify(&net->dev, vq); > + vhost_poll_queue(&vq->poll); > + } > +} > + > +static void vhost_net_busy_poll...
2018 Aug 01
2
[PATCH net-next v7 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...gt; + if (sock->ops->peek_len) > + return sock->ops->peek_len(sock); > + > + return skb_queue_empty(&sk->sk_receive_queue); > +} > + > +static void vhost_net_busy_poll_try_queue(struct vhost_net *net, > + struct vhost_virtqueue *vq) > +{ > + if (!vhost_vq_avail_empty(&net->dev, vq)) { > + vhost_poll_queue(&vq->poll); > + } else if (unlikely(vhost_enable_notify(&net->dev, vq))) { > + vhost_disable_notify(&net->dev, vq); > + vhost_poll_queue(&vq->poll); > + } > +} > + > +static void vhost_net_busy_poll...
2018 Jul 21
0
[PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...k_len(sock); + + return skb_queue_empty(&sk->sk_receive_queue); +} + +static void vhost_net_busy_poll_vq_check(struct vhost_net *net, + struct vhost_virtqueue *rvq, + struct vhost_virtqueue *tvq, + bool rx) +{ + struct socket *sock = rvq->private_data; + + if (rx) { + if (!vhost_vq_avail_empty(&net->dev, tvq)) { + vhost_poll_queue(&tvq->poll); + } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) { + vhost_disable_notify(&net->dev, tvq); + vhost_poll_queue(&tvq->poll); + } + } else if ((sock && sk_has_rx_data(sock->sk)) &&am...
2017 Jan 10
0
[PATCH V4 net-next 1/3] vhost: better detection of available buffers
...?10? 07:10, Michael S. Tsirkin wrote: > On Mon, Jan 09, 2017 at 10:59:16AM +0800, Jason Wang wrote: >> >> On 2017?01?07? 03:55, Michael S. Tsirkin wrote: >>> On Fri, Jan 06, 2017 at 10:13:15AM +0800, Jason Wang wrote: >>>> This patch tries to do several tweaks on vhost_vq_avail_empty() for a >>>> better performance: >>>> >>>> - check cached avail index first which could avoid userspace memory access. >>>> - using unlikely() for the failure of userspace access >>>> - check vq->last_avail_idx instead of cached avail i...
2018 Jul 03
2
[PATCH net-next v4 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...out = rx ? rvq->busyloop_timeout : tvq->busyloop_timeout; > + > + preempt_disable(); > + endtime = busy_clock() + busyloop_timeout; > + while (vhost_can_busy_poll(tvq->dev, endtime) && > + !(sock && sk_has_rx_data(sock->sk)) && > + vhost_vq_avail_empty(tvq->dev, tvq)) > + cpu_relax(); > + preempt_enable(); > + > + if ((rx && !vhost_vq_avail_empty(&net->dev, vq)) || > + (!rx && (sock && sk_has_rx_data(sock->sk)))) { > + vhost_poll_queue(&vq->poll); > + } else if (unlikely(vhost...
2018 Jul 03
2
[PATCH net-next v4 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
...out = rx ? rvq->busyloop_timeout : tvq->busyloop_timeout; > + > + preempt_disable(); > + endtime = busy_clock() + busyloop_timeout; > + while (vhost_can_busy_poll(tvq->dev, endtime) && > + !(sock && sk_has_rx_data(sock->sk)) && > + vhost_vq_avail_empty(tvq->dev, tvq)) > + cpu_relax(); > + preempt_enable(); > + > + if ((rx && !vhost_vq_avail_empty(&net->dev, vq)) || > + (!rx && (sock && sk_has_rx_data(sock->sk)))) { > + vhost_poll_queue(&vq->poll); > + } else if (unlikely(vhost...
2018 Jun 29
5
[PATCH vhost] vhost_net: Fix too many vring kick on busypoll
...t_net *n, @@ -437,10 +438,21 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net, if (r == vq->num && vq->busyloop_timeout) { preempt_disable(); - endtime = busy_clock() + vq->busyloop_timeout; - while (vhost_can_busy_poll(vq->dev, endtime) && - vhost_vq_avail_empty(vq->dev, vq)) + if (vq->busyloop_endtime) { + endtime = vq->busyloop_endtime; + vq->busyloop_endtime = 0; + } else { + endtime = busy_clock() + vq->busyloop_timeout; + } + while (vhost_can_busy_poll(endtime)) { + if (vhost_busy_poll_interrupted(vq->dev)) { + vq->...
2018 Jun 29
5
[PATCH vhost] vhost_net: Fix too many vring kick on busypoll
...t_net *n, @@ -437,10 +438,21 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net, if (r == vq->num && vq->busyloop_timeout) { preempt_disable(); - endtime = busy_clock() + vq->busyloop_timeout; - while (vhost_can_busy_poll(vq->dev, endtime) && - vhost_vq_avail_empty(vq->dev, vq)) + if (vq->busyloop_endtime) { + endtime = vq->busyloop_endtime; + vq->busyloop_endtime = 0; + } else { + endtime = busy_clock() + vq->busyloop_timeout; + } + while (vhost_can_busy_poll(endtime)) { + if (vhost_busy_poll_interrupted(vq->dev)) { + vq->...
2018 Jul 02
2
[PATCH vhost] vhost_net: Fix too many vring kick on busypoll
...vhost_net *net, >> ? ????? if (r == vq->num && vq->busyloop_timeout) { >> ????????? preempt_disable(); >> -??????? endtime = busy_clock() + vq->busyloop_timeout; >> -??????? while (vhost_can_busy_poll(vq->dev, endtime) && >> -?????????????? vhost_vq_avail_empty(vq->dev, vq)) >> +??????? if (vq->busyloop_endtime) { >> +??????????? endtime = vq->busyloop_endtime; >> +??????????? vq->busyloop_endtime = 0; > > Looks like endtime may be before current time. So we skip busy loop in > this case. Sure, I'll add a condi...