All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows
@ 2017-03-24 23:19 Andrew Baumann
  2017-03-28 18:38 ` [Qemu-devel] [PATCH v3 for-2.9?] " Stefan Weil
  2017-03-28 20:09 ` [Qemu-devel] [PATCH v3] " Michael S. Tsirkin
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Baumann @ 2017-03-24 23:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Blake, Stefan Weil, Michael S . Tsirkin, 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_UP macro which does not suffer the same problem

Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 include/hw/virtio/virtio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 15efcf2..7b6edba 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -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;
-- 
2.8.3

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

* Re: [Qemu-devel] [PATCH v3 for-2.9?] virtio: fix vring_align() on 64-bit windows
  2017-03-24 23:19 [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows Andrew Baumann
@ 2017-03-28 18:38 ` Stefan Weil
  2017-03-28 18:51   ` Eric Blake
  2017-03-28 19:12   ` [Qemu-devel] [PATCH v3 for-2.9?] " Philippe Mathieu-Daudé
  2017-03-28 20:09 ` [Qemu-devel] [PATCH v3] " Michael S. Tsirkin
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Weil @ 2017-03-28 18:38 UTC (permalink / raw)
  To: Andrew Baumann, qemu-devel; +Cc: Eric Blake, Michael S . Tsirkin, Peter Maydell

Am 25.03.2017 um 00:19 schrieb 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_UP macro which does not suffer the same problem
>
> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  include/hw/virtio/virtio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 15efcf2..7b6edba 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -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

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

* Re: [Qemu-devel] [PATCH v3 for-2.9?] virtio: fix vring_align() on 64-bit windows
  2017-03-28 18:38 ` [Qemu-devel] [PATCH v3 for-2.9?] " Stefan Weil
@ 2017-03-28 18:51   ` Eric Blake
  2017-03-28 18:56     ` Andrew Baumann
  2017-03-28 19:12   ` [Qemu-devel] [PATCH v3 for-2.9?] " Philippe Mathieu-Daudé
  1 sibling, 1 reply; 10+ messages in thread
From: Eric Blake @ 2017-03-28 18:51 UTC (permalink / raw)
  To: Stefan Weil, Andrew Baumann, qemu-devel
  Cc: Michael S . Tsirkin, Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

On 03/28/2017 01:38 PM, Stefan Weil wrote:
> Am 25.03.2017 um 00:19 schrieb 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_UP macro which does not suffer the same problem
>>
>> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> ---

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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH v3 for-2.9?] virtio: fix vring_align() on 64-bit windows
  2017-03-28 18:51   ` Eric Blake
@ 2017-03-28 18:56     ` Andrew Baumann
  2017-03-28 19:25       ` Stefan Weil
  2017-03-28 20:02       ` [Qemu-devel] [PATCH v3 for-2.9] " Stefan Weil
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Baumann @ 2017-03-28 18:56 UTC (permalink / raw)
  To: Eric Blake, Stefan Weil, qemu-devel; +Cc: Michael S . Tsirkin, Peter Maydell

> From: Eric Blake [mailto:eblake@redhat.com]
> Sent: Tuesday, 28 March 2017 11:52
> 
> On 03/28/2017 01:38 PM, Stefan Weil wrote:
> > Am 25.03.2017 um 00:19 schrieb 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_UP macro which does not suffer the same problem
> >>
> >> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> >> Reviewed-by: Eric Blake <eblake@redhat.com>
> >> ---
> 
> > 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.

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

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

* Re: [Qemu-devel] [PATCH v3 for-2.9?] virtio: fix vring_align() on 64-bit windows
  2017-03-28 18:38 ` [Qemu-devel] [PATCH v3 for-2.9?] " Stefan Weil
  2017-03-28 18:51   ` Eric Blake
@ 2017-03-28 19:12   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-03-28 19:12 UTC (permalink / raw)
  To: Andrew Baumann, Peter Maydell
  Cc: Stefan Weil, qemu-devel, Michael S . Tsirkin

Hi, I never received Andrew Baumann's mail via the ML...

On 03/28/2017 03:38 PM, Stefan Weil wrote:
> Am 25.03.2017 um 00:19 schrieb QEMU_ALIGN_UP:
>> 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
>>
>> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> ---
>>  include/hw/virtio/virtio.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
>> index 15efcf2..7b6edba 100644
>> --- a/include/hw/virtio/virtio.h
>> +++ b/include/hw/virtio/virtio.h
>> @@ -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
>
>

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

* Re: [Qemu-devel] [PATCH v3 for-2.9?] virtio: fix vring_align() on 64-bit windows
  2017-03-28 18:56     ` Andrew Baumann
@ 2017-03-28 19:25       ` Stefan Weil
  2017-03-28 20:02       ` [Qemu-devel] [PATCH v3 for-2.9] " Stefan Weil
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Weil @ 2017-03-28 19:25 UTC (permalink / raw)
  To: Andrew Baumann, Eric Blake, qemu-devel; +Cc: Michael S . Tsirkin, Peter Maydell

Am 28.03.2017 um 20:56 schrieb Andrew Baumann:
>> From: Eric Blake [mailto:eblake@redhat.com]
>>> 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.
>
>>> 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

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

* Re: [Qemu-devel] [PATCH v3 for-2.9] virtio: fix vring_align() on 64-bit windows
  2017-03-28 18:56     ` Andrew Baumann
  2017-03-28 19:25       ` Stefan Weil
@ 2017-03-28 20:02       ` Stefan Weil
  2017-03-28 20:11         ` Michael S. Tsirkin
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Weil @ 2017-03-28 20:02 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Andrew Baumann, Eric Blake, qemu-devel, Michael S . Tsirkin

Am 28.03.2017 um 20:56 schrieb Andrew Baumann:
>> From: Eric Blake [mailto:eblake@redhat.com]
>> Sent: Tuesday, 28 March 2017 11:52
>>
>> On 03/28/2017 01:38 PM, Stefan Weil wrote:
>>> Am 25.03.2017 um 00:19 schrieb 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_UP macro which does not suffer the same problem
>>>>
>>>> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
>>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>>> ---
>>
>>> 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.
>
>>> 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
>

Reviewed-by: Stefan Weil <sw@weilnetz.de>

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

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

* Re: [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows
  2017-03-24 23:19 [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows Andrew Baumann
  2017-03-28 18:38 ` [Qemu-devel] [PATCH v3 for-2.9?] " Stefan Weil
@ 2017-03-28 20:09 ` Michael S. Tsirkin
  1 sibling, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2017-03-28 20:09 UTC (permalink / raw)
  To: Andrew Baumann; +Cc: qemu-devel, Eric Blake, Stefan Weil

On Fri, Mar 24, 2017 at 04:19:43PM -0700, Andrew Baumann wrote:
> 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
> 
> Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  include/hw/virtio/virtio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 15efcf2..7b6edba 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -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;
> -- 
> 2.8.3

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

* Re: [Qemu-devel] [PATCH v3 for-2.9] virtio: fix vring_align() on 64-bit windows
  2017-03-28 20:02       ` [Qemu-devel] [PATCH v3 for-2.9] " Stefan Weil
@ 2017-03-28 20:11         ` Michael S. Tsirkin
  2017-03-28 20:19           ` Stefan Weil
  0 siblings, 1 reply; 10+ messages in thread
From: Michael S. Tsirkin @ 2017-03-28 20:11 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Peter Maydell, Andrew Baumann, Eric Blake, qemu-devel

On Tue, Mar 28, 2017 at 10:02:10PM +0200, Stefan Weil wrote:
> Am 28.03.2017 um 20:56 schrieb Andrew Baumann:
> > > From: Eric Blake [mailto:eblake@redhat.com]
> > > Sent: Tuesday, 28 March 2017 11:52
> > > 
> > > On 03/28/2017 01:38 PM, Stefan Weil wrote:
> > > > Am 25.03.2017 um 00:19 schrieb 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_UP macro which does not suffer the same problem
> > > > > 
> > > > > Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> > > > > Reviewed-by: Eric Blake <eblake@redhat.com>
> > > > > ---
> > > 
> > > > 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.
> > 
> > > > 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
> > 
> 
> Reviewed-by: Stefan Weil <sw@weilnetz.de>
> 
> 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

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.

-- 
MST

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

* Re: [Qemu-devel] [PATCH v3 for-2.9] virtio: fix vring_align() on 64-bit windows
  2017-03-28 20:11         ` Michael S. Tsirkin
@ 2017-03-28 20:19           ` Stefan Weil
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Weil @ 2017-03-28 20:19 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Peter Maydell, Andrew Baumann, Eric Blake, qemu-devel

Am 28.03.2017 um 22:11 schrieb Michael S. Tsirkin:

> 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

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

end of thread, other threads:[~2017-03-28 20:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 23:19 [Qemu-devel] [PATCH v3] virtio: fix vring_align() on 64-bit windows Andrew Baumann
2017-03-28 18:38 ` [Qemu-devel] [PATCH v3 for-2.9?] " Stefan Weil
2017-03-28 18:51   ` Eric Blake
2017-03-28 18:56     ` Andrew Baumann
2017-03-28 19:25       ` Stefan Weil
2017-03-28 20:02       ` [Qemu-devel] [PATCH v3 for-2.9] " Stefan Weil
2017-03-28 20:11         ` Michael S. Tsirkin
2017-03-28 20:19           ` Stefan Weil
2017-03-28 19:12   ` [Qemu-devel] [PATCH v3 for-2.9?] " Philippe Mathieu-Daudé
2017-03-28 20:09 ` [Qemu-devel] [PATCH v3] " Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.