Update event idx if guest has made extra buffers during double check
PATCH 1/1 Update event idx if guest has made extra buffers during double check
If guest has made some buffers available during double check, but the total buffer size available is lower than @bufsize, notify the guest with the latest available idx(event idx) seen by the host.
--- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+)
hw/net/virtio-net.c +1 -0
@@ -1654,6 +1654,7 @@ static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)if (virtio_queue_empty (q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes (q->rx_vq, bufsize,0 ))) { +virtio_queue_set_notification (q->rx_vq,1 );return 0 ; } }
Signature · 1 line
2.39.0
Quoted 10 lines · thomas
Fixes 06b12970174 ("virtio-net: fix network stall under load")If guest has made some buffers available during double check, but the total buffer size available is lower than @bufsize, notify the guest with the latest available idx(event idx) seen by the host.
--- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+)
Patch looks good to me, but it misses some other stuff for example:
- the sob tag.
- fixes should be placed above sob tag
- need to cc [email protected]
Thanks
Quoted 16 lines
hw/net/virtio-net.c +1
-1@@ -1654,6 +1654,7 @@ static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)if (virtio_queue_empty (q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes (q->rx_vq, bufsize,0 ))) { +virtio_queue_set_notification (q->rx_vq,1 );return 0 ; } } --2.39.0
Thanks for the patch!
Yet something to improve:
subject should list the affected component, and be shorter.
Quoted 1 line · thomas
Fixes 06b12970174 ("virtio-net: fix network stall under load")
this should come at the end. and what exactly does this refer to? did this commit cause a regression of some sort?
Quoted 1 line
If guest has made some buffers available during double check,
what does "double check" refer to?
Quoted 3 lines
but the total buffer size available is lower than @bufsize, notify the guest with the latest available idx(event idx) seen by the host.
which makes sense why? And which changes the correct behavious of what to a new behaviour of what which is better why?
Pls review docs/devel/submitting-a-patch.rst and follow the process there.
Quoted 18 lines
--- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+)hw/net/virtio-net.c +1
-0@@ -1654,6 +1654,7 @@ static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)if (virtio_queue_empty (q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes (q->rx_vq, bufsize,0 ))) { +virtio_queue_set_notification (q->rx_vq,1 );return 0 ; } }Signature · 1 line
2.39.0
hi,
subject should list the affected component, and be shorter.
ok, I will rewrite the subject:
"update the latest available idx seen by the host to event idx"
this should come at the end.
I have submitted v2, it's at the end now.
and what exactly does this refer to?
Quoted 1 line
Commit 06b12970174 double-checks whether the guest has made some buffers available after the first check, it will be lucky if the available buffer
size can satisfy the request.
did this commit cause a regression of some sort?
Quoted 1 line
No regression. If the buffer size still can't satisfy the request even if the
guest has made some buffers. this commit doesn't notify the latest shadow_avail_idx seen by the host to the guest. Similar to the first check, if the available buffer is not enough, notify the guest with the updated shadow_avail_idx.
what does "double check" refer to?
Quoted 1 line
it refers to the second nested if condition judgment in virtio_net_has_buffers().
which makes sense why? And which changes the correct behavious of what
Quoted 2 lines
to a new behaviour of what which is better why?
Similar to the first check, if the buffer size still can't satisfy the request, notify the
guest with the updated shadow_avail_idx, it's better than the old one.
Quoted 51 lines · Michael S. Tsirkin
Thanks for the patch!
Yet something to improve:subject should list the affected component, and be shorter.
Quoted 1 line · thomas
Fixes 06b12970174 ("virtio-net: fix network stall under load")this should come at the end. and what exactly does this refer to? did this commit cause a regression of some sort?
Quoted 1 line
If guest has made some buffers available during double check,
what does "double check" refer to?
Quoted 3 lines
but the total buffer size available is lower than @bufsize, notify the guest with the latest available idx(event idx) seen by the host.
which makes sense why? And which changes the correct behavious of what to a new behaviour of what which is better why?
Pls review
docs/devel/submitting-a-patch.rstand follow the process there.hw/net/virtio-net.c static int virtio_net_has_buffers(VirtIONetQueue
Quoted 9 lines
--- hw/net/virtio-net.c | 1 + 1 file changed, 1 insertion(+)hw/net/virtio-net.c +0
-0@@ -1654,6 +1654,7 @@ static int virtio_net_has_buffers(VirtIONetQueue*q, int bufsize)
Quoted 9 lines
hw/net/virtio-net.c +1
-1if (virtio_queue_empty (q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes (q->rx_vq, bufsize,0 ))) { +virtio_queue_set_notification (q->rx_vq,1 );return 0 ; } } --2.39.0
Quoted 3 lines · Yang Dongshan
Similar to the first check, if the buffer size still can't satisfy the request, notify the
guest with the updatedshadow_avail_idx, it's better than the old one.
So it's an optimization then? Same as any optimization, it should come with measurements showing the performance benefit.
Signature · 1 line
MST