1. 01 10月, 2018 9 次提交
    • A
      block: Allow changing 'discard' on reopen · 593b3071
      Alberto Garcia 提交于
      'discard' is one of the basic BlockdevOptions available for all
      drivers, but it's not handled by bdrv_reopen_prepare() so any attempt
      to change it results in an error:
      
         (qemu) qemu-io virtio0 "reopen -o discard=on"
         Cannot change the option 'discard'
      
      Since there's no reason why we shouldn't allow changing it and the
      implementation is simple let's just do it.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      593b3071
    • A
      file-posix: Forbid trying to change unsupported options during reopen · 8d324575
      Alberto Garcia 提交于
      The file-posix code is used for the "file", "host_device" and
      "host_cdrom" drivers, and it allows reopening images. However the only
      option that is actually processed is "x-check-cache-dropped", and
      changes in all other options (e.g. "filename") are silently ignored:
      
         (qemu) qemu-io virtio0 "reopen -o file.filename=no-such-file"
      
      While we could allow changing some of the other options, let's keep
      things as they are for now but return an error if the user tries to
      change any of them.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      8d324575
    • A
      block: Forbid trying to change unsupported options during reopen · 57f9db9a
      Alberto Garcia 提交于
      The bdrv_reopen_prepare() function checks all options passed to each
      BlockDriverState (in the reopen_state->options QDict) and makes all
      necessary preparations to apply the option changes requested by the
      user.
      
      Options are removed from the QDict as they are processed, so at the
      end of bdrv_reopen_prepare() only the options that can't be changed
      are left. Then a loop goes over all remaining options and verifies
      that the old and new values are identical, returning an error if
      they're not.
      
      The problem is that at the moment there are options that are removed
      from the QDict although they can't be changed. The consequence of this
      is any modification to any of those options is silently ignored:
      
         (qemu) qemu-io virtio0 "reopen -o discard=on"
      
      This happens when all options from bdrv_runtime_opts are removed
      from the QDict but then only a few of them are processed. Since
      it's especially important that "node-name" and "driver" are not
      changed, the code puts them back into the QDict so they are checked
      at the end of the function. Instead of putting only those two options
      back into the QDict, this patch puts all unprocessed options using
      qemu_opts_to_qdict().
      
      update_flags_from_options() also needs to be modified to prevent
      BDRV_OPT_CACHE_NO_FLUSH, BDRV_OPT_CACHE_DIRECT and BDRV_OPT_READ_ONLY
      from going back to the QDict.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      57f9db9a
    • A
      block: Allow child references on reopen · db905283
      Alberto Garcia 提交于
      In the previous patches we removed all child references from
      bs->{options,explicit_options} because keeping them is useless and
      wrong.
      
      Because of this, any attempt to reopen a BlockDriverState using a
      child reference as one of its options would result in a failure,
      because bdrv_reopen_prepare() would detect that there's a new option
      (the child reference) that wasn't present in bs->options.
      
      But passing child references on reopen can be useful. It's a way to
      specify a BDS's child without having to pass recursively all of the
      child's options, and if the reference points to a different BDS then
      this can allow us to replace the child.
      
      However, replacing the child is something that needs to be implemented
      case by case and only when it makes sense. For now, this patch allows
      passing a child reference as long as it points to the current child of
      the BlockDriverState.
      
      It's also important to remember that, as a consequence of the
      previous patches, this child reference will be removed from
      bs->{options,explicit_options} after the reopening has been completed.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      db905283
    • A
      block: Don't look for child references in append_open_options() · a600aadd
      Alberto Garcia 提交于
      In the previous patch we removed child references from bs->options, so
      there's no need to look for them here anymore.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a600aadd
    • A
      block: Remove child references from bs->{options,explicit_options} · 50196d7a
      Alberto Garcia 提交于
      Block drivers allow opening their children using a reference to an
      existing BlockDriverState. These references remain stored in the
      'options' and 'explicit_options' QDicts, but we don't need to keep
      them once everything is open.
      
      What is more important, these values can become wrong if the children
      change:
      
          $ qemu-img create -f qcow2 hd0.qcow2 10M
          $ qemu-img create -f qcow2 hd1.qcow2 10M
          $ qemu-img create -f qcow2 hd2.qcow2 10M
          $ $QEMU -drive if=none,file=hd0.qcow2,node-name=hd0 \
                  -drive if=none,file=hd1.qcow2,node-name=hd1,backing=hd0 \
                  -drive file=hd2.qcow2,node-name=hd2,backing=hd1
      
      After this hd2 has hd1 as its backing file. Now let's remove it using
      block_stream:
      
          (qemu) block_stream hd2 0 hd0.qcow2
      
      Now hd0 is the backing file of hd2, but hd2's options QDicts still
      contain backing=hd1.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      50196d7a
    • A
      file-posix: x-check-cache-dropped should default to false on reopen · 589f20dc
      Alberto Garcia 提交于
      The default value of x-check-cache-dropped is false. There's no reason
      to use the previous value as a default in raw_reopen_prepare() because
      bdrv_reopen_queue_child() already takes care of putting the old
      options in the BDRVReopenState.options QDict.
      
      If x-check-cache-dropped was previously set but is now missing from
      the reopen QDict then it should be reset to false.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      589f20dc
    • A
      qemu-io: Fix writethrough check in reopen · a8003ec4
      Alberto Garcia 提交于
      "qemu-io reopen" doesn't allow changing the writethrough setting of
      the cache, but the check is wrong, causing an error even on a simple
      reopen with the default parameters:
      
         $ qemu-img create -f qcow2 hd.qcow2 1M
         $ qemu-system-x86_64 -monitor stdio -drive if=virtio,file=hd.qcow2
         (qemu) qemu-io virtio0 reopen
         Cannot change cache.writeback: Device attached
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a8003ec4
    • F
      file-posix: Include filename in locking error message · b857431d
      Fam Zheng 提交于
      Image locking errors happening at device initialization time doesn't say
      which file cannot be locked, for instance,
      
          -device scsi-disk,drive=drive-1: Failed to get shared "write" lock
          Is another process using the image?
      
      could refer to either the overlay image or its backing image.
      
      Hoist the error_append_hint to the caller of raw_check_lock_bytes where
      file name is known, and include it in the error hint.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b857431d
  2. 29 9月, 2018 2 次提交
    • P
      Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180926' into staging · 07f426c3
      Peter Maydell 提交于
      Queued tcg patches
      
      # gpg: Signature made Wed 26 Sep 2018 19:27:22 BST
      # gpg:                using RSA key 64DF38E8AF7E215F
      # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
      # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F
      
      * remotes/rth/tags/pull-tcg-20180926:
        tcg/i386: fix vector operations on 32-bit hosts
        qht-bench: add -p flag to precompute hash values
        qht: constify arguments to some internal functions
        qht: constify qht_statistics_init
        qht: constify qht_lookup
        qht: fix comment in qht_bucket_remove_entry
        qht: drop ht argument from qht iterators
        test-qht: speed up + test qht_resize
        test-qht: test deletion of the last entry in a bucket
        test-qht: test removal of non-existent entries
        test-qht: test qht_iter_remove
        qht: add qht_iter_remove
        qht: remove unused map param from qht_remove__locked
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      07f426c3
    • P
      Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180926a' into staging · 042938f4
      Peter Maydell 提交于
      Migration pull 2018-09-26
      
      This supercedes Juan's pull from the 13th
      
      # gpg: Signature made Wed 26 Sep 2018 18:07:30 BST
      # gpg:                using RSA key 0516331EBC5BFDE7
      # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
      # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7
      
      * remotes/dgilbert/tags/pull-migration-20180926a:
        migration/ram.c: Avoid taking address of fields in packed MultiFDInit_t struct
        migration: fix the compression code
        migration: fix QEMUFile leak
        tests/migration: Speed up the test on ppc64
        migration: cleanup in error paths in loadvm
        migration/postcopy: Clear have_listen_thread
        tests/migration: Add migration-test header file
        tests/migration: Support cross compilation in generating boot header file
        tests/migration: Convert x86 boot block compilation script into Makefile
        migration: use save_page_use_compression in flush_compressed_data
        migration: show the statistics of compression
        migration: do not flush_compressed_data at the end of iteration
        Add a hint message to loadvm and exits on failure
        migration: handle the error condition properly
        migration: fix calculating xbzrle_counters.cache_miss_rate
        migration/rdma: Fix uninitialised rdma_return_path
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      042938f4
  3. 28 9月, 2018 3 次提交
    • P
      Merge remote-tracking branch 'remotes/otubo/tags/pull-seccomp-20180926' into staging · 567ea808
      Peter Maydell 提交于
      pull-seccomp-20180926
      
      # gpg: Signature made Wed 26 Sep 2018 14:20:06 BST
      # gpg:                using RSA key DF32E7C0F0FFF9A2
      # gpg: Good signature from "Eduardo Otubo (Senior Software Engineer) <otubo@redhat.com>"
      # Primary key fingerprint: D67E 1B50 9374 86B4 0723  DBAB DF32 E7C0 F0FF F9A2
      
      * remotes/otubo/tags/pull-seccomp-20180926:
        seccomp: check TSYNC host capability
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      567ea808
    • P
      Merge remote-tracking branch 'remotes/famz/tags/staging-pull-request' into staging · 099bea11
      Peter Maydell 提交于
      Block and testing patches
      
      - Paolo's AIO fixes.
      - VMDK streamOptimized corner case fix
      - VM testing improvment on -cpu
      
      # gpg: Signature made Wed 26 Sep 2018 03:54:08 BST
      # gpg:                using RSA key CA35624C6A9171C6
      # gpg: Good signature from "Fam Zheng <famz@redhat.com>"
      # Primary key fingerprint: 5003 7CB7 9706 0F76 F021  AD56 CA35 624C 6A91 71C6
      
      * remotes/famz/tags/staging-pull-request:
        vmdk: align end of file to a sector boundary
        tests/vm: Use -cpu max rather than -cpu host
        aio-posix: do skip system call if ctx->notifier polling succeeds
        aio-posix: compute timeout before polling
        aio-posix: fix concurrent access to poll_disable_cnt
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      099bea11
    • P
      Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.1-pull-request' into staging · aa8e26de
      Peter Maydell 提交于
      - some fixes for setrlimit() and write()
      - fixes ELF loader when host page size is greater than target page size
      - add SO_LINGER to getsockopt()/setsockopt()
      - move TargetFdTrans from syscall.c
        v2: add "#include <linux/netlink.h>" in linux-user/fd-trans.c
      
      # gpg: Signature made Tue 25 Sep 2018 21:51:13 BST
      # gpg:                using RSA key F30C38BD3F2FBE3C
      # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
      # gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
      # gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
      # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C
      
      * remotes/vivier2/tags/linux-user-for-3.1-pull-request:
        linux-user: do setrlimit selectively
        linux-user: write(fd, NULL, 0) parity with linux's treatment of same
        linux-user: elf: mmap all the target-pages of hostpage for data segment
        linux-user: add SO_LINGER to {g,s}etsockopt
        linux-user: move TargetFdTrans functions to their own file
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      aa8e26de
  4. 27 9月, 2018 7 次提交
    • P
      migration/ram.c: Avoid taking address of fields in packed MultiFDInit_t struct · 341ba0df
      Peter Maydell 提交于
      Taking the address of a field in a packed struct is a bad idea, because
      it might not be actually aligned enough for that pointer type (and
      thus cause a crash on dereference on some host architectures). Newer
      versions of clang warn about this:
      
      migration/ram.c:651:19: warning: taking address of packed member 'magic' of class or structure 'MultiFDInit_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
      migration/ram.c:652:19: warning: taking address of packed member 'version' of class or structure 'MultiFDInit_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
      migration/ram.c:737:19: warning: taking address of packed member 'magic' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
      migration/ram.c:745:19: warning: taking address of packed member 'version' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
      migration/ram.c:755:19: warning: taking address of packed member 'size' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member]
      
      Avoid the bug by not using the "modify in place" byteswapping
      functions.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-Id: <20180925161924.7832-1-peter.maydell@linaro.org>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      341ba0df
    • F
      migration: fix the compression code · 05306935
      Fei Li 提交于
      Add judgement in compress_threads_save_cleanup() to check whether the
      static CompressParam *comp_param has been allocated. If not, just
      return; or else segmentation fault will occur when using the NULL
      comp_param's parameters.  One test case can reproduce this is: set
      the compression on and migrate to a wrong nonexistent host IP address.
      
      Our current code does not judge before handling comp_param[idx]'s quit
      and cond that whether they have been initialized. If not initialized,
      "qemu_mutex_lock_impl: Assertion `mutex->initialized' failed." will
      occur. Fix this by squashing the terminate_compression_threads() into
      compress_threads_save_cleanup() and employing the existing judgement
      condition.  One test case can reproduce this error is: set the
      compression on and fail to fully setup the default eight compression
      thread in compress_threads_save_setup().
      Signed-off-by: NFei Li <fli@suse.com>
      Message-Id: <20180925091440.18910-1-fli@suse.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      05306935
    • M
      migration: fix QEMUFile leak · 0284a2a8
      Marc-André Lureau 提交于
      Spotted by ASAN while running:
      
      $ tests/migration-test -p /x86_64/migration/postcopy/recovery
      
      =================================================================
      ==18034==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 33864 byte(s) in 1 object(s) allocated from:
          #0 0x7f3da7f31e50 in calloc (/lib64/libasan.so.5+0xeee50)
          #1 0x7f3da644441d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d)
          #2 0x55af9db15440 in qemu_fopen_channel_input /home/elmarco/src/qemu/migration/qemu-file-channel.c:183
          #3 0x55af9db15413 in channel_get_output_return_path /home/elmarco/src/qemu/migration/qemu-file-channel.c:159
          #4 0x55af9db0d4ac in qemu_file_get_return_path /home/elmarco/src/qemu/migration/qemu-file.c:78
          #5 0x55af9dad5e4f in open_return_path_on_source /home/elmarco/src/qemu/migration/migration.c:2295
          #6 0x55af9dadb3bf in migrate_fd_connect /home/elmarco/src/qemu/migration/migration.c:3111
          #7 0x55af9dae1bf3 in migration_channel_connect /home/elmarco/src/qemu/migration/channel.c:91
          #8 0x55af9daddeca in socket_outgoing_migration /home/elmarco/src/qemu/migration/socket.c:108
          #9 0x55af9e13d3db in qio_task_complete /home/elmarco/src/qemu/io/task.c:158
          #10 0x55af9e13ca03 in qio_task_thread_result /home/elmarco/src/qemu/io/task.c:89
          #11 0x7f3da643b1ca in g_idle_dispatch gmain.c:5535
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180925092245.29565-1-marcandre.lureau@redhat.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      0284a2a8
    • T
      tests/migration: Speed up the test on ppc64 · fc71e3e5
      Thomas Huth 提交于
      The SLOF boot process is always quite slow ... but we can speed it up
      a little bit by specifying "-nodefaults" and by using the "nvramrc"
      variable instead of "boot-command" (since "nvramrc" is evaluated earlier
      in the SLOF boot process than "boot-command").
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1537204330-16076-1-git-send-email-thuth@redhat.com>
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      fc71e3e5
    • D
      migration: cleanup in error paths in loadvm · 096c83b7
      Dr. David Alan Gilbert 提交于
      There's a couple of error paths in qemu_loadvm_state
      which happen early on but after we've initialised the
      load state; that needs to be cleaned up otherwise
      we can hit asserts if the state gets reinitialised later.
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180914170430.54271-3-dgilbert@redhat.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      096c83b7
    • D
      migration/postcopy: Clear have_listen_thread · 9cf4bb87
      Dr. David Alan Gilbert 提交于
      Clear have_listen_thread when we exit the thread.
      The fallout from this was that various things thought there was
      an ongoing postcopy after the postcopy had finished.
      
      The case that failed was postcopy->savevm->loadvm.
      
      This corresponds to RH bug https://bugzilla.redhat.com/show_bug.cgi?id=1608765Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20180914170430.54271-2-dgilbert@redhat.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      9cf4bb87
    • R
      tcg/i386: fix vector operations on 32-bit hosts · 93bf9a42
      Roman Kapl 提交于
      The TCG backend uses LOWREGMASK to get the low 3 bits of register numbers.
      This was defined as no-op for 32-bit x86, with the assumption that we have
      eight registers anyway. This assumption is not true once we have xmm regs.
      
      Since LOWREGMASK was a no-op, xmm register indidices were wrong in opcodes
      and have overflown into other opcode fields, wreaking havoc.
      
      To trigger these problems, you can try running the "movi d8, #0x0" AArch64
      instruction on 32-bit x86. "vpxor %xmm0, %xmm0, %xmm0" should be generated,
      but instead TCG generated "vpxor %xmm0, %xmm0, %xmm2".
      
      Fixes: 770c2fc7 ("Add vector operations")
      Signed-off-by: NRoman Kapl <rka@sysgo.com>
      Message-Id: <20180824131734.18557-1-rka@sysgo.com>
      Signed-off-by: NRichard Henderson <richard.henderson@linaro.org>
      93bf9a42
  5. 26 9月, 2018 19 次提交