qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] win32-aio fixes
@ 2013-01-16 20:19 Kevin Wolf
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Wolf @ 2013-01-16 20:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, stefanha

Paolo, especially the first one is worrying with respect to the test status of
this code. We should probably give it some additional testing.

Kevin Wolf (2):
  win32-aio: Fix vectored reads
  win32-aio: Fix memory leak

 block/win32-aio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.7.6.5

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

* [Qemu-devel] [PATCH 0/2] win32-aio fixes
@ 2013-01-16 20:19 Kevin Wolf
  2013-01-16 20:19 ` [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads Kevin Wolf
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Kevin Wolf @ 2013-01-16 20:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, qemu-stable, stefanha

Paolo, especially the first one is worrying with respect to the test status of
this code. We should probably give it some additional testing.

Kevin Wolf (2):
  win32-aio: Fix vectored reads
  win32-aio: Fix memory leak

 block/win32-aio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.7.6.5

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

* [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads
  2013-01-16 20:19 [Qemu-devel] [PATCH 0/2] win32-aio fixes Kevin Wolf
@ 2013-01-16 20:19 ` Kevin Wolf
  2013-01-17  8:33   ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
  2013-01-16 20:20 ` [Qemu-devel] [PATCH 2/2] win32-aio: Fix memory leak Kevin Wolf
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Kevin Wolf @ 2013-01-16 20:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, qemu-stable, stefanha

Copying data in the right direction really helps a lot!

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/win32-aio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/win32-aio.c b/block/win32-aio.c
index 46a5db7..53b82e6 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -84,7 +84,7 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
             int i;
 
             for (i = 0; i < qiov->niov; ++i) {
-                memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
+                memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
                 p += qiov->iov[i].iov_len;
             }
             g_free(waiocb->buf);
-- 
1.7.6.5

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

* [Qemu-devel] [PATCH 2/2] win32-aio: Fix memory leak
  2013-01-16 20:19 [Qemu-devel] [PATCH 0/2] win32-aio fixes Kevin Wolf
  2013-01-16 20:19 ` [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads Kevin Wolf
@ 2013-01-16 20:20 ` Kevin Wolf
  2013-01-17  9:59 ` [Qemu-devel] [PATCH 0/2] win32-aio fixes Stefan Hajnoczi
  2013-01-17 10:53 ` Paolo Bonzini
  3 siblings, 0 replies; 10+ messages in thread
From: Kevin Wolf @ 2013-01-16 20:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, qemu-stable, stefanha

The buffer is allocated for both reads and writes, and obviously it
should be freed even if an error occurs.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/win32-aio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/win32-aio.c b/block/win32-aio.c
index 53b82e6..546a60d 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -87,8 +87,8 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
                 memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
                 p += qiov->iov[i].iov_len;
             }
-            g_free(waiocb->buf);
         }
+        g_free(waiocb->buf);
     }
 
 
-- 
1.7.6.5

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] win32-aio: Fix vectored reads
  2013-01-16 20:19 ` [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads Kevin Wolf
@ 2013-01-17  8:33   ` Michael Tokarev
  2013-01-17  8:43     ` Kevin Wolf
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Tokarev @ 2013-01-17  8:33 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: pbonzini, qemu-devel, stefanha, qemu-stable

17.01.2013 00:19, Kevin Wolf пишет:
> Copying data in the right direction really helps a lot!
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>   block/win32-aio.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/block/win32-aio.c b/block/win32-aio.c
> index 46a5db7..53b82e6 100644
> --- a/block/win32-aio.c
> +++ b/block/win32-aio.c
> @@ -84,7 +84,7 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
>               int i;
>
>               for (i = 0; i < qiov->niov; ++i) {
> -                memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
> +                memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
>                   p += qiov->iov[i].iov_len;
>               }
>               g_free(waiocb->buf);

Actually this is just

    iov_from_buf(qiov->iov, qiov->niov, 0, waiocb->buf, -1);

Or is it iov_to_buf() ? :)

Thanks,

/mjt

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] win32-aio: Fix vectored reads
  2013-01-17  8:33   ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
@ 2013-01-17  8:43     ` Kevin Wolf
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Wolf @ 2013-01-17  8:43 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: pbonzini, qemu-devel, stefanha, qemu-stable

Am 17.01.2013 09:33, schrieb Michael Tokarev:
> 17.01.2013 00:19, Kevin Wolf пишет:
>> Copying data in the right direction really helps a lot!
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>>   block/win32-aio.c |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/block/win32-aio.c b/block/win32-aio.c
>> index 46a5db7..53b82e6 100644
>> --- a/block/win32-aio.c
>> +++ b/block/win32-aio.c
>> @@ -84,7 +84,7 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
>>               int i;
>>
>>               for (i = 0; i < qiov->niov; ++i) {
>> -                memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
>> +                memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
>>                   p += qiov->iov[i].iov_len;
>>               }
>>               g_free(waiocb->buf);
> 
> Actually this is just
> 
>     iov_from_buf(qiov->iov, qiov->niov, 0, waiocb->buf, -1);

True. Let's keep fix and cleanup separate, though. Feel free to send a
cleanup patch on top of this.

By the way, I think qiov->size instead of -1 would be nicer.

> Or is it iov_to_buf() ? :)

The corrected version is from.

Kevin

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

* Re: [Qemu-devel] [PATCH 0/2] win32-aio fixes
  2013-01-16 20:19 [Qemu-devel] [PATCH 0/2] win32-aio fixes Kevin Wolf
  2013-01-16 20:19 ` [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads Kevin Wolf
  2013-01-16 20:20 ` [Qemu-devel] [PATCH 2/2] win32-aio: Fix memory leak Kevin Wolf
@ 2013-01-17  9:59 ` Stefan Hajnoczi
  2013-01-17 10:53 ` Paolo Bonzini
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2013-01-17  9:59 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: pbonzini, qemu-devel, qemu-stable

On Wed, Jan 16, 2013 at 09:19:58PM +0100, Kevin Wolf wrote:
> Paolo, especially the first one is worrying with respect to the test status of
> this code. We should probably give it some additional testing.
> 
> Kevin Wolf (2):
>   win32-aio: Fix vectored reads
>   win32-aio: Fix memory leak
> 
>  block/win32-aio.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> -- 
> 1.7.6.5
> 

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

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

* Re: [Qemu-devel] [PATCH 0/2] win32-aio fixes
  2013-01-16 20:19 [Qemu-devel] [PATCH 0/2] win32-aio fixes Kevin Wolf
                   ` (2 preceding siblings ...)
  2013-01-17  9:59 ` [Qemu-devel] [PATCH 0/2] win32-aio fixes Stefan Hajnoczi
@ 2013-01-17 10:53 ` Paolo Bonzini
  2013-01-17 11:35   ` Kevin Wolf
  3 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2013-01-17 10:53 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, stefanha, qemu-stable

Il 16/01/2013 21:19, Kevin Wolf ha scritto:
> Paolo, especially the first one is worrying with respect to the test status of
> this code. We should probably give it some additional testing.
> 
> Kevin Wolf (2):
>   win32-aio: Fix vectored reads
>   win32-aio: Fix memory leak
> 
>  block/win32-aio.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 

Yes, the worrying part is especially that IIUC qtest does not support
Windows.  There's no way to get good coverage without qtest.

Paolo

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

* Re: [Qemu-devel] [PATCH 0/2] win32-aio fixes
  2013-01-17 10:53 ` Paolo Bonzini
@ 2013-01-17 11:35   ` Kevin Wolf
  2013-01-17 11:37     ` Paolo Bonzini
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Wolf @ 2013-01-17 11:35 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, stefanha, qemu-stable

Am 17.01.2013 11:53, schrieb Paolo Bonzini:
> Il 16/01/2013 21:19, Kevin Wolf ha scritto:
>> Paolo, especially the first one is worrying with respect to the test status of
>> this code. We should probably give it some additional testing.
>>
>> Kevin Wolf (2):
>>   win32-aio: Fix vectored reads
>>   win32-aio: Fix memory leak
>>
>>  block/win32-aio.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
> 
> Yes, the worrying part is especially that IIUC qtest does not support
> Windows.  There's no way to get good coverage without qtest.

Why that? If block drivers aren't testable from qemu-iotests with only
qemu-img and qemu-io, then there's something we did wrong. This specific
code would have been easily covered with qemu-io -k -n -c 'readv ...'
(which is how I found the bug and tested the fix).

Hm, or actually, is cache=none even needed for aio=native on Windows? In
any case I think some documentation needs to be updated.

qemu-iotests under Wine may need some polishing, though, and of course
needs someone to run it regularly with the right parameters. (In fact,
it seems we don't even run the tests with Linux AIO)

Kevin

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

* Re: [Qemu-devel] [PATCH 0/2] win32-aio fixes
  2013-01-17 11:35   ` Kevin Wolf
@ 2013-01-17 11:37     ` Paolo Bonzini
  0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2013-01-17 11:37 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, stefanha, qemu-stable

Il 17/01/2013 12:35, Kevin Wolf ha scritto:
> Am 17.01.2013 11:53, schrieb Paolo Bonzini:
>> Il 16/01/2013 21:19, Kevin Wolf ha scritto:
>>> Paolo, especially the first one is worrying with respect to the test status of
>>> this code. We should probably give it some additional testing.
>>>
>>> Kevin Wolf (2):
>>>   win32-aio: Fix vectored reads
>>>   win32-aio: Fix memory leak
>>>
>>>  block/win32-aio.c |    4 ++--
>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>
>> Yes, the worrying part is especially that IIUC qtest does not support
>> Windows.  There's no way to get good coverage without qtest.
> 
> Why that? If block drivers aren't testable from qemu-iotests with only
> qemu-img and qemu-io, then there's something we did wrong. This specific
> code would have been easily covered with qemu-io -k -n -c 'readv ...'
> (which is how I found the bug and tested the fix).

Doh, that was really stupid.

/me unsuccessfully tries to blame flu

> Hm, or actually, is cache=none even needed for aio=native on Windows? In
> any case I think some documentation needs to be updated.

Honestly I have no idea.  However, I don't think so.

Paolo

> qemu-iotests under Wine may need some polishing, though, and of course
> needs someone to run it regularly with the right parameters. (In fact,
> it seems we don't even run the tests with Linux AIO)

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

end of thread, other threads:[~2013-01-17 12:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-16 20:19 [Qemu-devel] [PATCH 0/2] win32-aio fixes Kevin Wolf
2013-01-16 20:19 ` [Qemu-devel] [PATCH 1/2] win32-aio: Fix vectored reads Kevin Wolf
2013-01-17  8:33   ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
2013-01-17  8:43     ` Kevin Wolf
2013-01-16 20:20 ` [Qemu-devel] [PATCH 2/2] win32-aio: Fix memory leak Kevin Wolf
2013-01-17  9:59 ` [Qemu-devel] [PATCH 0/2] win32-aio fixes Stefan Hajnoczi
2013-01-17 10:53 ` Paolo Bonzini
2013-01-17 11:35   ` Kevin Wolf
2013-01-17 11:37     ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2013-01-16 20:19 Kevin Wolf

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