search for: total_len

Displaying 20 results from an estimated 305 matches for "total_len".

2018 May 21
1
[RFC PATCH net-next 02/12] vhost_net: introduce vhost_exceeds_weight()
...host/net.c > index 15d191a..de544ee 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -479,6 +479,12 @@ static size_t init_iov_iter(struct vhost_virtqueue *vq, struct iov_iter *iter, > return len; > } > > +static bool vhost_exceeds_weight(int pkts, int total_len) > +{ > + return unlikely(total_len >= VHOST_NET_WEIGHT) || > + unlikely(pkts >= VHOST_NET_PKT_WEIGHT); I was going to say just one unlikely, but then the caller of this function also says unlikely(vhost_exceeds...), so I think you should just drop the unlikely statements her...
2019 Apr 25
2
[PATCH net] vhost_net: fix possible infinite loop
...q->done_idx == VHOST_NET_BATCH) @@ -845,11 +846,10 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); vq->heads[nvq->done_idx].len = 0; ++nvq->done_idx; - if (vhost_exceeds_weight(++sent_pkts, total_len)) { - vhost_poll_queue(&vq->poll); - break; - } - } + } while (!(next_round = vhost_exceeds_weight(++sent_pkts, total_len))); + + if (next_round) + vhost_poll_queue(&vq->poll); vhost_tx_batch(net, nvq, sock, &msg); } @@ -873,8 +873,9 @@ static void handle_tx_zerocopy(st...
2019 Apr 25
2
[PATCH net] vhost_net: fix possible infinite loop
...q->done_idx == VHOST_NET_BATCH) @@ -845,11 +846,10 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); vq->heads[nvq->done_idx].len = 0; ++nvq->done_idx; - if (vhost_exceeds_weight(++sent_pkts, total_len)) { - vhost_poll_queue(&vq->poll); - break; - } - } + } while (!(next_round = vhost_exceeds_weight(++sent_pkts, total_len))); + + if (next_round) + vhost_poll_queue(&vq->poll); vhost_tx_batch(net, nvq, sock, &msg); } @@ -873,8 +873,9 @@ static void handle_tx_zerocopy(st...
2019 May 16
6
[PATCH net 0/4] Prevent vhost kthread from hogging CPU
Hi: This series try to prvernt a guest triggerable CPU hogging through vhost kthread. This is done by introducing and checking the weight after each requrest. The patch has been tested with reproducer of vsock and virtio-net. Only compile test is done for vhost-scsi. Please review. This addresses CVE-2019-3900. Jason Wang (4): vhost: introduce vhost_exceeds_weight() vhost_net: fix possible
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
...845,11 +846,10 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) >> vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); >> vq->heads[nvq->done_idx].len = 0; >> ++nvq->done_idx; >> - if (vhost_exceeds_weight(++sent_pkts, total_len)) { >> - vhost_poll_queue(&vq->poll); >> - break; >> - } >> - } >> + } while (!(next_round = vhost_exceeds_weight(++sent_pkts, total_len))); >> + >> + if (next_round) >> + vhost_poll_queue(&vq->poll); >> >> vhost_...
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
...845,11 +846,10 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) >> vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); >> vq->heads[nvq->done_idx].len = 0; >> ++nvq->done_idx; >> - if (vhost_exceeds_weight(++sent_pkts, total_len)) { >> - vhost_poll_queue(&vq->poll); >> - break; >> - } >> - } >> + } while (!(next_round = vhost_exceeds_weight(++sent_pkts, total_len))); >> + >> + if (next_round) >> + vhost_poll_queue(&vq->poll); >> >> vhost_...
2018 May 21
0
[RFC PATCH net-next 02/12] vhost_net: introduce vhost_exceeds_weight()
...--git a/drivers/vhost/net.c b/drivers/vhost/net.c index 15d191a..de544ee 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -479,6 +479,12 @@ static size_t init_iov_iter(struct vhost_virtqueue *vq, struct iov_iter *iter, return len; } +static bool vhost_exceeds_weight(int pkts, int total_len) +{ + return unlikely(total_len >= VHOST_NET_WEIGHT) || + unlikely(pkts >= VHOST_NET_PKT_WEIGHT); +} + /* Expects to be always run from workqueue - which acts as * read-size critical section for our kind of RCU. */ static void handle_tx(struct vhost_net *net) @@ -570,7 +576,6 @@ st...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...struct socket *sock) > > > > ????????? vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); > > > > ????????? vq->heads[nvq->done_idx].len = 0; > > > > ????????? ++nvq->done_idx; > > > > -??????? if (vhost_exceeds_weight(++sent_pkts, total_len)) { > > > > -??????????? vhost_poll_queue(&vq->poll); > > > > -??????????? break; > > > > -??????? } > > > > -??? } > > > > +??? } while (!(next_round = vhost_exceeds_weight(++sent_pkts, > > > > total_len))); > > &...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...struct socket *sock) > > > > ????????? vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); > > > > ????????? vq->heads[nvq->done_idx].len = 0; > > > > ????????? ++nvq->done_idx; > > > > -??????? if (vhost_exceeds_weight(++sent_pkts, total_len)) { > > > > -??????????? vhost_poll_queue(&vq->poll); > > > > -??????????? break; > > > > -??????? } > > > > -??? } > > > > +??? } while (!(next_round = vhost_exceeds_weight(++sent_pkts, > > > > total_len))); > > &...
2019 May 17
0
[PATCH V2 1/4] vhost: introduce vhost_exceeds_weight()
...vhost/net.c b/drivers/vhost/net.c index df51a35..061a06d 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -604,12 +604,6 @@ static size_t init_iov_iter(struct vhost_virtqueue *vq, struct iov_iter *iter, return iov_iter_count(iter); } -static bool vhost_exceeds_weight(int pkts, int total_len) -{ - return total_len >= VHOST_NET_WEIGHT || - pkts >= VHOST_NET_PKT_WEIGHT; -} - static int get_tx_bufs(struct vhost_net *net, struct vhost_net_virtqueue *nvq, struct msghdr *msg, @@ -845,10 +839,8 @@ static void handle_tx_copy(struct vhost_net *net, struct socke...
2018 May 21
20
[RFC PATCH net-next 00/12] XDP batching for TUN/vhost_net
Hi all: We do not support XDP batching for TUN since it can only receive one packet a time from vhost_net. This series tries to remove this limitation by: - introduce a TUN specific msg_control that can hold a pointer to an array of XDP buffs - try copy and build XDP buff in vhost_net - store XDP buffs in an array and submit them once for every N packets from vhost_net - since TUN can only
2018 May 21
1
[RFC PATCH net-next 03/12] vhost_net: introduce vhost_has_more_pkts()
...++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index de544ee..4ebac76 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -485,6 +485,13 @@ static bool vhost_exceeds_weight(int pkts, int total_len) > unlikely(pkts >= VHOST_NET_PKT_WEIGHT); > } > > +static bool vhost_has_more_pkts(struct vhost_net *net, > + struct vhost_virtqueue *vq) > +{ > + return !vhost_vq_avail_empty(&net->dev, vq) && > + likely(!vhost_exceeds_maxpend(net));...
2019 May 17
9
[PATCH V2 0/4] Prevent vhost kthread from hogging CPU
Hi: This series try to prevent a guest triggerable CPU hogging through vhost kthread. This is done by introducing and checking the weight after each requrest. The patch has been tested with reproducer of vsock and virtio-net. Only compile test is done for vhost-scsi. Please review. This addresses CVE-2019-3900. Changs from V1: - fix user-ater-free in vosck patch Jason Wang (4): vhost:
2019 May 17
9
[PATCH V2 0/4] Prevent vhost kthread from hogging CPU
Hi: This series try to prevent a guest triggerable CPU hogging through vhost kthread. This is done by introducing and checking the weight after each requrest. The patch has been tested with reproducer of vsock and virtio-net. Only compile test is done for vhost-scsi. Please review. This addresses CVE-2019-3900. Changs from V1: - fix user-ater-free in vosck patch Jason Wang (4): vhost:
2018 Jul 20
12
[PATCH net-next 0/9] TX used ring batched updating for vhost
Hi: This series implement batch updating of used ring for TX. This help to reduce the cache contention on used ring. The idea is first split datacopy path from zerocopy, and do only batching for datacopy. This is because zercopy had already supported its own batching. TX PPS was increased 25.8% and Netperf TCP does not show obvious differences. The split of datapath will also be helpful for
2018 Jul 20
12
[PATCH net-next 0/9] TX used ring batched updating for vhost
Hi: This series implement batch updating of used ring for TX. This help to reduce the cache contention on used ring. The idea is first split datacopy path from zerocopy, and do only batching for datacopy. This is because zercopy had already supported its own batching. TX PPS was increased 25.8% and Netperf TCP does not show obvious differences. The split of datapath will also be helpful for
2019 Apr 25
0
[PATCH net] vhost_net: fix possible infinite loop
...ET_BATCH) > @@ -845,11 +846,10 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock) > vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); > vq->heads[nvq->done_idx].len = 0; > ++nvq->done_idx; > - if (vhost_exceeds_weight(++sent_pkts, total_len)) { > - vhost_poll_queue(&vq->poll); > - break; > - } > - } > + } while (!(next_round = vhost_exceeds_weight(++sent_pkts, total_len))); > + > + if (next_round) > + vhost_poll_queue(&vq->poll); > > vhost_tx_batch(net, nvq, sock, &msg); >...
2019 May 05
0
[PATCH net] vhost_net: fix possible infinite loop
...ost_net >>> *net, struct socket *sock) >>> ????????? vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); >>> ????????? vq->heads[nvq->done_idx].len = 0; >>> ????????? ++nvq->done_idx; >>> -??????? if (vhost_exceeds_weight(++sent_pkts, total_len)) { >>> -??????????? vhost_poll_queue(&vq->poll); >>> -??????????? break; >>> -??????? } >>> -??? } >>> +??? } while (!(next_round = vhost_exceeds_weight(++sent_pkts, >>> total_len))); >>> + >>> +??? if (next_round) &gt...
2017 Dec 01
1
[PATCH 2/3] tun: free skb in early errors
.../tun.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6a7bde9..5563430 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2067,14 +2067,17 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, { struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_struct *tun = tun_get(tfile); + struct sk_buff *skb = m->msg_control; int ret; - if (!tun) - return -EBADFD; + if (!tun) { + ret = -EBADFD; + goto out_free_skb; + } if (flags & ~(MSG_DONTWAIT|...
2020 Jun 08
2
[PATCH RFC v5 12/13] vhost/vsock: switch to the buf API
...rue; > > pkt->off += payload_len; > @@ -440,7 +443,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) > struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, > dev); > struct virtio_vsock_pkt *pkt; > - int head, pkts = 0, total_len = 0; > + int ret, pkts = 0, total_len = 0; > + struct vhost_buf buf; > unsigned int out, in; > bool added = false; > > @@ -461,12 +465,13 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) > goto no_more_replies; > } > > - head = vhost_g...