search for: vhost_net_rx_peek_head_len

Displaying 20 results from an estimated 131 matches for "vhost_net_rx_peek_head_len".

2018 Jul 03
11
[PATCH v2 net-next 0/4] vhost_net: Avoid vq kicks during busyloop
....26 TCP_STREAM 8801.03 45794 9592.77 2884 v2: - Split patches into 3 parts (renaming variables, tx-kick fix, rx-wakeup fix). - Avoid rx-kicks too (patch 4). - Don't memorize endtime as it is not needed for now. Toshiaki Makita (4): vhost_net: Rename local variables in vhost_net_rx_peek_head_len vhost_net: Avoid tx vring kicks during busyloop vhost_net: Avoid rx queue wake-ups during busypoll vhost_net: Avoid rx vring kicks during busyloop drivers/vhost/net.c | 95 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 35 deletions(-) -- 1.8.3.1
2018 Jul 03
0
[PATCH v2 net-next 1/4] vhost_net: Rename local variables in vhost_net_rx_peek_head_len
...-------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 29756d8..3939c50 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -647,39 +647,39 @@ static void vhost_rx_signal_used(struct vhost_net_virtqueue *nvq) static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) { - struct vhost_net_virtqueue *rvq = &net->vqs[VHOST_NET_VQ_RX]; - struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; - struct vhost_virtqueue *vq = &nvq->vq; + struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ...
2018 Jul 03
2
[PATCH v2 net-next 4/4] vhost_net: Avoid rx vring kicks during busyloop
...--- > drivers/vhost/net.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 791bc8b..b224036 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -658,6 +658,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk, > { > struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; > struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; > + struct vhost_virtqueue *rvq = &rnvq->vq; > struct vhost_virtqueue *tvq = &...
2018 Jul 03
2
[PATCH v2 net-next 4/4] vhost_net: Avoid rx vring kicks during busyloop
...--- > drivers/vhost/net.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 791bc8b..b224036 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -658,6 +658,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk, > { > struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; > struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; > + struct vhost_virtqueue *rvq = &rnvq->vq; > struct vhost_virtqueue *tvq = &...
2018 Jul 03
0
[PATCH v2 net-next 3/4] vhost_net: Avoid rx queue wake-ups during busypoll
..., 19 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 811c0e5..791bc8b 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -653,7 +653,8 @@ static void vhost_rx_signal_used(struct vhost_net_virtqueue *nvq) nvq->done_idx = 0; } -static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) +static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk, + bool *busyloop_intr) { struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; @...
2018 Mar 26
2
[PATCH net] vhost_net: add missing lock nesting notation
We try to hold TX virtqueue mutex in vhost_net_rx_peek_head_len() after RX virtqueue mutex is held in handle_rx(). This requires an appropriate lock nesting notation to calm down deadlock detector. Fixes: 0308813724606 ("vhost_net: basic polling support") Reported-by: syzbot+7f073540b1384a614e09 at syzkaller.appspotmail.com Signed-off-by: Jason Wang...
2018 May 29
2
[PATCH net] vhost_net: flush batched heads before trying to busy polling
...oid vhost_rx_signal_used(struct vhost_net_virtqueue *nvq) +{ + struct vhost_virtqueue *vq = &nvq->vq; + struct vhost_dev *dev = vq->dev; + + if (!nvq->done_idx) + return; + + vhost_add_used_and_signal_n(dev, vq, vq->heads, nvq->done_idx); + nvq->done_idx = 0; +} + static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) { struct vhost_net_virtqueue *rvq = &net->vqs[VHOST_NET_VQ_RX]; @@ -635,6 +649,8 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) int len = peek_head_len(rvq, sk); if (!len && vq->busyloop_timeout) {...
2019 Apr 25
2
[PATCH net] vhost_net: fix possible infinite loop
When the rx buffer is too small for a packet, we will discard the vq descriptor and retry it for the next packet: while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, &busyloop_intr))) { ... /* On overrun, truncate and discard */ if (unlikely(headcount > UIO_MAXIOV)) { iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); err = sock->ops->recvmsg(sock, &msg, 1, MSG_DONTWAIT | MSG_TRUNC); pr_debug(&q...
2019 Apr 25
2
[PATCH net] vhost_net: fix possible infinite loop
When the rx buffer is too small for a packet, we will discard the vq descriptor and retry it for the next packet: while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, &busyloop_intr))) { ... /* On overrun, truncate and discard */ if (unlikely(headcount > UIO_MAXIOV)) { iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); err = sock->ops->recvmsg(sock, &msg, 1, MSG_DONTWAIT | MSG_TRUNC); pr_debug(&q...
2018 Jul 03
0
[PATCH v2 net-next 4/4] vhost_net: Avoid rx vring kicks during busyloop
...<makita.toshiaki at lab.ntt.co.jp> --- drivers/vhost/net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 791bc8b..b224036 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -658,6 +658,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk, { struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; + struct vhost_virtqueue *rvq = &rnvq->vq; struct vhost_virtqueue *tvq = &tnvq->vq; unsigned l...
2018 Jul 04
0
[PATCH v2 net-next 4/4] vhost_net: Avoid rx vring kicks during busyloop
....c | 10 +++++++--- >> ? 1 file changed, 7 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c >> index 791bc8b..b224036 100644 >> --- a/drivers/vhost/net.c >> +++ b/drivers/vhost/net.c >> @@ -658,6 +658,7 @@ static int vhost_net_rx_peek_head_len(struct >> vhost_net *net, struct sock *sk, >> ? { >> ????? struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; >> ????? struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; >> +??? struct vhost_virtqueue *rvq = &rnvq->vq; >&...
2017 Mar 30
1
[PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling
...see which patch adds __skb_array_empty. > > This is not something new, it was introduced by ad69f35d1dc0a ("skb_array: > array based FIFO for skbs"). > > Thanks Same comment about a compiler barrier applies then. > > > > > @@ -579,7 +582,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, > > > endtime = busy_clock() + vq->busyloop_timeout; > > > while (vhost_can_busy_poll(&net->dev, endtime) && > > > - !sk_has_rx_data(sk) && > > > + !sk_has_rx_data(rvq, sk) && > &...
2017 Mar 30
1
[PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling
...see which patch adds __skb_array_empty. > > This is not something new, it was introduced by ad69f35d1dc0a ("skb_array: > array based FIFO for skbs"). > > Thanks Same comment about a compiler barrier applies then. > > > > > @@ -579,7 +582,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, > > > endtime = busy_clock() + vq->busyloop_timeout; > > > while (vhost_can_busy_poll(&net->dev, endtime) && > > > - !sk_has_rx_data(sk) && > > > + !sk_has_rx_data(rvq, sk) && > &...
2017 Mar 29
2
[PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling
...= sk->sk_socket; > > + if (rvq->rx_array) > + return !__skb_array_empty(rvq->rx_array); > + > if (sock->ops->peek_len) > return sock->ops->peek_len(sock); > I don't see which patch adds __skb_array_empty. > @@ -579,7 +582,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, > endtime = busy_clock() + vq->busyloop_timeout; > > while (vhost_can_busy_poll(&net->dev, endtime) && > - !sk_has_rx_data(sk) && > + !sk_has_rx_data(rvq, sk) && > vhost_vq_avail_empty(&...
2017 Mar 29
2
[PATCH net-next 8/8] vhost_net: use lockless peeking for skb array during busy polling
...= sk->sk_socket; > > + if (rvq->rx_array) > + return !__skb_array_empty(rvq->rx_array); > + > if (sock->ops->peek_len) > return sock->ops->peek_len(sock); > I don't see which patch adds __skb_array_empty. > @@ -579,7 +582,7 @@ static int vhost_net_rx_peek_head_len(struct vhost_net *net, > endtime = busy_clock() + vq->busyloop_timeout; > > while (vhost_can_busy_poll(&net->dev, endtime) && > - !sk_has_rx_data(sk) && > + !sk_has_rx_data(rvq, sk) && > vhost_vq_avail_empty(&...
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
On 2019/4/26 ??1:52, Michael S. Tsirkin wrote: > On Thu, Apr 25, 2019 at 03:33:19AM -0400, Jason Wang wrote: >> When the rx buffer is too small for a packet, we will discard the vq >> descriptor and retry it for the next packet: >> >> while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, >> &busyloop_intr))) { >> ... >> /* On overrun, truncate and discard */ >> if (unlikely(headcount > UIO_MAXIOV)) { >> iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); >> err = sock->ops->recvmsg(sock, &...
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
On 2019/4/26 ??1:52, Michael S. Tsirkin wrote: > On Thu, Apr 25, 2019 at 03:33:19AM -0400, Jason Wang wrote: >> When the rx buffer is too small for a packet, we will discard the vq >> descriptor and retry it for the next packet: >> >> while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, >> &busyloop_intr))) { >> ... >> /* On overrun, truncate and discard */ >> if (unlikely(headcount > UIO_MAXIOV)) { >> iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1); >> err = sock->ops->recvmsg(sock, &...
2017 Mar 21
0
[PATCH net-next 7/8] vhost_net: try batch dequing from skb array
...igned long flags; + if (rvq->rx_array) + return peek_head_len_batched(rvq); + if (sock->ops->peek_len) return sock->ops->peek_len(sock); @@ -535,12 +561,14 @@ static int sk_has_rx_data(struct sock *sk) return skb_queue_empty(&sk->sk_receive_queue); } -static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk) +static int vhost_net_rx_peek_head_len(struct vhost_net *net, + struct sock *sk) { + struct vhost_net_virtqueue *rvq = &net->vqs[VHOST_NET_VQ_RX]; struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; struct vhost_virtqueue...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...kin wrote: > > > On Thu, Apr 25, 2019 at 03:33:19AM -0400, Jason Wang wrote: > > > > When the rx buffer is too small for a packet, we will discard the vq > > > > descriptor and retry it for the next packet: > > > > > > > > while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, > > > > ????????????????????????? &busyloop_intr))) { > > > > ... > > > > ????/* On overrun, truncate and discard */ > > > > ????if (unlikely(headcount > UIO_MAXIOV)) { > > > > ??????? iov_iter_init(&msg.msg_it...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...kin wrote: > > > On Thu, Apr 25, 2019 at 03:33:19AM -0400, Jason Wang wrote: > > > > When the rx buffer is too small for a packet, we will discard the vq > > > > descriptor and retry it for the next packet: > > > > > > > > while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk, > > > > ????????????????????????? &busyloop_intr))) { > > > > ... > > > > ????/* On overrun, truncate and discard */ > > > > ????if (unlikely(headcount > UIO_MAXIOV)) { > > > > ??????? iov_iter_init(&msg.msg_it...