* [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick()
@ 2016-08-26 3:18 zhangshuai
2016-09-05 17:44 ` Stefan Hajnoczi
2016-09-05 18:08 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: zhangshuai @ 2016-08-26 3:18 UTC (permalink / raw)
To: stefanha
Cc: qemu-devel, wu.wubin, eric.fangyi, subo7, kathy.wangting,
lina.lulina, zhangshuai13
From: Zhang Shuai <zhangshuai13@huawei.com>
The idx and ring[] of vring_avail is 16-bit, but the writel
is 32-bit, the second writel will cover the ring[free_head]
with 0. So use writew to replace writel to fix the bug.
Signed-off-by: zhangshuai <zhangshuai13@huawei.com>
---
tests/libqos/virtio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index d8c2970..801690f 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -264,9 +264,9 @@ void qvirtqueue_kick(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq,
uint16_t avail_event;
/* vq->avail->ring[idx % vq->size] */
- writel(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
+ writew(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
/* vq->avail->idx */
- writel(vq->avail + 2, idx + 1);
+ writew(vq->avail + 2, idx + 1);
/* Must read after idx is updated */
flags = readw(vq->avail);
--
1.8.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick()
2016-08-26 3:18 [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick() zhangshuai
@ 2016-09-05 17:44 ` Stefan Hajnoczi
2016-09-05 18:08 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-09-05 17:44 UTC (permalink / raw)
To: zhangshuai
Cc: qemu-devel, wu.wubin, eric.fangyi, subo7, kathy.wangting,
lina.lulina
[-- Attachment #1: Type: text/plain, Size: 555 bytes --]
On Fri, Aug 26, 2016 at 11:18:22AM +0800, zhangshuai wrote:
> From: Zhang Shuai <zhangshuai13@huawei.com>
>
> The idx and ring[] of vring_avail is 16-bit, but the writel
> is 32-bit, the second writel will cover the ring[free_head]
> with 0. So use writew to replace writel to fix the bug.
>
> Signed-off-by: zhangshuai <zhangshuai13@huawei.com>
> ---
> tests/libqos/virtio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick()
2016-08-26 3:18 [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick() zhangshuai
2016-09-05 17:44 ` Stefan Hajnoczi
@ 2016-09-05 18:08 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-09-05 18:08 UTC (permalink / raw)
To: zhangshuai
Cc: qemu-devel, wu.wubin, eric.fangyi, subo7, kathy.wangting,
lina.lulina
[-- Attachment #1: Type: text/plain, Size: 1214 bytes --]
On Fri, Aug 26, 2016 at 11:18:22AM +0800, zhangshuai wrote:
> From: Zhang Shuai <zhangshuai13@huawei.com>
>
> The idx and ring[] of vring_avail is 16-bit, but the writel
> is 32-bit, the second writel will cover the ring[free_head]
> with 0. So use writew to replace writel to fix the bug.
>
> Signed-off-by: zhangshuai <zhangshuai13@huawei.com>
> ---
> tests/libqos/virtio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
> index d8c2970..801690f 100644
> --- a/tests/libqos/virtio.c
> +++ b/tests/libqos/virtio.c
> @@ -264,9 +264,9 @@ void qvirtqueue_kick(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq,
> uint16_t avail_event;
>
> /* vq->avail->ring[idx % vq->size] */
> - writel(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
> + writew(vq->avail + 4 + (2 * (idx % vq->size)), free_head);
> /* vq->avail->idx */
> - writel(vq->avail + 2, idx + 1);
> + writew(vq->avail + 2, idx + 1);
Laurent Vivier sent an equivalent patch that also covers the incorrect
readl() call. I have applied his patch instead and mentioned your work
to give you credit.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-05 19:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-26 3:18 [Qemu-devel] [PATCH] libqos: fix bugs in qvirtqueue_kick() zhangshuai
2016-09-05 17:44 ` Stefan Hajnoczi
2016-09-05 18:08 ` 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).