search for: num_added

Displaying 20 results from an estimated 208 matches for "num_added".

2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...> > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > > > * suppressions. */ > > > > > > > virtio_mb(vq->weak_barriers); > > > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > > > + new = vq->next_avail_idx; > > > > > > > + vq->num_added = 0; > > > > > > > + > > > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > > > + off_wrap = vir...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...> > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > > > * suppressions. */ > > > > > > > virtio_mb(vq->weak_barriers); > > > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > > > + new = vq->next_avail_idx; > > > > > > > + vq->num_added = 0; > > > > > > > + > > > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > > > + off_wrap = vir...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...u32 snapshot; > > > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > * suppressions. */ > > > > > virtio_mb(vq->weak_barriers); > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > + new = vq->next_avail_idx; > > > > > + vq->num_added = 0; > > > > > + > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff);...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...u32 snapshot; > > > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > * suppressions. */ > > > > > virtio_mb(vq->weak_barriers); > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > + new = vq->next_avail_idx; > > > > > + vq->num_added = 0; > > > > > + > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff);...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...gt; bool needs_kick; > > > u32 snapshot; > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > * suppressions. */ > > > virtio_mb(vq->weak_barriers); > > > + old = vq->next_avail_idx - vq->num_added; > > > + new = vq->next_avail_idx; > > > + vq->num_added = 0; > > > + > > > snapshot = *(u32 *)vq->vring_packed.device; > > > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff); > > > flags = cpu_to_virtio16(_vq-&gt...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...gt; bool needs_kick; > > > u32 snapshot; > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > * suppressions. */ > > > virtio_mb(vq->weak_barriers); > > > + old = vq->next_avail_idx - vq->num_added; > > > + new = vq->next_avail_idx; > > > + vq->num_added = 0; > > > + > > > snapshot = *(u32 *)vq->vring_packed.device; > > > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff); > > > flags = cpu_to_virtio16(_vq-&gt...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > > > > * suppressions. */ > > > > > > > > virtio_mb(vq->weak_barriers); > > > > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > > > > + new = vq->next_avail_idx; > > > > > > > > + vq->num_added = 0; > > > > > > > > + > > > > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > > &...
2018 May 02
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...gt; > > > u32 snapshot; > > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > * suppressions. */ > > > > virtio_mb(vq->weak_barriers); > > > > + old = vq->next_avail_idx - vq->num_added; > > > > + new = vq->next_avail_idx; > > > > + vq->num_added = 0; > > > > + > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff); > > > > f...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...> > > > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > > > > > > * suppressions. */ > > > > > > virtio_mb(vq->weak_barriers); > > > > > > + old = vq->next_avail_idx - vq->num_added; > > > > > > + new = vq->next_avail_idx; > > > > > > + vq->num_added = 0; > > > > > > + > > > > > > snapshot = *(u32 *)vq->vring_packed.device; > > > > > > + off_wrap = virtio16_to_cpu(_vq->vdev...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...t;> Tiwei Bie >> I consider casts and huge numbers with two's complement >> games even uglier. > The dependency on two's complement game is introduced > since the split ring. > > In packed ring, old is calculated via: > > old = vq->next_avail_idx - vq->num_added; > > In split ring, old is calculated via: > > old = vq->avail_idx_shadow - vq->num_added; > > In both cases, when vq->num_added is bigger, old will > be a big number. > > Best regards, > Tiwei Bie > How about just do something like vhost: static u16 vhos...
2018 May 03
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...t;> Tiwei Bie >> I consider casts and huge numbers with two's complement >> games even uglier. > The dependency on two's complement game is introduced > since the split ring. > > In packed ring, old is calculated via: > > old = vq->next_avail_idx - vq->num_added; > > In split ring, old is calculated via: > > old = vq->avail_idx_shadow - vq->num_added; > > In both cases, when vq->num_added is bigger, old will > be a big number. > > Best regards, > Tiwei Bie > How about just do something like vhost: static u16 vhos...
2011 Nov 03
2
[PATCH 5 of 5] virtio: expose added descriptors immediately
...rtio/virtio_ring.c b/drivers/virtio/virtio_ring.c --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -227,9 +227,15 @@ add_head: /* Put entry in available array (but don't update avail->idx until they * do sync). */ - avail = ((vq->vring.avail->idx + vq->num_added++) & (vq->vring.num-1)); + avail = (vq->vring.avail->idx & (vq->vring.num-1)); vq->vring.avail->ring[avail] = head; + /* Descriptors and available array need to be set before we expose the + * new available array entries. */ + virtio_wmb(); + vq->vring.avail->id...
2011 Nov 03
2
[PATCH 5 of 5] virtio: expose added descriptors immediately
...rtio/virtio_ring.c b/drivers/virtio/virtio_ring.c --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -227,9 +227,15 @@ add_head: /* Put entry in available array (but don't update avail->idx until they * do sync). */ - avail = ((vq->vring.avail->idx + vq->num_added++) & (vq->vring.num-1)); + avail = (vq->vring.avail->idx & (vq->vring.num-1)); vq->vring.avail->ring[avail] = head; + /* Descriptors and available array need to be set before we expose the + * new available array entries. */ + virtio_wmb(); + vq->vring.avail->id...
2018 Jul 10
1
[PATCH net-next v1 4/5] virtio_ring: add event idx support in packed ring
On 2018?07?09? 15:22, Tiwei Bie wrote: > @@ -1059,9 +1059,19 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > * suppressions. */ > virtio_mb(vq->weak_barriers); > > + old = vq->next_avail_idx - vq->num_added; > + new = vq->next_avail_idx; > + vq->num_added = 0; > + > snapshot = *(u32 *)vq->vring_packed.device; I think we should use READ_ONCE() to prevent compiler from re-reading. > + off_wrap = virtio16_to_cpu(_vq->vdev, (__virtio16)(snapshot & 0xffff)); > flag...
2015 Feb 06
1
[PATCH] virtio: Avoid possible kernel panic if DEBUG is enabled.
...c40b62 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp> Date: Fri, 6 Feb 2015 13:28:38 +0900 Subject: [PATCH] virtio: Avoid possible kernel panic if DEBUG is enabled. The virtqueue_add() calls START_USE() upon entry. The virtqueue_kick() is called if vq->num_added == (1 << 16) - 1 before calling END_USE(). The virtqueue_kick_prepare() called via virtqueue_kick() calls START_USE() upon entry, and will call panic() if DEBUG is enabled. Move this virtqueue_kick() call to after END_USE() call. Signed-off-by: Tetsuo Handa <penguin-kernel at I-love.SAKUR...
2015 Feb 06
1
[PATCH] virtio: Avoid possible kernel panic if DEBUG is enabled.
...c40b62 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp> Date: Fri, 6 Feb 2015 13:28:38 +0900 Subject: [PATCH] virtio: Avoid possible kernel panic if DEBUG is enabled. The virtqueue_add() calls START_USE() upon entry. The virtqueue_kick() is called if vq->num_added == (1 << 16) - 1 before calling END_USE(). The virtqueue_kick_prepare() called via virtqueue_kick() calls START_USE() upon entry, and will call panic() if DEBUG is enabled. Move this virtqueue_kick() call to after END_USE() call. Signed-off-by: Tetsuo Handa <penguin-kernel at I-love.SAKUR...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...+ u16 new, old, off_wrap, flags; > bool needs_kick; > u32 snapshot; > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > * suppressions. */ > virtio_mb(vq->weak_barriers); > > + old = vq->next_avail_idx - vq->num_added; > + new = vq->next_avail_idx; > + vq->num_added = 0; > + > snapshot = *(u32 *)vq->vring_packed.device; > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff); > flags = cpu_to_virtio16(_vq->vdev, snapshot >> 16) & 0x3; > > #ifde...
2018 May 02
2
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...+ u16 new, old, off_wrap, flags; > bool needs_kick; > u32 snapshot; > > @@ -995,7 +995,12 @@ static bool virtqueue_kick_prepare_packed(struct virtqueue *_vq) > * suppressions. */ > virtio_mb(vq->weak_barriers); > > + old = vq->next_avail_idx - vq->num_added; > + new = vq->next_avail_idx; > + vq->num_added = 0; > + > snapshot = *(u32 *)vq->vring_packed.device; > + off_wrap = virtio16_to_cpu(_vq->vdev, snapshot & 0xffff); > flags = cpu_to_virtio16(_vq->vdev, snapshot >> 16) & 0x3; > > #ifde...
2021 May 26
2
[PATCH v3 3/4] virtio: fix up virtio_disable_cb
...t;flags = cpu_to_virtio16(_vq->vdev, vq->split.avail_flags_shadow); @@ -1605,6 +1611,7 @@ static struct virtqueue *vring_create_virtqueue_packed( vq->weak_barriers = weak_barriers; vq->broken = false; vq->last_used_idx = 0; + vq->event_triggered = false; vq->num_added = 0; vq->packed_ring = true; vq->use_dma_api = vring_use_dma_api(vdev); @@ -1919,6 +1926,12 @@ void virtqueue_disable_cb(struct virtqueue *_vq) { struct vring_virtqueue *vq = to_vvq(_vq); + /* If device triggered an event already it won't trigger one again: + * no need to disabl...
2018 May 03
0
[RFC v3 4/5] virtio_ring: add event idx support in packed ring
...asts and huge numbers with two's complement > > > games even uglier. > > The dependency on two's complement game is introduced > > since the split ring. > > > > In packed ring, old is calculated via: > > > > old = vq->next_avail_idx - vq->num_added; > > > > In split ring, old is calculated via: > > > > old = vq->avail_idx_shadow - vq->num_added; > > > > In both cases, when vq->num_added is bigger, old will > > be a big number. > > > > Best regards, > > Tiwei Bie > &gt...