1. 06 6月, 2019 1 次提交
    • P
      Merge remote-tracking branch 'remotes/juanquintela/tags/migration-pull-request' into staging · 8be20946
      Peter Maydell 提交于
      Migration Pull request
      
      # gpg: Signature made Wed 05 Jun 2019 12:52:06 BST
      # gpg:                using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723
      # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [full]
      # gpg:                 aka "Juan Quintela <quintela@trasno.org>" [full]
      # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723
      
      * remotes/juanquintela/tags/migration-pull-request:
        migratioin/ram: leave RAMBlock->bmap blank on allocating
        migration-test: Add a test for fd protocol
        migration: Fix fd protocol for incoming defer
        migration/ram.c: multifd_send_state->count is not really used
        migration/ram.c: MultiFDSendParams.sem_sync is not really used
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      8be20946
  2. 05 6月, 2019 6 次提交
  3. 04 6月, 2019 30 次提交
    • K
      iotests: Fix duplicated diff output on failure · 11ba81c3
      Kevin Wolf 提交于
      Commit 70ff5b07 wanted to move the diff between actual and reference
      output to the end after printing the test result line. It really only
      copied it, though, so the diff is now displayed twice. Remove the old
      one.
      
      Fixes: 70ff5b07Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      11ba81c3
    • V
      iotests: test big qcow2 shrink · 3dd3e248
      Vladimir Sementsov-Ogievskiy 提交于
      This test checks bug in qcow2_process_discards, fixed by previous
      commit.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      3dd3e248
    • V
      block/io: bdrv_pdiscard: support int64_t bytes parameter · d93e5726
      Vladimir Sementsov-Ogievskiy 提交于
      This fixes at least one overflow in qcow2_process_discards, which
      passes 64bit region length to bdrv_pdiscard where bytes (or sectors in
      the past) parameter is int since its introduction in 0b919fae.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d93e5726
    • V
      block/qcow2-refcount: add trace-point to qcow2_process_discards · 1477b6c8
      Vladimir Sementsov-Ogievskiy 提交于
      Let's at least trace ignored failure.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1477b6c8
    • K
      block: Remove bdrv_set_aio_context() · 42a65f02
      Kevin Wolf 提交于
      All callers of bdrv_set_aio_context() are eliminated now, they have
      moved to bdrv_try_set_aio_context() and related safe functions. Remove
      bdrv_set_aio_context().
      
      With this, we can now know that the .set_aio_ctx callback must be
      present in bdrv_set_aio_context_ignore() because
      bdrv_can_set_aio_context() would have returned false previously, so
      instead of checking the condition, we can assert it.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      42a65f02
    • K
      test-bdrv-drain: Use bdrv_try_set_aio_context() · 26bf15e4
      Kevin Wolf 提交于
      No reason to use the unchecked version in tests, even more so when these
      are the last callers of bdrv_set_aio_context() outside of block.c.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      26bf15e4
    • K
      iotests: Attach new devices to node in non-default iothread · 6c870535
      Kevin Wolf 提交于
      This tests that devices refuse to be attached to a node that has already
      been moved to a different iothread if they can't be or aren't configured
      to work in the same iothread.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6c870535
    • K
      virtio-scsi-test: Test attaching new overlay with iothreads · edbe36ad
      Kevin Wolf 提交于
      This tests that blockdev-add can correctly add a qcow2 overlay to an
      image used by a virtio-scsi disk in an iothread. The interesting point
      here is whether the newly added node gets correctly moved into the
      iothread AioContext.
      
      If it isn't, we get an assertion failure in virtio-scsi while processing
      the next request:
      
          virtio_scsi_ctx_check: Assertion `blk_get_aio_context(d->conf.blk) == s->ctx' failed.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      edbe36ad
    • K
      block: Remove wrong bdrv_set_aio_context() calls · d0ee0204
      Kevin Wolf 提交于
      The mirror and commit block jobs use bdrv_set_aio_context() to move
      their filter node into the right AioContext before hooking it up in the
      graph. Similarly, bdrv_open_backing_file() explicitly moves the backing
      file node into the right AioContext first.
      
      This isn't necessary any more, they get automatically moved into the
      right context now when attaching them.
      
      However, in the case of bdrv_open_backing_file() with a node reference,
      it's actually not only unnecessary, but even wrong: The unchecked
      bdrv_set_aio_context() changes the AioContext of the child node even if
      other parents require it to retain the old context. So this is not only
      a simplification, but a bug fix, too.
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1684342Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d0ee0204
    • K
      blockdev: Use bdrv_try_set_aio_context() for monitor commands · 8ed7d42f
      Kevin Wolf 提交于
      Monitor commands can handle errors, so they can easily be converted to
      using the safer bdrv_try_set_aio_context() function.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      8ed7d42f
    • K
      block: Move node without parents to main AioContext · ad943dcb
      Kevin Wolf 提交于
      A node should only be in a non-default AioContext if a user is attached
      to it that requires this. When the last parent of a node is gone, it can
      move back to the main AioContext.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ad943dcb
    • K
      test-block-iothread: BlockBackend AioContext across root node change · 2e9cdab3
      Kevin Wolf 提交于
      Test that BlockBackends preserve their assigned AioContext even when the
      root node goes away. Inserting a new root node will move it to the right
      AioContext.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2e9cdab3
    • K
      test-block-iothread: Test adding parent to iothread node · 48946d7d
      Kevin Wolf 提交于
      Opening a new parent node for a node that has already been moved into a
      different AioContext must cause the new parent to move into the same
      context.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      48946d7d
    • K
      block: Adjust AioContexts when attaching nodes · 132ada80
      Kevin Wolf 提交于
      So far, we only made sure that updating the AioContext of a node
      affected the whole subtree. However, if a node is newly attached to a
      new parent, we also need to make sure that both the subtree of the node
      and the parent are in the same AioContext. This tries to move the new
      child node to the parent AioContext and returns an error if this isn't
      possible.
      
      BlockBackends now actually apply their AioContext to their root node.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      132ada80
    • K
      scsi-disk: Use qdev_prop_drive_iothread · 4f71fb43
      Kevin Wolf 提交于
      This makes use of qdev_prop_drive_iothread for scsi-disk so that the
      disk can be attached to a node that is already in the target AioContext.
      We need to check that the HBA actually supports iothreads, otherwise
      scsi-disk must make sure that the node is already in the main
      AioContext.
      
      This changes the error message for conflicting iothread settings.
      Previously, virtio-scsi produced the error message, now it comes from
      blk_set_aio_context(). Update a test case accordingly.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4f71fb43
    • K
      block: Add qdev_prop_drive_iothread property type · 307a5f60
      Kevin Wolf 提交于
      Some qdev block devices have support for iothreads and take care of the
      AioContext they are running in, but most devices don't know about any of
      this. For the latter category, the qdev drive property must make sure
      that their BlockBackend is in the main AioContext.
      
      Unfortunately, while the current code just does the same thing for
      devices that do support iothreads, this is not correct and it would show
      as soon as we actually try to keep a consistent AioContext assignment
      across all nodes and users of a block graph subtree: If a node is
      already in a non-default AioContext because of one of its users,
      attaching a new device should still be possible if that device can work
      in the same AioContext. Switching the node back to the main context
      first and only then into the device AioContext causes failure (because
      the existing user wouldn't allow the switch to the main context).
      
      So devices that support iothreads need a different kind of drive
      property that leaves the node in its current AioContext, but by using
      this type, the device promises to check later that it can work with this
      context.
      
      This patch adds the qdev infrastructure that allows devices to signal
      that they handle iothreads and qdev should leave the AioContext alone.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      307a5f60
    • K
      block: Add BlockBackend.ctx · d861ab3a
      Kevin Wolf 提交于
      This adds a new parameter to blk_new() which requires its callers to
      declare from which AioContext this BlockBackend is going to be used (or
      the locks of which AioContext need to be taken anyway).
      
      The given context is only stored and kept up to date when changing
      AioContexts. Actually applying the stored AioContext to the root node
      is saved for another commit.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      d861ab3a
    • K
      block: Add Error to blk_set_aio_context() · 97896a48
      Kevin Wolf 提交于
      Add an Error parameter to blk_set_aio_context() and use
      bdrv_child_try_set_aio_context() internally to check whether all
      involved nodes can actually support the AioContext switch.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      97896a48
    • K
      nbd-server: Call blk_set_allow_aio_context_change() · 45e92a90
      Kevin Wolf 提交于
      The NBD server uses an AioContext notifier, so it can tolerate that its
      BlockBackend is switched to a different AioContext. Before we start
      actually calling bdrv_try_set_aio_context(), which checks for
      consistency, outside of test cases, we need to make sure that the NBD
      server actually allows this.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      45e92a90
    • K
      test-block-iothread: Check filter node in test_propagate_mirror · 087ba459
      Kevin Wolf 提交于
      Just make the test cover the AioContext of the filter node as well.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      087ba459
    • K
    • J
      block/linux-aio: Drop unused BlockAIOCB submission method · 2b02fd81
      Julia Suvorova 提交于
      Callback-based laio_submit() and laio_cancel() were left after
      rewriting Linux AIO backend to coroutines in hope that they would be
      used in other code that could bypass coroutines. They can be safely
      removed because they have not been used since that time.
      Signed-off-by: NJulia Suvorova <jusual@mail.ru>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2b02fd81
    • M
      iotests: Test cancelling a job and closing the VM · 74f27ead
      Max Reitz 提交于
      This patch adds a test where we cancel a throttled mirror job and
      immediately close the VM before it can be cancelled.  Doing so will
      invoke bdrv_drain_all() while the mirror job tries to drain the
      throttled node.  When bdrv_drain_all_end() tries to lift its drain on
      the throttle node, the job will exit and replace the current root node
      of the BB drive0 (which is the job's filter node) by the throttle node.
      Before the previous patch, this replacement did not increase drive0's
      quiesce_counter by a sufficient amount, so when
      bdrv_parent_drained_end() (invoked by bdrv_do_drained_end(), invoked by
      bdrv_drain_all_end()) tried to end the drain on all of the throttle
      node's parents, it decreased drive0's quiesce_counter below 0 -- which
      fails an assertion.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      74f27ead
    • M
      block/io: Delay decrementing the quiesce_counter · 5cb2737e
      Max Reitz 提交于
      When ending a drained section, bdrv_do_drained_end() currently first
      decrements the quiesce_counter, and only then actually ends the drain.
      
      The bdrv_drain_invoke(bs, false) call may cause graph changes.  Say the
      graph change involves replacing an existing BB's ("blk") BDS
      (blk_bs(blk)) by @bs.  Let us introducing the following values:
      - bs_oqc = old_quiesce_counter
        (so bs->quiesce_counter == bs_oqc - 1)
      - obs_qc = blk_bs(blk)->quiesce_counter (before bdrv_drain_invoke())
      
      Let us assume there is no blk_pread_unthrottled() involved, so
      blk->quiesce_counter == obs_qc (before bdrv_drain_invoke()).
      
      Now replacing blk_bs(blk) by @bs will reduce blk->quiesce_counter by
      obs_qc (making it 0) and increase it by bs_oqc-1 (making it bs_oqc-1).
      
      bdrv_drain_invoke() returns and we invoke bdrv_parent_drained_end().
      This will decrement blk->quiesce_counter by one, so it would be -1 --
      were there not an assertion against that in blk_root_drained_end().
      
      We therefore have to keep the quiesce_counter up at least until
      bdrv_drain_invoke() returns, so that bdrv_parent_drained_end() does the
      right thing for the parents @bs got during bdrv_drain_invoke().
      
      But let us delay it even further, namely until bdrv_parent_drained_end()
      returns, because then it mirrors bdrv_do_drained_begin(): There, we
      first increment the quiesce_counter, then begin draining the parents,
      and then call bdrv_drain_invoke().  It makes sense to let
      bdrv_do_drained_end() unravel this exactly in reverse.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5cb2737e
    • V
      block: avoid recursive block_status call if possible · 69f47505
      Vladimir Sementsov-Ogievskiy 提交于
      drv_co_block_status digs bs->file for additional, more accurate search
      for hole inside region, reported as DATA by bs since 5daa74a6.
      
      This accuracy is not free: assume we have qcow2 disk. Actually, qcow2
      knows, where are holes and where is data. But every block_status
      request calls lseek additionally. Assume a big disk, full of
      data, in any iterative copying block job (or img convert) we'll call
      lseek(HOLE) on every iteration, and each of these lseeks will have to
      iterate through all metadata up to the end of file. It's obviously
      ineffective behavior. And for many scenarios we don't need this lseek
      at all.
      
      However, lseek is needed when we have metadata-preallocated image.
      
      So, let's detect metadata-preallocation case and don't dig qcow2's
      protocol file in other cases.
      
      The idea is to compare allocation size in POV of filesystem with
      allocations size in POV of Qcow2 (by refcounts). If allocation in fs is
      significantly lower, consider it as metadata-preallocation case.
      
      102 iotest changed, as our detector can't detect shrinked file as
      metadata-preallocation, which don't seem to be wrong, as with metadata
      preallocation we always have valid file length.
      
      Two other iotests have a slight change in their QMP output sequence:
      Active 'block-commit' returns earlier because the job coroutine yields
      earlier on a blocking operation. This operation is loading the refcount
      blocks in qcow2_detect_metadata_preallocation().
      Suggested-by: NDenis V. Lunev <den@openvz.org>
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      69f47505
    • V
      tests/perf: Test lseek influence on qcow2 block-status · 52f2b896
      Vladimir Sementsov-Ogievskiy 提交于
      Block layer may recursively check block_status in file child of qcow2,
      if qcow2 driver returned DATA. There are several test cases to check
      influence of lseek on block_status performance. To see real difference
      run on tmpfs.
      
      Tests originally created by Kevin, I just refactored and put them
      together into one executable file with simple output.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      52f2b896
    • J
      blockdev: fix missed target unref for drive-backup · 4da26f13
      John Snow 提交于
      If the bitmap can't be used for whatever reason, we skip putting down
      the reference. Fix that.
      
      In practice, this means that if you attempt to gracefully exit QEMU
      after a backup command being rejected, bdrv_close_all will fail and
      tell you some unpleasant things via assert().
      Reported-by: Naihua liang <aliang@redhat.com>
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1703916Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4da26f13
    • K
      iotests: Test commit job start with concurrent I/O · ac6fb43e
      Kevin Wolf 提交于
      This tests that concurrent requests are correctly drained before making
      graph modifications instead of running into assertions in
      bdrv_replace_node().
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      ac6fb43e
    • K
      block: Drain source node in bdrv_replace_node() · f871abd6
      Kevin Wolf 提交于
      Instead of just asserting that no requests are in flight in
      bdrv_replace_node(), which is a requirement that most callers ignore, we
      can just drain the source node right there. This fixes at least starting
      a commit job while I/O is active on the backing chain, but probably
      other callers, too.
      
      Having requests in flight on the target node isn't a problem because the
      target just gets new parents, but the call path of running requests
      isn't modified. So we can just drop this assertion without a replacement.
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1711643Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      f871abd6
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · e2a58ff4
      Peter Maydell 提交于
      * Revert q35 to kernel irqchip (Alex)
      * edu device fixes (Li Qiang)
      * cleanups (Marc-André, Peter)
      * Improvements to -accel help
      * Better support for IA32_MISC_ENABLE MSR (Wanpeng)
      * I2C test conversion to qgraph (Paolo)
      
      # gpg: Signature made Mon 03 Jun 2019 14:20:12 BST
      # gpg:                using RSA key BFFBD25F78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
      # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
      #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
      
      * remotes/bonzini/tags/for-upstream: (24 commits)
        q35: Revert to kernel irqchip
        configure: remove tpm_passthrough & tpm_emulator
        ci: store Patchew configuration in the tree
        libqos: i2c: move address into QI2CDevice
        tests: convert ds1338-test to qtest
        tests: convert OMAP i2c tests to qgraph
        libqos: add ARM imx25-pdk machine object
        libqos: add ARM n800 machine object
        libqos: convert I2C to qgraph
        libqos: split I2CAdapter initialization and allocation
        imx25-pdk: create ds1338 for qtest inside the test
        pca9552-test: do not rely on state across tests
        libqos: fix omap-i2c receiving more than 4 bytes
        libqos: move common i2c code to libqos
        qgraph: fix qos_node_contains with options
        qgraph: allow extra_device_opts on contains nodes
        edu: uses uint64_t in dma operation
        edu: mmio: allow 64-bit access in read dispatch
        edu: mmio: allow 64-bit access
        i386: Enable IA32_MISC_ENABLE MWAIT bit when exposing mwait/monitor
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e2a58ff4
  4. 03 6月, 2019 3 次提交