qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable
@ 2015-07-23 12:48 Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO " Stefan Hajnoczi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-07-23 12:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Markus Armbruster, qemu-block

v3:
 * Fix Patch 2 commit description because the mention of raw-posix.c ignored
   Windows [Markus]
 * Drop #ifdef CONFIG_LINUX_AIO from qemu-nbd.c

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]

Stefan Hajnoczi (3):
  raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
  blockdev: always compile in -drive aio= parsing
  qemu-nbd: always compile in --aio=MODE option

 block/raw-posix.c | 11 ++++++++++-
 blockdev.c        |  2 --
 qemu-nbd.c        |  8 --------
 3 files changed, 10 insertions(+), 11 deletions(-)

-- 
2.4.3

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

* [Qemu-devel] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
  2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
@ 2015-07-23 12:48 ` Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 2/3] blockdev: always compile in -drive aio= parsing Stefan Hajnoczi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-07-23 12:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Markus Armbruster, qemu-block

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

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

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

* [Qemu-devel] [PATCH v3 2/3] blockdev: always compile in -drive aio= parsing
  2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO " Stefan Hajnoczi
@ 2015-07-23 12:48 ` Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 3/3] qemu-nbd: always compile in --aio=MODE option Stefan Hajnoczi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-07-23 12:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Markus Armbruster, qemu-block

CONFIG_LINUX_AIO is an implementation detail of raw-posix.c.  Don't
mention CONFIG_LINUX_AIO in blockdev.c.  Let block drivers decide what
to do with BDRV_O_NATIVE_AIO.  They may print an error if it is
unsupported.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 blockdev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 62a4586..37b91c8 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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)) {
-- 
2.4.3

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

* [Qemu-devel] [PATCH v3 3/3] qemu-nbd: always compile in --aio=MODE option
  2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO " Stefan Hajnoczi
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 2/3] blockdev: always compile in -drive aio= parsing Stefan Hajnoczi
@ 2015-07-23 12:48 ` Stefan Hajnoczi
  2015-07-23 14:45 ` [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Markus Armbruster
  2015-07-24 13:21 ` Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-07-23 12:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Markus Armbruster, qemu-block

The --aio=MODE option enables Linux AIO or Windows overlapped I/O.

The #ifdef CONFIG_LINUX_AIO was a layering violation that also prevented
Windows overlapped I/O from being used.

Now that raw-posix.c prints an error when Linux AIO has not been
compiled in, we can unconditionally compile the option into qemu-nbd.

After this patch qemu-nbd --aio=native works on Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 qemu-nbd.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 5106b80..a36f0f5 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -98,9 +98,7 @@ static void usage(const char *name)
 "                            '[ID_OR_NAME]'\n"
 "  -n, --nocache             disable host cache\n"
 "      --cache=MODE          set cache mode (none, writeback, ...)\n"
-#ifdef CONFIG_LINUX_AIO
 "      --aio=MODE            set AIO mode (native or threads)\n"
-#endif
 "      --discard=MODE        set discard mode (ignore, unmap)\n"
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, discard)\n"
 "\n"
@@ -429,9 +427,7 @@ int main(int argc, char **argv)
         { "load-snapshot", 1, NULL, 'l' },
         { "nocache", 0, NULL, 'n' },
         { "cache", 1, NULL, QEMU_NBD_OPT_CACHE },
-#ifdef CONFIG_LINUX_AIO
         { "aio", 1, NULL, QEMU_NBD_OPT_AIO },
-#endif
         { "discard", 1, NULL, QEMU_NBD_OPT_DISCARD },
         { "detect-zeroes", 1, NULL, QEMU_NBD_OPT_DETECT_ZEROES },
         { "shared", 1, NULL, 'e' },
@@ -450,9 +446,7 @@ int main(int argc, char **argv)
     int fd;
     bool seen_cache = false;
     bool seen_discard = false;
-#ifdef CONFIG_LINUX_AIO
     bool seen_aio = false;
-#endif
     pthread_t client_thread;
     const char *fmt = NULL;
     Error *local_err = NULL;
@@ -485,7 +479,6 @@ int main(int argc, char **argv)
                 errx(EXIT_FAILURE, "Invalid cache mode `%s'", optarg);
             }
             break;
-#ifdef CONFIG_LINUX_AIO
         case QEMU_NBD_OPT_AIO:
             if (seen_aio) {
                 errx(EXIT_FAILURE, "--aio can only be specified once");
@@ -499,7 +492,6 @@ int main(int argc, char **argv)
                errx(EXIT_FAILURE, "invalid aio mode `%s'", optarg);
             }
             break;
-#endif
         case QEMU_NBD_OPT_DISCARD:
             if (seen_discard) {
                 errx(EXIT_FAILURE, "--discard can only be specified once");
-- 
2.4.3

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

* Re: [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable
  2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 3/3] qemu-nbd: always compile in --aio=MODE option Stefan Hajnoczi
@ 2015-07-23 14:45 ` Markus Armbruster
  2015-07-24 13:21 ` Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2015-07-23 14:45 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel, qemu-block

Stefan Hajnoczi <stefanha@redhat.com> writes:

> v3:
>  * Fix Patch 2 commit description because the mention of raw-posix.c ignored
>    Windows [Markus]
>  * Drop #ifdef CONFIG_LINUX_AIO from qemu-nbd.c

No fishy uses of CONFIG_LINUX_AIO left.

Series
Reviewed-by: Markus Armbruster <armbru@redhat.com>

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

* Re: [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable
  2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2015-07-23 14:45 ` [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Markus Armbruster
@ 2015-07-24 13:21 ` Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2015-07-24 13:21 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, qemu-block, Markus Armbruster

Am 23.07.2015 um 14:48 hat Stefan Hajnoczi geschrieben:
> v3:
>  * Fix Patch 2 commit description because the mention of raw-posix.c ignored
>    Windows [Markus]
>  * Drop #ifdef CONFIG_LINUX_AIO from qemu-nbd.c
> 
> 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]

Thanks, applied to my block-next branch for 2.5.

Kevin

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

end of thread, other threads:[~2015-07-24 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 12:48 [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Stefan Hajnoczi
2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 1/3] raw-posix: warn about BDRV_O_NATIVE_AIO " Stefan Hajnoczi
2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 2/3] blockdev: always compile in -drive aio= parsing Stefan Hajnoczi
2015-07-23 12:48 ` [Qemu-devel] [PATCH v3 3/3] qemu-nbd: always compile in --aio=MODE option Stefan Hajnoczi
2015-07-23 14:45 ` [Qemu-devel] [PATCH v3 0/3] block: warn about aio=native if libaio is unavailable Markus Armbruster
2015-07-24 13:21 ` 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).