search for: desc_stat

Displaying 20 results from an estimated 184 matches for "desc_stat".

Did you mean: desc_state
2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
...en.h> +static bool force_used_validation = false; +module_param(force_used_validation, bool, 0444); + #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ #define BAD_RING(_vq, fmt, args...) \ @@ -105,6 +108,9 @@ struct vring_virtqueue_split { struct vring_desc_state_split *desc_state; struct vring_desc_extra *desc_extra; + /* Maximum in buffer length, NULL means no used validation */ + u32 *buflen; + /* DMA address and size information */ dma_addr_t queue_dma_addr; size_t queue_size_in_bytes; @@ -145,6 +151,9 @@ struct vring_virtqueue_packed { str...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...nged, 481 insertions(+), 10 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 62d7c407841a..c6c5deb0e3ae 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -58,7 +58,8 @@ > > struct vring_desc_state { > void *data; /* Data for callback. */ > - struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + void *indir_desc; /* Indirect descriptor, if any. */ > + int num; /* Descriptor list length. */ > }; > > struct vring_virtqueue { > @@ -116,6 +1...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...nged, 481 insertions(+), 10 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 62d7c407841a..c6c5deb0e3ae 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -58,7 +58,8 @@ > > struct vring_desc_state { > void *data; /* Data for callback. */ > - struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + void *indir_desc; /* Indirect descriptor, if any. */ > + int num; /* Descriptor list length. */ > }; > > struct vring_virtqueue { > @@ -116,6 +1...
2020 Mar 06
1
[PATCH] virtio_ring: Fix mem leak with vring_new_virtqueue()
...in the __vring_new_virtqueue() but frees it only when the >>>> .we_own_ring >>>> flag is set. This leads to a memory leak when freeing such allocated >>>> virtqueues with the vring_del_virtqueue() function. >>>> >>>> Fix this by moving the desc_state free code outside the flag and only >>>> for split rings. Issue was discovered during testing with remoteproc >>>> and virtio_rpmsg. >>>> >>>> Fixes: cbeedb72b97a ("virtio_ring: allocate desc state for split ring >>>> separately&quot...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...ux/module.h> #include <linux/hrtimer.h> #include <linux/kmemleak.h> +#include <linux/dma-mapping.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -54,7 +55,14 @@ #define END_USE(vq) #endif -struct vring_virtqueue { +struct vring_desc_state +{ + void *data; /* Data for callback. */ + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ +}; + +struct vring_virtqueue +{ struct virtqueue vq; /* Actual memory layout for this queue */ @@ -92,12 +100,71 @@ struct vring_virtqueue { ktime_t last_add_time; #endif - /...
2014 Aug 27
2
[PATCH 2/3] virtio_ring: Use DMA APIs
...ude <linux/hrtimer.h> > #include <linux/kmemleak.h> > +#include <linux/dma-mapping.h> > > #ifdef DEBUG > /* For development, we want to crash whenever the ring is screwed. */ > @@ -54,6 +55,12 @@ > #define END_USE(vq) > #endif > > +struct vring_desc_state > +{ > + void *data; /* Data for callback. */ > + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > +}; > + > struct vring_virtqueue > { > struct virtqueue vq; > @@ -93,12 +100,45 @@ struct vring_virtqueue > ktime_t last_add_time; > #endi...
2014 Aug 27
2
[PATCH 2/3] virtio_ring: Use DMA APIs
...ude <linux/hrtimer.h> > #include <linux/kmemleak.h> > +#include <linux/dma-mapping.h> > > #ifdef DEBUG > /* For development, we want to crash whenever the ring is screwed. */ > @@ -54,6 +55,12 @@ > #define END_USE(vq) > #endif > > +struct vring_desc_state > +{ > + void *data; /* Data for callback. */ > + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > +}; > + > struct vring_virtqueue > { > struct virtqueue vq; > @@ -93,12 +100,45 @@ struct vring_virtqueue > ktime_t last_add_time; > #endi...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...tach_buf(struct vring_virtqueue *vq, unsigned int head) >> { >> - unsigned int i; >> + unsigned int i, j; >> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT); >> >> /* Clear data ptr. */ >> - vq->data[head] = NULL; >> + vq->desc_state[head].data = NULL; >> >> - /* Put back on free list: find end */ >> + /* Put back on free list: unmap first-level descriptors and find end */ >> i = head; >> >> - /* Free the indirect table */ >> - if (vq->vring.desc[i].flags & cpu_to_virtio16(vq-...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...tach_buf(struct vring_virtqueue *vq, unsigned int head) >> { >> - unsigned int i; >> + unsigned int i, j; >> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT); >> >> /* Clear data ptr. */ >> - vq->data[head] = NULL; >> + vq->desc_state[head].data = NULL; >> >> - /* Put back on free list: find end */ >> + /* Put back on free list: unmap first-level descriptors and find end */ >> i = head; >> >> - /* Free the indirect table */ >> - if (vq->vring.desc[i].flags & cpu_to_virtio16(vq-...
2014 Aug 26
0
[PATCH 2/3] virtio_ring: Use DMA APIs
...+24,7 @@ #include <linux/module.h> #include <linux/hrtimer.h> #include <linux/kmemleak.h> +#include <linux/dma-mapping.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -54,6 +55,12 @@ #define END_USE(vq) #endif +struct vring_desc_state +{ + void *data; /* Data for callback. */ + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ +}; + struct vring_virtqueue { struct virtqueue vq; @@ -93,12 +100,45 @@ struct vring_virtqueue ktime_t last_add_time; #endif - /* Tokens for callbacks. */ - void *data[]; + /*...
2023 Mar 22
1
[PATCH vhost v4 04/11] virtio_ring: split: support premapped
...| 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index c8ed4aef9462..a2a77a0dafe6 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -70,6 +70,7 @@ struct vring_desc_state_split { void *data; /* Data for callback. */ struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ + bool dma_map_internal; /* Do dma map internally. */ }; struct vring_desc_state_packed { @@ -448,7 +449,7 @@ static void vring_unmap_one_split_indirect(const struct vring_virt...
2023 Mar 21
1
[PATCH vhost v3 04/11] virtio_ring: split: support premapped
...1 file changed, 19 insertions(+), 8 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index c8ed4aef9462..be2ff96964c3 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -70,6 +70,7 @@ > struct vring_desc_state_split { > void *data; /* Data for callback. */ > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + bool map_inter; /* Do dma map internally. */ I prefer a full name. E.g. "dma_map_internal". Eschew abbreviation. > }; > > struct vring_d...
2018 Apr 25
0
[RFC v3 3/5] virtio_ring: add packed ring support
...++++++++++++++++++++++++++++- 1 file changed, 434 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index e164822ca66e..0181e93897be 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -58,7 +58,8 @@ struct vring_desc_state { void *data; /* Data for callback. */ - struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ + void *indir_desc; /* Indirect descriptor, if any. */ + int num; /* Descriptor list length. */ }; struct vring_virtqueue { @@ -142,6 +143,16 @@ struct vring_virtqueue { #define...
2018 May 16
0
[RFC v4 3/5] virtio_ring: add packed ring support
...++++++++++++++++++++++++++++- 1 file changed, 481 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 62d7c407841a..c6c5deb0e3ae 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -58,7 +58,8 @@ struct vring_desc_state { void *data; /* Data for callback. */ - struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ + void *indir_desc; /* Indirect descriptor, if any. */ + int num; /* Descriptor list length. */ }; struct vring_virtqueue { @@ -116,6 +117,9 @@ struct vring_virtqueue { /* Last...
2014 Aug 27
0
[PATCH 2/3] virtio_ring: Use DMA APIs
...t;linux/kmemleak.h> > > +#include <linux/dma-mapping.h> > > > > #ifdef DEBUG > > /* For development, we want to crash whenever the ring is screwed. */ > > @@ -54,6 +55,12 @@ > > #define END_USE(vq) > > #endif > > > > +struct vring_desc_state > > +{ > > + void *data; /* Data for callback. */ > > + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > > +}; > > + > > struct vring_virtqueue > > { > > struct virtqueue vq; > > @@ -93,12 +100,45 @@ struct vring_virtqu...
2016 Feb 03
0
[PATCH v7 5/9] virtio_ring: Support DMA APIs
...+24,7 @@ #include <linux/module.h> #include <linux/hrtimer.h> #include <linux/kmemleak.h> +#include <linux/dma-mapping.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -54,6 +55,11 @@ #define END_USE(vq) #endif +struct vring_desc_state { + void *data; /* Data for callback. */ + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ +}; + struct vring_virtqueue { struct virtqueue vq; @@ -98,8 +104,8 @@ struct vring_virtqueue { ktime_t last_add_time; #endif - /* Tokens for callbacks. */ - void *data[]; + /*...
2023 Mar 07
2
[PATCH vhost v1 03/12] virtio_ring: split: introduce virtqueue_add_split_premapped()
...files changed, 69 insertions(+), 10 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 17520f0d7649..5b186ce73d35 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -70,6 +70,7 @@ > struct vring_desc_state_split { > void *data; /* Data for callback. */ > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + bool dma_map; /* Addr is mapped by virtio core or not. */ This will stress the cache, can we pack the boolea...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...velopment, we want to crash whenever the ring is screwed. */ > > > > > > > #define BAD_RING(_vq, fmt, args...) \ > > > > > > > @@ -105,6 +108,9 @@ struct vring_virtqueue_split { > > > > > > > struct vring_desc_state_split *desc_state; > > > > > > > struct vring_desc_extra *desc_extra; > > > > > > > > > > > > > > + /* Maximum in buffer length, NULL means no used validation */ > > > > > > > + u32 *buflen; > >...
2018 May 16
8
[RFC v4 0/5] virtio: support packed ring
Hello everyone, This RFC implements packed ring support in virtio driver. Some simple functional tests have been done with Jason's packed ring implementation in vhost: https://lkml.org/lkml/2018/4/23/12 Both of ping and netperf worked as expected (with EVENT_IDX disabled). TODO: - Refinements (for code and commit log); - More tests; - Bug fixes; RFC v3 -> RFC v4: - Make ID allocation
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...ant to crash whenever the ring is screwed. */ > > > > > > > > #define BAD_RING(_vq, fmt, args...) \ > > > > > > > > @@ -105,6 +108,9 @@ struct vring_virtqueue_split { > > > > > > > > struct vring_desc_state_split *desc_state; > > > > > > > > struct vring_desc_extra *desc_extra; > > > > > > > > > > > > > > > > + /* Maximum in buffer length, NULL means no used validation */ > > > > > > > > + u3...