block: warn about aio=native if libaio is unavailable
v2 cover block: warn about aio=native if libaio is unavailable
v2:
* Banish CONFIG_LINUX_AIO from blockdev.c, that is raw-posix.c's business [Kevin]
* Print the warning in the same way as the aio=native,cache.direct=off deprecation warning [Kevin]
Open question: what about the Windows case? We now pass the FILE_FLAG_OVERLAPPED flag which we didn't do before for -drive aio=native.
Stefan Hajnoczi (2):
raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
blockdev: always compile in -drive aio= parsing
block/raw-posix.c | 11 ++++++++++- blockdev.c | 2 -- 2 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
2.4.3
PATCH v2 1/2 raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
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.
--- block/raw-posix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
block/raw-posix.c +10 -1
@@ -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;
Signature · 1 line
2.4.3
Re: [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
Quoted 10 lines
raw-posix.csilently ignoresBDRV_O_NATIVE_AIOif 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 <[email protected]>
had that myself on a freshly installed system without libaio-devel.
Another thing. Would it make sense to change the default to aio=native somewhen?
Quoted 30 lines
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(-)block/raw-posix.c +10
-1@@ -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;
Re: [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
Quoted 10 lines · Christian Borntraeger
Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
Quoted 9 lines
raw-posix.csilently ignoresBDRV_O_NATIVE_AIOif 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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Stefan Hajnoczi <[email protected]>had that myself on a freshly installed system without libaio-devel.
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
Quoted 28 lines
Quoted 27 lines
--- block/raw-posix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)block/raw-posix.c +10
-1@@ -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;
Re: [Qemu-devel] [PATCH v2 1/2] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
In reply to Christian BorntraegerAm 23.07.2015 um 12:09 hat Christian Borntraeger geschrieben:
Quoted 10 lines
Am 17.07.2015 um 16:23 schrieb Stefan Hajnoczi:
Quoted 9 lines
raw-posix.csilently ignoresBDRV_O_NATIVE_AIOif 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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Stefan Hajnoczi <[email protected]>had that myself on a freshly installed system without libaio-devel.
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
PATCH v2 2/2 blockdev: always compile in -drive aio= parsing
In reply to Stefan HajnocziCONFIG_LINUX_AIO is an implementation detail of raw-posix.c. Don't mention CONFIG_LINUX_AIO in blockdev.c. Let raw-posix.c decide what to do with BDRV_O_NATIVE_AIO if CONFIG_LINUX_AIO is not defined.
--- blockdev.c | 2 -- 1 file changed, 2 deletions(-)
blockdev.c +0 -2
@@ -405,7 +405,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, bdrv_flags |=BDRV_O_NO_FLUSH ; } -#ifdef CONFIG_LINUX_AIO if ((buf =qemu_opt_get (opts,"aio" )) !=NULL ) {if (!strcmp (buf,"native" )) { bdrv_flags |=BDRV_O_NATIVE_AIO ;
@@ -416,7 +415,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, goto early_err; } } -#endif if ((buf =qemu_opt_get (opts,"format" )) !=NULL ) {if (is_help_option (buf)) {
Signature · 1 line
2.4.3
Re: [Qemu-devel] [PATCH v2 2/2] blockdev: always compile in -drive aio= parsing
Quoted 2 lines · Stefan Hajnoczi
CONFIG_LINUX_AIOis an implementation detail ofraw-posix.c. Don't mentionCONFIG_LINUX_AIOinblockdev.c. Letraw-posix.cdecide what to
To be precise: "raw-posix.c or raw-win32.c", or maybe "the block driver".
Quoted 27 lines
do with
BDRV_O_NATIVE_AIOifCONFIG_LINUX_AIOis not defined.Signed-off-by Stefan Hajnoczi <[email protected]>--- blockdev.c | 2 -- 1 file changed, 2 deletions(-)blockdev.c +0
-2@@ -405,7 +405,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, bdrv_flags |=BDRV_O_NO_FLUSH ; } -#ifdef CONFIG_LINUX_AIO if ((buf =qemu_opt_get (opts,"aio" )) !=NULL ) {if (!strcmp (buf,"native" )) { bdrv_flags |=BDRV_O_NATIVE_AIO ;@@ -416,7 +415,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, goto early_err; } } -#endif if ((buf =qemu_opt_get (opts,"format" )) !=NULL ) {if (is_help_option (buf)) {
Quoted 8 lines · Stefan Hajnoczi
v2:
* BanishCONFIG_LINUX_AIOfromblockdev.c, that is raw-posix.c's business [Kevin]
* Print the warning in the same way as the aio=native,cache.direct=off deprecation warning [Kevin]Open question: what about the Windows case? We now pass the
FILE_FLAG_OVERLAPPEDflag which we didn't do before for -drive aio=native.
Odd. Commit a273652 takes the trouble to implement native asynchronous I/O there, but unless CONFIG_LINUX_AIO somehow gets defined, it's unreachable, isn't it? Paolo?
I think PATCH 2's commit message needs to be updated to discuss the impact.
Quoted 7 lines · Markus Armbruster
Quoted 7 lines
Quoted 7 lines
v2:
* BanishCONFIG_LINUX_AIOfromblockdev.c, that is raw-posix.c's business [Kevin]
* Print the warning in the same way as the aio=native,cache.direct=off deprecation warning [Kevin]
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Open question: what about the Windows case? We now pass the
FILE_FLAG_OVERLAPPEDflag which we didn't do before for -drive aio=native.Odd. Commit a273652 takes the trouble to implement native asynchronous I/O there, but unless
CONFIG_LINUX_AIOsomehow gets defined, it's unreachable, isn't it? Paolo?
I don't remember how I tested that code, but it's probably been dead code since it was committed. If it's bitrot and thus these patches break it, I will fix it.
Paolo
Quoted 2 lines
I think PATCH 2's commit message needs to be updated to discuss the impact.
Am 23.07.2015 um 10:08 hat Paolo Bonzini geschrieben:
Quoted 12 lines · Markus Armbruster
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
v2:
* BanishCONFIG_LINUX_AIOfromblockdev.c, that is raw-posix.c's business [Kevin]
* Print the warning in the same way as the aio=native,cache.direct=off deprecation warning [Kevin]Open question: what about the Windows case? We now pass the
FILE_FLAG_OVERLAPPEDflag which we didn't do before for -drive aio=native.
Quoted 7 lines
Quoted 3 lines
Odd. Commit a273652 takes the trouble to implement native asynchronous I/O there, but unless
CONFIG_LINUX_AIOsomehow gets defined, it's unreachable, isn't it? Paolo?I don't remember how I tested that code, but it's probably been dead code since it was committed. If it's bitrot and thus these patches break it, I will fix it.
The tools use a different path, so qemu-img/io would have correctly used AIO on Windows.
Kevin
Quoted 11 lines · Markus Armbruster
Quoted 8 lines · Stefan Hajnoczi
v2:
* BanishCONFIG_LINUX_AIOfromblockdev.c, that is raw-posix.c's business [Kevin]
* Print the warning in the same way as the aio=native,cache.direct=off deprecation warning [Kevin]Open question: what about the Windows case? We now pass the
FILE_FLAG_OVERLAPPEDflag which we didn't do before for -drive aio=native.
Quoted 6 lines
Odd. Commit a273652 takes the trouble to implement native asynchronous I/O there, but unless
CONFIG_LINUX_AIOsomehow gets defined, it's unreachable, isn't it? Paolo?I think PATCH 2's commit message needs to be updated to discuss the impact.
Nice find!
I'll send a v2.