virtio: fix vring_align() on 64-bit windows
PATCH v3 1/1 virtio: fix vring_align() on 64-bit windows
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the QEMU_ALIGN_UP macro which does not suffer the same problem
--- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/virtio/virtio.h +1 -1
@@ -34,7 +34,7 @@ struct VirtQueue;static inline hwaddr vring_align (hwaddr addr,unsigned long align) { -return (addr + align -1 ) & ~(align -1 ); +return QEMU_ALIGN_UP (addr, align); }typedef struct VirtQueue VirtQueue ;
Signature · 1 line
2.8.3
Am 25.03.2017 um 00:19 schrieb Andrew Baumann:
Quoted 16 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>--- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/virtio/virtio.h +0
-0
include/hw/virtio/virtio.h struct VirtQueue; · line 40
Quoted 8 lines
include/hw/virtio/virtio.h +1
-1@@ -34,7 +34,7 @@ struct VirtQueue;static inline hwaddr vring_align (hwaddr addr,unsigned long align) { -return (addr + align -1 ) & ~(align -1 ); +return QEMU_ALIGN_UP (addr, align); }typedef struct VirtQueue VirtQueue ;
Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9? I wonder why I never before noticed a problem or got a bug report for this issue.
Regards
Stefan
Quoted 5 lines · Stefan Weil
Am 25.03.2017 um 00:19 schrieb Andrew Baumann:
Quoted 4 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problem
Quoted 8 lines
Quoted 3 lines
Signed-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>---
Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9?
Yes, it's a correctness bug that avoids miscompilation on 64-bit targets where long is 32 bits (which, at the moment, is really just Windows).
Quoted 2 lines
I wonder why I never before noticed
a problem or got a bug report for this issue.
Probably because so few people are testing on native Windows, and it doesn't affect other platforms.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 13 lines
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:52Quoted 8 lines · Stefan Weil
Am 25.03.2017 um 00:19 schrieb Andrew Baumann:
Quoted 7 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>---
Quoted 7 lines
Quoted 4 lines
Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9?
Yes, it's a correctness bug that avoids miscompilation on 64-bit targets where long is 32 bits (which, at the moment, is really just Windows).
I agree, this should be in 2.9. I dropped the tag by accident.
Quoted 5 lines
Quoted 2 lines
I wonder why I never before noticed
a problem or got a bug report for this issue.Probably because so few people are testing on native Windows, and it doesn't affect other platforms.
In addition to that, you only notice it on virtio devices mapped above the 32-bit limit...
Andrew
Philippe Mathieu-Daudé
Reviewed-byHi, I never received Andrew Baumann's mail via the ML...
Quoted 7 lines · Stefan Weil
Am 25.03.2017 um 00:19 schrieb
QEMU_ALIGN_UP:Quoted 6 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>
Quoted 29 lines
Quoted 10 lines
--- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/virtio/virtio.h +0
-0include/hw/virtio/virtio.h struct VirtQueue; · line 40
Quoted 8 lines
include/hw/virtio/virtio.h +1
-1@@ -34,7 +34,7 @@ struct VirtQueue;static inline hwaddr vring_align (hwaddr addr,unsigned long align) { -return (addr + align -1 ) & ~(align -1 ); +return QEMU_ALIGN_UP (addr, align); }typedef struct VirtQueue VirtQueue ;Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9? I wonder why I never before noticed a problem or got a bug report for this issue.
Regards
Stefan
Am 28.03.2017 um 20:56 schrieb Andrew Baumann:
Quoted 8 lines
Quoted 5 lines
From: Eric Blake [mailto:[email protected]]
Quoted 1 line
Is this needed for 2.9?
Yes, it's a correctness bug that avoids miscompilation on 64-bit targets where long is 32 bits (which, at the moment, is really just Windows).
I agree, this should be in 2.9. I dropped the tag by accident.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I wonder why I never before noticed
a problem or got a bug report for this issue.Probably because so few people are testing on native Windows, and it doesn't affect other platforms.
In addition to that, you only notice it on virtio devices mapped above the 32-bit limit...
I think that is the reason why most people don't get that problem.
I also think that only a few people are testing on Windows, but there seem to be more people than expected who simply use it. Most of them will never complain when they have a problem, but sometimes I also get e-mails which report an issue.
By the way: I expect that more Windows users will be attracted as soon as the HAXM acceleration works better (Intel is just preparing a new HAXM version which fixes CPUID, something which was reported to me by a Windows user).
Stefan
Stefan Weil
Reviewed-byAm 28.03.2017 um 20:56 schrieb Andrew Baumann:
Quoted 26 lines
Quoted 13 lines
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:52Quoted 8 lines · Stefan Weil
Am 25.03.2017 um 00:19 schrieb Andrew Baumann:
Quoted 7 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>---
Quoted 7 lines
Quoted 4 lines
Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9?
Yes, it's a correctness bug that avoids miscompilation on 64-bit targets where long is 32 bits (which, at the moment, is really just Windows).
I agree, this should be in 2.9. I dropped the tag by accident.
Quoted 3 lines
Quoted 2 lines
I wonder why I never before noticed
a problem or got a bug report for this issue.
Quoted 7 lines
Quoted 2 lines
Probably because so few people are testing on native Windows, and it doesn't affect other platforms.
In addition to that, you only notice it on virtio devices mapped above the 32-bit limit...
Andrew
I added this patch to my queue. Peter, do you still accept pull requests
for 2.9? I'm still waiting for a review of another bug fix for Windows (http://patchwork.ozlabs.org/patch/743416/). How long do I have time to get bug fixes for Windows into 2.9?
Of course I would not mind if you pulled this one directly (see http://patchwork.ozlabs.org/patch/743410/).
Stefan
Quoted 6 lines · Andrew Baumann
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>
Quoted 19 lines
--- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/hw/virtio/virtio.h +1
-1@@ -34,7 +34,7 @@ struct VirtQueue;static inline hwaddr vring_align (hwaddr addr,unsigned long align) { -return (addr + align -1 ) & ~(align -1 ); +return QEMU_ALIGN_UP (addr, align); }typedef struct VirtQueue VirtQueue ;Signature · 1 line
2.8.3
Quoted 42 lines · Stefan Weil
Am 28.03.2017 um 20:56 schrieb Andrew Baumann:
Quoted 26 lines
Quoted 13 lines
From: Eric Blake [mailto:[email protected]]
Sent: Tuesday, 28 March 2017 11:52Quoted 8 lines · Stefan Weil
Am 25.03.2017 um 00:19 schrieb Andrew Baumann:
Quoted 7 lines
long is 32-bits on 64-bit windows, which caused the top half of the address to be truncated; this patch changes it to use the
QEMU_ALIGN_UPmacro which does not suffer the same problemSigned-off-by Andrew Baumann <[email protected]>Reviewed-by Eric Blake <[email protected]>---
Quoted 7 lines
Quoted 4 lines
Eric added "for-2.9" to the subject line of v2, but now it was missing again for v3.
Is this needed for 2.9?
Yes, it's a correctness bug that avoids miscompilation on 64-bit targets where long is 32 bits (which, at the moment, is really just Windows).
I agree, this should be in 2.9. I dropped the tag by accident.
Quoted 3 lines
Quoted 2 lines
I wonder why I never before noticed
a problem or got a bug report for this issue.Quoted 7 lines
Quoted 2 lines
Probably because so few people are testing on native Windows, and it doesn't affect other platforms.
In addition to that, you only notice it on virtio devices mapped above the 32-bit limit...
Andrew
Reviewed-by Stefan Weil <[email protected]>I added this patch to my queue. Peter, do you still accept pull requests for 2.9? I'm still waiting for a review of another bug fix for Windows
(http://patchwork.ozlabs.org/patch/743416/). How long do I have time to get bug fixes for Windows into 2.9?
Quoted 4 lines
Of course I would not mind if you pulled this one directly (see
http://patchwork.ozlabs.org/patch/743410/).Stefan
I'm doing a pull request a bit later today - I can pick this one up if you prefer. If yes, pls send your ack.
Signature · 1 line
MST
Am 28.03.2017 um 22:11 schrieb Michael S. Tsirkin:
Quoted 3 lines
I'm doing a pull request a bit later today - I can pick this one up if you prefer. If yes, pls send your ack.
Yes, please.
Thanks a lot
Stefan