diff mbox

[v2,1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

Message ID 1437143029-12100-2-git-send-email-stefanha@redhat.com
State New
Headers show

Commit Message

Stefan Hajnoczi July 17, 2015, 2:23 p.m. UTC
raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
It is confusing when aio=native performance is identical to aio=threads
because the binary was accidentally built without libaio.

Print a deprecation warning if -drive aio=native is used with a binary
that does not support libaio.  There are probably users using aio=native
who would be inconvenienced if QEMU suddenly refused to start their
guests.  In the future this will become an error.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/raw-posix.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Christian Borntraeger July 23, 2015, 10:09 a.m. UTC | #1
Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
> raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
> It is confusing when aio=native performance is identical to aio=threads
> because the binary was accidentally built without libaio.
> 
> Print a deprecation warning if -drive aio=native is used with a binary
> that does not support libaio.  There are probably users using aio=native
> who would be inconvenienced if QEMU suddenly refused to start their
> guests.  In the future this will become an error.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

had that myself on a freshly installed system without libaio-devel.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>


Another thing. Would it make sense to change the default to aio=native somewhen?
From what I can tell this seems to outperform aio=threads in most cases.


> ---
>  block/raw-posix.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 855febe..e09019c 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -519,7 +519,16 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
>                       "future QEMU versions.\n",
>                       bs->filename);
>      }
> -#endif
> +#else
> +    if (bdrv_flags & BDRV_O_NATIVE_AIO) {
> +        error_printf("WARNING: aio=native was specified for '%s', but "
> +                     "is not supported in this build. Falling back to "
> +                     "aio=threads.\n"
> +                     "         This will become an error condition in "
> +                     "future QEMU versions.\n",
> +                     bs->filename);
> +    }
> +#endif /* !defined(CONFIG_LINUX_AIO) */
> 
>      s->has_discard = true;
>      s->has_write_zeroes = true;
>
Denis V. Lunev July 23, 2015, 10:11 a.m. UTC | #2
On 07/23/2015 01:09 PM, Christian Borntraeger wrote:
> Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
>> raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
>> It is confusing when aio=native performance is identical to aio=threads
>> because the binary was accidentally built without libaio.
>>
>> Print a deprecation warning if -drive aio=native is used with a binary
>> that does not support libaio.  There are probably users using aio=native
>> who would be inconvenienced if QEMU suddenly refused to start their
>> guests.  In the future this will become an error.
>>
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> had that myself on a freshly installed system without libaio-devel.
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
>
>
> Another thing. Would it make sense to change the default to aio=native somewhen?
>  From what I can tell this seems to outperform aio=threads in most cases.
>

this seems a good idea to me, we are always changing
from threads to native in our installations

>> ---
>>   block/raw-posix.c | 11 ++++++++++-
>>   1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/raw-posix.c b/block/raw-posix.c
>> index 855febe..e09019c 100644
>> --- a/block/raw-posix.c
>> +++ b/block/raw-posix.c
>> @@ -519,7 +519,16 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
>>                        "future QEMU versions.\n",
>>                        bs->filename);
>>       }
>> -#endif
>> +#else
>> +    if (bdrv_flags & BDRV_O_NATIVE_AIO) {
>> +        error_printf("WARNING: aio=native was specified for '%s', but "
>> +                     "is not supported in this build. Falling back to "
>> +                     "aio=threads.\n"
>> +                     "         This will become an error condition in "
>> +                     "future QEMU versions.\n",
>> +                     bs->filename);
>> +    }
>> +#endif /* !defined(CONFIG_LINUX_AIO) */
>>
>>       s->has_discard = true;
>>       s->has_write_zeroes = true;
>>
>
Kevin Wolf July 23, 2015, 11:58 a.m. UTC | #3
Am 23.07.2015 um 12:09 hat Christian Borntraeger geschrieben:
> Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
> > raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
> > It is confusing when aio=native performance is identical to aio=threads
> > because the binary was accidentally built without libaio.
> > 
> > Print a deprecation warning if -drive aio=native is used with a binary
> > that does not support libaio.  There are probably users using aio=native
> > who would be inconvenienced if QEMU suddenly refused to start their
> > guests.  In the future this will become an error.
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> had that myself on a freshly installed system without libaio-devel.
> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> 
> Another thing. Would it make sense to change the default to aio=native somewhen?
> From what I can tell this seems to outperform aio=threads in most cases.

aio=native requires cache.direct=on, which is not portable to all
platforms that qemu supports, and also doesn't work with all filesystems
on Linux (most notably tmpfs fails). Also recent benchmarks seem to
suggest that currently there is no clear winner between aio=native and
aio=threads, it depends too much on the host storage and the workload.

When we discussed the default cache mode a while back (with the options
cache=writeback and cache=none), it was considered more important to
have a default setting that works everywhere and performs good for quick
ad-hoc VMs and development/debugging work than one that performs best in
enterprise setups that should use a management tool anyway.

Kevin
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 855febe..e09019c 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -519,7 +519,16 @@  static int raw_open_common(BlockDriverState *bs, QDict *options,
                      "future QEMU versions.\n",
                      bs->filename);
     }
-#endif
+#else
+    if (bdrv_flags & BDRV_O_NATIVE_AIO) {
+        error_printf("WARNING: aio=native was specified for '%s', but "
+                     "is not supported in this build. Falling back to "
+                     "aio=threads.\n"
+                     "         This will become an error condition in "
+                     "future QEMU versions.\n",
+                     bs->filename);
+    }
+#endif /* !defined(CONFIG_LINUX_AIO) */
 
     s->has_discard = true;
     s->has_write_zeroes = true;