Skip to contentSkip to conversation

blockdev: warn about aio=native if libaio is unavailable

PATCH Superseded Stefan Hajnoczi 2 participants 3 messages Jul 17, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blockdev: warn about aio=native if libaio is unavailable

QEMU silently ignores aio=native if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without libaio.

Use error_report() because failing would break backward compatibility. There are probably users using aio=native who would be inconvenienced if QEMU suddenly refused to start their guests.

---
 blockdev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
blockdev.c +5 -2
index 62a4586..f30828a 100644
@@ -405,10 +405,14 @@ 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")) {
+#ifdef CONFIG_LINUX_AIO
             bdrv_flags |= BDRV_O_NATIVE_AIO;
+#else
+            error_report("warning: aio=native support unavailable, "
+                         "using default instead");
+#endif
         } else if (!strcmp(buf, "threads")) {
             /* this is the default */
         } else {
@@ -416,7 +420,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
#1 lore raw

Am 17.07.2015 um 11:59 hat Stefan Hajnoczi geschrieben:

Quoted 9 lines

QEMU silently ignores aio=native if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without libaio.

Use error_report() because failing would break backward compatibility. There are probably users using aio=native who would be inconvenienced if QEMU suddenly refused to start their guests.

I hope not too many people are using aio=native without having libaio compiled in... Can we make it a message like for the case with aio=native,cache.direct=off, i.e. a deprecation warning that allows us to make this an error in a few releases?

Quoted 24 lines
 blockdev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
blockdev.c +5 -1
index 62a4586..f30828a 100644
@@ -405,10 +405,14 @@ 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")) {
+#ifdef CONFIG_LINUX_AIO
             bdrv_flags |= BDRV_O_NATIVE_AIO;
+#else
+            error_report("warning: aio=native support unavailable, "
+                         "using default instead");
+#endif
         } else if (!strcmp(buf, "threads")) {
             /* this is the default */
         } else {

blockdev.c static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, · line 419

Quoted 4 lines
blockdev.c +0 -1
@@ -416,7 +420,6 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
            goto early_err;
         }
     }
-#endif

*sigh* It's sad to see that we still have such code in the generic block layer. It has no business there, the raw-posix driver should check whether it can support Linux AIO or not.

Paolo: You added some code to raw-win32 that implements aio=native. Did it ever work in qemu proper, or only in the tools? It doesn't seem that this code would even have added the flag on Windows builds.

Kevin

#2 lore raw
Quoted 9 lines · Kevin Wolf

Am 17.07.2015 um 11:59 hat Stefan Hajnoczi geschrieben:

Quoted 8 lines

QEMU silently ignores aio=native if libaio is unavailable. It is confusing when aio=native performance is identical to aio=threads because the binary was accidentally built without libaio.

Use error_report() because failing would break backward compatibility. There are probably users using aio=native who would be inconvenienced if QEMU suddenly refused to start their guests.

Quoted 6 lines
Quoted 1 line

I hope not too many people are using aio=native without having libaio compiled in... Can we make it a message like for the case with aio=native,cache.direct=off, i.e. a deprecation warning that allows us to make this an error in a few releases?

Yes, I'll move the warning to raw-posix.c so all callers benefit from it.