search for: vhost_net_pkt_weight

Displaying 20 results from an estimated 28 matches for "vhost_net_pkt_weight".

2018 Apr 24
2
[PATCH] vhost_net: use packet weight for rx handler, too
...t/net.c +++ b/drivers/vhost/net.c @@ -46,8 +46,10 @@ MODULE_PARM_DESC(experimental_zcopytx, "Enable Zero Copy TX;" #define VHOST_NET_WEIGHT 0x80000 /* Max number of packets transferred before requeueing the job. - * Using this limit prevents one virtqueue from starving rx. */ -#define VHOST_NET_PKT_WEIGHT(vq) ((vq)->num * 2) + * Using this limit prevents one virtqueue from starving others with small + * pkts. + */ +#define VHOST_NET_PKT_WEIGHT 256 /* MAX number of TX used buffers for outstanding zerocopy */ #define VHOST_MAX_PEND 128 @@ -587,7 +589,7 @@ static void handle_tx(struct vhost_net...
2018 May 21
1
[RFC PATCH net-next 02/12] vhost_net: introduce vhost_exceeds_weight()
...@@ -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 here (both of them) > +} > + > /* Expects to be always run from workqueue - which acts as > * read-size critica...
2018 May 21
0
[RFC PATCH net-next 02/12] vhost_net: introduce vhost_exceeds_weight()
...st/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 @@ static void handle_tx(struct vhost_net *net) msg.msg_control = NULL; ubufs = NULL; } - total_len...
2018 Apr 03
0
[PATCH] vhost-net: add limitation of sent packets for tx polling
....631 > 1024 2.002 4.173 9.056 > 2048 2.257 5.650 9.688 > 4096 2.093 8.508 15.943 > > 512 is selected, which is multi-VRING_SIZE There's no guarantee vring size is 256. Could you pls try with a different tx ring size? I suspect we want: #define VHOST_NET_PKT_WEIGHT(vq) ((vq)->num * 2) > and close to VHOST_NET_WEIGHT/MTU. Puzzled by this part. Does tweaking MTU change anything? > To evaluate this change, another tests were done using netperf(RR, TX) between > two machines with Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz. Result as follow > doe...
2018 Apr 03
0
[PATCH] vhost-net: add limitation of sent packets for tx polling
...96 2.093 8.508 15.943 > >> > >> 512 is selected, which is multi-VRING_SIZE > > > >There's no guarantee vring size is 256. > > > >Could you pls try with a different tx ring size? > > > >I suspect we want: > > > >#define VHOST_NET_PKT_WEIGHT(vq) ((vq)->num * 2) > > > > > >> and close to VHOST_NET_WEIGHT/MTU. > > > >Puzzled by this part. Does tweaking MTU change anything? > > The MTU of ethernet is 1500, so VHOST_NET_WEIGHT/MTU equals 0x80000/1500=350. We should include the 12 byte header so...
2018 May 21
1
[RFC PATCH net-next 03/12] vhost_net: introduce vhost_has_more_pkts()
...+), 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)); This really seems like mis-use of likely/unlikely, in...
2018 Apr 09
0
[PATCH] vhost-net: set packet weight of tx polling to 2 * vq size
...nable Zero Copy TX;" > * Using this limit prevents one virtqueue from starving others. */ > #define VHOST_NET_WEIGHT 0x80000 > > +/* Max number of packets transferred before requeueing the job. > + * Using this limit prevents one virtqueue from starving rx. */ > +#define VHOST_NET_PKT_WEIGHT(vq) ((vq)->num * 2) > + > /* MAX number of TX used buffers for outstanding zerocopy */ > #define VHOST_MAX_PEND 128 > #define VHOST_GOODCOPY_LEN 256 > @@ -473,6 +477,7 @@ static void handle_tx(struct vhost_net *net) > struct socket *sock; > struct vhost_net_ubuf_ref *...
2018 Apr 09
0
[PATCH] vhost-net: set packet weight of tx polling to 2 * vq size
...t prevents one virtqueue from starving others. */ > > > #define VHOST_NET_WEIGHT 0x80000 > > > > > > +/* Max number of packets transferred before requeueing the job. > > > + * Using this limit prevents one virtqueue from starving rx. */ > > > +#define VHOST_NET_PKT_WEIGHT(vq) ((vq)->num * 2) > > > + > > > /* MAX number of TX used buffers for outstanding zerocopy */ > > > #define VHOST_MAX_PEND 128 > > > #define VHOST_GOODCOPY_LEN 256 > > > @@ -473,6 +477,7 @@ static void handle_tx(struct vhost_net *net) > > &g...
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
2020 May 29
0
[PATCH 1/6] vhost: allow device that does not depend on vhost worker
...c b/drivers/vhost/net.c index 2927f02cc7e1..bf5e1d81ae25 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1326,7 +1326,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) } vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, UIO_MAXIOV + VHOST_NET_BATCH, - VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, + VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, true, NULL); vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index c39952243fd3..0cbaa0b3893d 100644 --- a/drivers/vhost/scsi.c ++...
2019 May 17
0
[PATCH V2 1/4] vhost: introduce vhost_exceeds_weight()
...host/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 socket *sock) vq->heads[nvq->done_idx].id = cpu_to_vhost32(vq, head); vq->heads[...
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
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
0
[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)); +} + /* Expects to be always run from workqueue - which acts as * read-size critical se...
2020 Jul 20
0
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...uct vhost_net *n; @@ -1333,7 +1337,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) vhost_net_buf_init(&n->vqs[i].rxq); } vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, - UIO_MAXIOV + VHOST_NET_BATCH, + UIO_MAXIOV + VHOST_NET_BATCH + batch_num, VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, true, NULL); then you can try tweaking batching and playing with mod parameter without recompiling. VHOST_NET_BATCH affects lots of other things. > and testing > the pps as previous mail says. This means that we have either only > vhost_net batching (in...
2020 Jul 20
0
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...vhost_net_buf_init(&n->vqs[i].rxq); > > } > > vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, > > - UIO_MAXIOV + VHOST_NET_BATCH, > > + UIO_MAXIOV + VHOST_NET_BATCH + batch_num, > > VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, true, > > NULL); > > > > > > then you can try tweaking batching and playing with mod parameter without > > recompiling. > > > > > > VHOST_NET_BATCH affects lots of other things. > > > > Ok, g...
2020 Jul 21
0
[PATCH RFC v8 02/11] vhost: use batched get_vq_desc version
...vhost_net_buf_init(&n->vqs[i].rxq); >> } >> vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, >> - UIO_MAXIOV + VHOST_NET_BATCH, >> + UIO_MAXIOV + VHOST_NET_BATCH + batch_num, >> VHOST_NET_PKT_WEIGHT, VHOST_NET_WEIGHT, true, >> NULL); >> >> >> then you can try tweaking batching and playing with mod parameter without >> recompiling. >> >> >> VHOST_NET_BATCH affects lots of other things. >> > Ok, got it. Since they w...