Displaying 20 results from an estimated 11587 matches for "unlikely".
2018 May 21
1
[RFC PATCH net-next 02/12] vhost_net: introduce vhost_exceeds_weight()
...544ee 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 here (both of them)
> +}
> +...
2020 Jun 03
1
[PATCH RFC 01/13] vhost: option to fetch descriptors through an independent struct
...> + u16 head)
>>> +{
>>> + struct vring_desc desc;
>>> + unsigned int i = 0, count, found = 0;
>>> + u32 len = indirect->len;
>>> + struct iov_iter from;
>>> + int ret;
>>> +
>>> + /* Sanity check */
>>> + if (unlikely(len % sizeof desc)) {
>>> + vq_err(vq, "Invalid length in indirect descriptor: "
>>> + "len 0x%llx not multiple of 0x%zx\n",
>>> + (unsigned long long)len,
>>> + sizeof desc);
>>> + return -EINVAL;
>>&g...
2020 Jun 03
2
[PATCH RFC 01/13] vhost: option to fetch descriptors through an independent struct
...);
> + --vq->ndescs;
> +}
> +
> +#define VHOST_DESC_FLAGS (VRING_DESC_F_INDIRECT | VRING_DESC_F_WRITE | \
> + VRING_DESC_F_NEXT)
> +static int push_split_desc(struct vhost_virtqueue *vq, struct vring_desc *desc, u16 id)
> +{
> + struct vhost_desc *h;
> +
> + if (unlikely(vq->ndescs >= vq->max_descs))
> + return -EINVAL;
> + h = &vq->descs[vq->ndescs++];
> + h->addr = vhost64_to_cpu(vq, desc->addr);
> + h->len = vhost32_to_cpu(vq, desc->len);
> + h->flags = vhost16_to_cpu(vq, desc->flags) & VHOST_DESC_FLAGS;
&...
2020 Jun 03
2
[PATCH RFC 01/13] vhost: option to fetch descriptors through an independent struct
...);
> + --vq->ndescs;
> +}
> +
> +#define VHOST_DESC_FLAGS (VRING_DESC_F_INDIRECT | VRING_DESC_F_WRITE | \
> + VRING_DESC_F_NEXT)
> +static int push_split_desc(struct vhost_virtqueue *vq, struct vring_desc *desc, u16 id)
> +{
> + struct vhost_desc *h;
> +
> + if (unlikely(vq->ndescs >= vq->max_descs))
> + return -EINVAL;
> + h = &vq->descs[vq->ndescs++];
> + h->addr = vhost64_to_cpu(vq, desc->addr);
> + h->len = vhost32_to_cpu(vq, desc->len);
> + h->flags = vhost16_to_cpu(vq, desc->flags) & VHOST_DESC_FLAGS;
&...
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
...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("Discarded rx packet: len %zd\n", sock_len);
>> continue;
&...
2019 Apr 26
2
[PATCH net] vhost_net: fix possible infinite loop
...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("Discarded rx packet: len %zd\n", sock_len);
>> continue;
&...
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("Discarded rx packet: len %zd\n", sock_len);
continue;
}
...
}
This makes it possible to trigger a...
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("Discarded rx packet: len %zd\n", sock_len);
continue;
}
...
}
This makes it possible to trigger a...
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
For GCC only, define unlikely() macro. Use it on error paths to move
code out of the hot path.
In the server only, use the debug() macro (don't call nbdkit_debug
directly). This macro checks the verbose flag and moves the call to
nbdkit_debug out of the hot path.
---
server/connections.c | 11 ++++++-----
server/interna...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...t 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(...
2019 May 12
2
[PATCH net] vhost_net: fix possible infinite loop
...t 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(...
2014 Nov 24
2
[PATCH v3 26/41] vhost: virtio 1.0 endian-ness support
..._GPL(vhost_log_write);
static int vhost_update_used_flags(struct vhost_virtqueue *vq)
{
void __user *used;
- if (__put_user(vq->used_flags, &vq->used->flags) < 0)
+ if (__put_user(cpu_to_vhost16(vq, vq->used_flags), &vq->used->flags) < 0)
return -EFAULT;
if (unlikely(vq->log_used)) {
/* Make sure the flag is seen before log. */
@@ -1019,7 +1019,7 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
{
- if (__put_user(vq->avail_idx, vhost_avail_event(vq)))...
2014 Nov 24
2
[PATCH v3 26/41] vhost: virtio 1.0 endian-ness support
..._GPL(vhost_log_write);
static int vhost_update_used_flags(struct vhost_virtqueue *vq)
{
void __user *used;
- if (__put_user(vq->used_flags, &vq->used->flags) < 0)
+ if (__put_user(cpu_to_vhost16(vq, vq->used_flags), &vq->used->flags) < 0)
return -EFAULT;
if (unlikely(vq->log_used)) {
/* Make sure the flag is seen before log. */
@@ -1019,7 +1019,7 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
{
- if (__put_user(vq->avail_idx, vhost_avail_event(vq)))...
2020 Jun 10
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
...g, unsigned int *log_num,
> - struct vring_desc *indirect)
> -{
> - struct vring_desc desc;
> - unsigned int i = 0, count, found = 0;
> - u32 len = vhost32_to_cpu(vq, indirect->len);
> - struct iov_iter from;
> - int ret, access;
> -
> - /* Sanity check */
> - if (unlikely(len % sizeof desc)) {
> - vq_err(vq, "Invalid length in indirect descriptor: "
> - "len 0x%llx not multiple of 0x%zx\n",
> - (unsigned long long)len,
> - sizeof desc);
> - return -EINVAL;
> - }
> -
> - ret = translate_desc(vq, vh...
2020 Jun 10
2
[PATCH RFC v6 02/11] vhost: use batched get_vq_desc version
...g, unsigned int *log_num,
> - struct vring_desc *indirect)
> -{
> - struct vring_desc desc;
> - unsigned int i = 0, count, found = 0;
> - u32 len = vhost32_to_cpu(vq, indirect->len);
> - struct iov_iter from;
> - int ret, access;
> -
> - /* Sanity check */
> - if (unlikely(len % sizeof desc)) {
> - vq_err(vq, "Invalid length in indirect descriptor: "
> - "len 0x%llx not multiple of 0x%zx\n",
> - (unsigned long long)len,
> - sizeof desc);
> - return -EINVAL;
> - }
> -
> - ret = translate_desc(vq, vh...
2019 Apr 25
0
[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("Discarded rx packet: len %zd\n", sock_len);
> continue;
> }
> ...
>...
2014 Nov 30
3
[PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
..._GPL(vhost_log_write);
static int vhost_update_used_flags(struct vhost_virtqueue *vq)
{
void __user *used;
- if (__put_user(vq->used_flags, &vq->used->flags) < 0)
+ if (__put_user(cpu_to_vhost16(vq, vq->used_flags), &vq->used->flags) < 0)
return -EFAULT;
if (unlikely(vq->log_used)) {
/* Make sure the flag is seen before log. */
@@ -1019,7 +1019,7 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
{
- if (__put_user(vq->avail_idx, vhost_avail_event(vq)))...
2014 Nov 30
3
[PATCH v7 31/46] vhost: virtio 1.0 endian-ness support
..._GPL(vhost_log_write);
static int vhost_update_used_flags(struct vhost_virtqueue *vq)
{
void __user *used;
- if (__put_user(vq->used_flags, &vq->used->flags) < 0)
+ if (__put_user(cpu_to_vhost16(vq, vq->used_flags), &vq->used->flags) < 0)
return -EFAULT;
if (unlikely(vq->log_used)) {
/* Make sure the flag is seen before log. */
@@ -1019,7 +1019,7 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq)
static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
{
- if (__put_user(vq->avail_idx, vhost_avail_event(vq)))...
2020 Apr 07
0
[PATCH v7 18/19] vhost: use batched version by default
...um, unsigned int *in_num,
- struct vhost_log *log, unsigned int *log_num,
- struct vring_desc *indirect)
-{
- struct vring_desc desc;
- unsigned int i = 0, count, found = 0;
- u32 len = vhost32_to_cpu(vq, indirect->len);
- struct iov_iter from;
- int ret, access;
-
- /* Sanity check */
- if (unlikely(len % sizeof desc)) {
- vq_err(vq, "Invalid length in indirect descriptor: "
- "len 0x%llx not multiple of 0x%zx\n",
- (unsigned long long)len,
- sizeof desc);
- return -EINVAL;
- }
-
- ret = translate_desc(vq, vhost64_to_cpu(vq, indirect->addr), len...
2020 Apr 07
0
[PATCH v8 18/19] vhost: use batched version by default
...um, unsigned int *in_num,
- struct vhost_log *log, unsigned int *log_num,
- struct vring_desc *indirect)
-{
- struct vring_desc desc;
- unsigned int i = 0, count, found = 0;
- u32 len = vhost32_to_cpu(vq, indirect->len);
- struct iov_iter from;
- int ret, access;
-
- /* Sanity check */
- if (unlikely(len % sizeof desc)) {
- vq_err(vq, "Invalid length in indirect descriptor: "
- "len 0x%llx not multiple of 0x%zx\n",
- (unsigned long long)len,
- sizeof desc);
- return -EINVAL;
- }
-
- ret = translate_desc(vq, vhost64_to_cpu(vq, indirect->addr), len...