* [PATCH] Update event idx if guest has made extra buffers during double check
@ 2024-06-13 2:21 thomas
2024-06-17 2:15 ` Jason Wang
2024-06-17 10:58 ` Michael S. Tsirkin
0 siblings, 2 replies; 5+ messages in thread
From: thomas @ 2024-06-13 2:21 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, jasowang, 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(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9c7e85caea..23c6c8c898 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Update event idx if guest has made extra buffers during double check
2024-06-13 2:21 [PATCH] Update event idx if guest has made extra buffers during double check thomas
@ 2024-06-17 2:15 ` Jason Wang
2024-06-17 10:58 ` Michael S. Tsirkin
1 sibling, 0 replies; 5+ messages in thread
From: Jason Wang @ 2024-06-17 2:15 UTC (permalink / raw)
To: thomas; +Cc: qemu-devel, mst
On Thu, Jun 13, 2024 at 10:22 AM thomas <east.moutain.yang@gmail.com> wrote:
>
> 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 qemu-stable@nongnu.org
Thanks
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 9c7e85caea..23c6c8c898 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update event idx if guest has made extra buffers during double check
2024-06-13 2:21 [PATCH] Update event idx if guest has made extra buffers during double check thomas
2024-06-17 2:15 ` Jason Wang
@ 2024-06-17 10:58 ` Michael S. Tsirkin
2024-06-17 13:51 ` Yang Dongshan
1 sibling, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2024-06-17 10:58 UTC (permalink / raw)
To: thomas; +Cc: qemu-devel, jasowang
Thanks for the patch!
Yet something to improve:
subject should list the affected component, and be shorter.
On Thu, Jun 13, 2024 at 10:21:47AM +0800, thomas wrote:
> 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?
> If guest has made some buffers available during double check,
what does "double check" refer to?
> 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.
> ---
> hw/net/virtio-net.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 9c7e85caea..23c6c8c898 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update event idx if guest has made extra buffers during double check
2024-06-17 10:58 ` Michael S. Tsirkin
@ 2024-06-17 13:51 ` Yang Dongshan
2024-06-24 10:24 ` Michael S. Tsirkin
0 siblings, 1 reply; 5+ messages in thread
From: Yang Dongshan @ 2024-06-17 13:51 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel, jasowang, qemu-stable
[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]
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"
Fixes: 06b12970174 ("virtio-net: fix network stall under load")
this should come at the end.
I have submitted v2, it's at the end now.
and what exactly does this refer to?
>
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?
>
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?
>
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
> 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.
On Mon, Jun 17, 2024 at 6:58 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> Thanks for the patch!
> Yet something to improve:
>
>
>
> subject should list the affected component, and be shorter.
>
> On Thu, Jun 13, 2024 at 10:21:47AM +0800, thomas wrote:
> > 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?
>
> > If guest has made some buffers available during double check,
>
> what does "double check" refer to?
>
> > 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.
>
>
>
> > ---
> > hw/net/virtio-net.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index 9c7e85caea..23c6c8c898 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -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
>
>
[-- Attachment #2: Type: text/html, Size: 4699 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update event idx if guest has made extra buffers during double check
2024-06-17 13:51 ` Yang Dongshan
@ 2024-06-24 10:24 ` Michael S. Tsirkin
0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2024-06-24 10:24 UTC (permalink / raw)
To: Yang Dongshan; +Cc: qemu-devel, jasowang, qemu-stable
On Mon, Jun 17, 2024 at 09:51:33PM +0800, Yang Dongshan wrote:
> 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.
So it's an optimization then? Same as any optimization, it should
come with measurements showing the performance benefit.
--
MST
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-24 10:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 2:21 [PATCH] Update event idx if guest has made extra buffers during double check thomas
2024-06-17 2:15 ` Jason Wang
2024-06-17 10:58 ` Michael S. Tsirkin
2024-06-17 13:51 ` Yang Dongshan
2024-06-24 10:24 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).