qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick
@ 2024-03-20  9:04 Zheyu Ma
  2024-03-20 16:55 ` Philippe Mathieu-Daudé
  2024-03-20 17:40 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Zheyu Ma @ 2024-03-20  9:04 UTC (permalink / raw)
  To: thuth, lvivier, pbonzini; +Cc: qemu-devel, zheyuma97

In qvirtqueue_kick(), the 'flags' were previously being incorrectly read from
vq->avail instead of the correct vq->used location. This update ensures 'flags'
are read from the correct location as per the virtio standard.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 tests/qtest/libqos/virtio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
index 82a6e122bf..a21b6eee9c 100644
--- a/tests/qtest/libqos/virtio.c
+++ b/tests/qtest/libqos/virtio.c
@@ -394,7 +394,7 @@ void qvirtqueue_kick(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq,
     qvirtio_writew(d, qts, vq->avail + 2, idx + 1);
 
     /* Must read after idx is updated */
-    flags = qvirtio_readw(d, qts, vq->avail);
+    flags = qvirtio_readw(d, qts, vq->used);
     avail_event = qvirtio_readw(d, qts, vq->used + 4 +
                                 sizeof(struct vring_used_elem) * vq->size);
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick
  2024-03-20  9:04 [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick Zheyu Ma
@ 2024-03-20 16:55 ` Philippe Mathieu-Daudé
  2024-03-20 17:40 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-20 16:55 UTC (permalink / raw)
  To: Zheyu Ma, thuth, lvivier, pbonzini
  Cc: qemu-devel, Stefan Hajnoczi, Marc Marí

Cc'ing Marc & Stefan for commit 1053587c3f ("libqos: Added EVENT_IDX 
support").

On 20/3/24 10:04, Zheyu Ma wrote:
> In qvirtqueue_kick(), the 'flags' were previously being incorrectly read from
> vq->avail instead of the correct vq->used location. This update ensures 'flags'
> are read from the correct location as per the virtio standard.
> 
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
>   tests/qtest/libqos/virtio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
> index 82a6e122bf..a21b6eee9c 100644
> --- a/tests/qtest/libqos/virtio.c
> +++ b/tests/qtest/libqos/virtio.c
> @@ -394,7 +394,7 @@ void qvirtqueue_kick(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq,
>       qvirtio_writew(d, qts, vq->avail + 2, idx + 1);
>   
>       /* Must read after idx is updated */
> -    flags = qvirtio_readw(d, qts, vq->avail);
> +    flags = qvirtio_readw(d, qts, vq->used);
>       avail_event = qvirtio_readw(d, qts, vq->used + 4 +
>                                   sizeof(struct vring_used_elem) * vq->size);
>   

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick
  2024-03-20  9:04 [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick Zheyu Ma
  2024-03-20 16:55 ` Philippe Mathieu-Daudé
@ 2024-03-20 17:40 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2024-03-20 17:40 UTC (permalink / raw)
  To: Zheyu Ma; +Cc: thuth, lvivier, pbonzini, qemu-devel

On Wed, 20 Mar 2024 at 09:10, Zheyu Ma <zheyuma97@gmail.com> wrote:
>
> In qvirtqueue_kick(), the 'flags' were previously being incorrectly read from
> vq->avail instead of the correct vq->used location. This update ensures 'flags'
> are read from the correct location as per the virtio standard.
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
>  tests/qtest/libqos/virtio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

> diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
> index 82a6e122bf..a21b6eee9c 100644
> --- a/tests/qtest/libqos/virtio.c
> +++ b/tests/qtest/libqos/virtio.c
> @@ -394,7 +394,7 @@ void qvirtqueue_kick(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq,
>      qvirtio_writew(d, qts, vq->avail + 2, idx + 1);
>
>      /* Must read after idx is updated */
> -    flags = qvirtio_readw(d, qts, vq->avail);
> +    flags = qvirtio_readw(d, qts, vq->used);
>      avail_event = qvirtio_readw(d, qts, vq->used + 4 +
>                                  sizeof(struct vring_used_elem) * vq->size);
>
> --
> 2.34.1
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-20 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20  9:04 [PATCH] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick Zheyu Ma
2024-03-20 16:55 ` Philippe Mathieu-Daudé
2024-03-20 17:40 ` Stefan Hajnoczi

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).