Displaying 20 results from an estimated 31 matches for "virtqueue_add_indirect_packed".
2019 Mar 12
0
[PATCH] virtio_ring: Fix potential mem leak in virtqueue_add_indirect_packed
.../virtio/virtio_ring.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index a0b07c3..9d95d9c 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -991,6 +991,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
>
> if (unlikely(vq->vq.num_free < 1)) {
> pr_debug("Can't add buf len 1 - avail = 0\n");
> + kfree(desc);
> END_USE(vq);
> return -ENOSPC;
> }
Or you can move the check before the allocation.
Acked-by: Ja...
2023 Mar 02
1
[PATCH vhost v1 06/12] virtio_ring: packed: separate DMA codes
...+++----------------------------
1 file changed, 12 insertions(+), 47 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 6796cbee0207..81a9c0692fec 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1350,7 +1350,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
struct vring_packed_desc *desc)
{
struct scatterlist *sg;
- unsigned int i, n, err_idx;
+ unsigned int i, n;
u16 head, id;
dma_addr_t addr;
@@ -1362,14 +1362,9 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
for (n = 0; n <...
2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
...eof(*vring_split->buflen),
+ GFP_KERNEL);
+ if (!vring_split->buflen)
+ goto err_buflen;
+ }
+
return 0;
+
+err_buflen:
+ vring_free_split(vring_split, vdev, dma_dev);
+ return -ENOMEM;
}
static struct virtqueue *vring_create_virtqueue_split(
@@ -1297,6 +1344,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
unsigned int i, n, err_idx;
u16 head, id;
dma_addr_t addr;
+ u32 buflen = 0;
head = vq->packed.next_avail_idx;
desc = alloc_indirect_packed(total_sg, gfp);
@@ -1325,6 +1373,8 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
desc[...
2018 Nov 21
1
[PATCH net-next v3 00/13] virtio: support packed ring
...which Jason may fix very
quickly, so I didn't post it. Below is the hack I used:
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index cd7e755484e3..42faea7d8cf8 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -980,6 +980,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
unsigned int i, n, err_idx;
u16 head, id;
dma_addr_t addr;
+ int c = 0;
head = vq->packed.next_avail_idx;
desc = alloc_indirect_packed(total_sg, gfp);
@@ -1001,8 +1002,9 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
if (vring_...
2018 Dec 07
0
[RFC 3/3] virtio_ring: use new vring flags
...dma_unmap_page(vring_dma_dev(vq),
le64_to_cpu(desc->addr),
le32_to_cpu(desc->len),
- (flags & VRING_DESC_F_WRITE) ?
+ (flags & BIT(VRING_PACKED_DESC_F_WRITE)) ?
DMA_FROM_DEVICE : DMA_TO_DEVICE);
}
}
@@ -1002,7 +1015,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
goto unmap_release;
desc[i].flags = cpu_to_le16(n < out_sgs ?
- 0 : VRING_DESC_F_WRITE);
+ 0 : BIT(VRING_PACKED_DESC_F_WRITE));
desc[i].addr = cpu_to_le64(addr);
desc[i].len = cpu_to_le32(sg->length);
i++;
@@ -1025,8 +1038,9 @@ stati...
2023 Mar 02
12
[PATCH vhost v1 00/12] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 Mar 21
11
[PATCH vhost v3 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 Mar 22
11
[PATCH vhost v4 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 Mar 24
11
[PATCH vhost v5 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 Mar 27
11
[PATCH vhost v6 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 Feb 14
11
[PATCH vhost 00/10] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good.
ENV: Qemu with vhost.
vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS
-----------------------------|---------------|------------------|------------
xmit by sockperf: 90% | 100%
2023 May 09
12
[PATCH vhost v8 00/12] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 Apr 25
12
[PATCH vhost v7 00/11] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...dma_dev);
> > > > > > > + return -ENOMEM;
> > > > > > > }
> > > > > > >
> > > > > > > static struct virtqueue *vring_create_virtqueue_split(
> > > > > > > @@ -1297,6 +1344,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
> > > > > > > unsigned int i, n, err_idx;
> > > > > > > u16 head, id;
> > > > > > > dma_addr_t addr;
> > > > > > > + u32 buflen = 0;
> > > > > > &g...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...> > > > > + return -ENOMEM;
> > > > > > > > }
> > > > > > > >
> > > > > > > > static struct virtqueue *vring_create_virtqueue_split(
> > > > > > > > @@ -1297,6 +1344,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
> > > > > > > > unsigned int i, n, err_idx;
> > > > > > > > u16 head, id;
> > > > > > > > dma_addr_t addr;
> > > > > > > > + u32 buflen = 0;
> > &g...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...> > > > > + return -ENOMEM;
> > > > > > > > }
> > > > > > > >
> > > > > > > > static struct virtqueue *vring_create_virtqueue_split(
> > > > > > > > @@ -1297,6 +1344,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
> > > > > > > > unsigned int i, n, err_idx;
> > > > > > > > u16 head, id;
> > > > > > > > dma_addr_t addr;
> > > > > > > > + u32 buflen = 0;
> > &g...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...> + return -ENOMEM;
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > static struct virtqueue *vring_create_virtqueue_split(
> > > > > > > > > @@ -1297,6 +1344,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
> > > > > > > > > unsigned int i, n, err_idx;
> > > > > > > > > u16 head, id;
> > > > > > > > > dma_addr_t addr;
> > > > > > > > > + u32 bufl...
2018 Dec 07
7
[RFC 0/3] virtio_ring: define flags as shifts consistently
This is a follow up of the discussion in this thread:
https://patchwork.ozlabs.org/patch/1001015/#2042353
Tiwei Bie (3):
virtio_ring: define flags as shifts consistently
virtio_ring: add VIRTIO_RING_NO_LEGACY
virtio_ring: use new vring flags
drivers/virtio/virtio_ring.c | 100 ++++++++++++++++++-------------
include/uapi/linux/virtio_ring.h | 61 +++++++++++++------
2 files changed,
2018 Dec 07
7
[RFC 0/3] virtio_ring: define flags as shifts consistently
This is a follow up of the discussion in this thread:
https://patchwork.ozlabs.org/patch/1001015/#2042353
Tiwei Bie (3):
virtio_ring: define flags as shifts consistently
virtio_ring: add VIRTIO_RING_NO_LEGACY
virtio_ring: use new vring flags
drivers/virtio/virtio_ring.c | 100 ++++++++++++++++++-------------
include/uapi/linux/virtio_ring.h | 61 +++++++++++++------
2 files changed,
2023 May 17
12
[PATCH vhost v9 00/12] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use