Skip to content
Snippets Groups Projects
  1. Oct 15, 2019
  2. Oct 14, 2019
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20191012' into staging · 4a512a95
      Peter Maydell authored
      
      qemu-openbios queue
      
      # gpg: Signature made Sat 12 Oct 2019 10:47:55 BST
      # gpg:                using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F
      # gpg:                issuer "mark.cave-ayland@ilande.co.uk"
      # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full]
      # Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F
      
      * remotes/mcayland/tags/qemu-openbios-20191012:
        Update OpenBIOS images to f28e16f9 built from submodule.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      4a512a95
    • Hanna Reitz's avatar
      iotests: Test large write request to qcow2 file · a1406a92
      Hanna Reitz authored
      
      Without HEAD^, the following happens when you attempt a large write
      request to a qcow2 file such that the number of bytes covered by all
      clusters involved in a single allocation will exceed INT_MAX:
      
      (A) handle_alloc_space() decides to fill the whole area with zeroes and
          fails because bdrv_co_pwrite_zeroes() fails (the request is too
          large).
      
      (B) If handle_alloc_space() does not do anything, but merge_cow()
          decides that the requests can be merged, it will create a too long
          IOV that later cannot be written.
      
      (C) Otherwise, all parts will be written separately, so those requests
          will work.
      
      In either B or C, though, qcow2_alloc_cluster_link_l2() will have an
      overflow: We use an int (i) to iterate over nb_clusters, and then
      calculate the L2 entry based on "i << s->cluster_bits" -- which will
      overflow if the range covers more than INT_MAX bytes.  This then leads
      to image corruption because the L2 entry will be wrong (it will be
      recognized as a compressed cluster).
      
      Even if that were not the case, the .cow_end area would be empty
      (because handle_alloc() will cap avail_bytes and nb_bytes at INT_MAX, so
      their difference (which is the .cow_end size) will be 0).
      
      So this test checks that on such large requests, the image will not be
      corrupted.  Unfortunately, we cannot check whether COW will be handled
      correctly, because that data is discarded when it is written to null-co
      (but we have to use null-co, because writing 2 GB of data in a test is
      not quite reasonable).
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      a1406a92
    • Hanna Reitz's avatar
      qcow2: Limit total allocation range to INT_MAX · d1b9d19f
      Hanna Reitz authored
      
      When the COW areas are included, the size of an allocation can exceed
      INT_MAX.  This is kind of limited by handle_alloc() in that it already
      caps avail_bytes at INT_MAX, but the number of clusters still reflects
      the original length.
      
      This can have all sorts of effects, ranging from the storage layer write
      call failing to image corruption.  (If there were no image corruption,
      then I suppose there would be data loss because the .cow_end area is
      forced to be empty, even though there might be something we need to
      COW.)
      
      Fix all of it by limiting nb_clusters so the equivalent number of bytes
      will not exceed INT_MAX.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      d1b9d19f
    • Kevin Wolf's avatar
      qemu-nbd: Support help options for --object · 495bf893
      Kevin Wolf authored
      
      Instead of parsing help options as normal object properties and
      returning an error, provide the same help functionality as the system
      emulator in qemu-nbd, too.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      495bf893
    • Kevin Wolf's avatar
      qemu-img: Support help options for --object · c6e5cdfd
      Kevin Wolf authored
      
      Instead of parsing help options as normal object properties and
      returning an error, provide the same help functionality as the system
      emulator in qemu-img, too.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      c6e5cdfd
    • Kevin Wolf's avatar
      qemu-io: Support help options for --object · 4fa1f0dc
      Kevin Wolf authored
      
      Instead of parsing help options as normal object properties and
      returning an error, provide the same help functionality as the system
      emulator in qemu-io, too.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      4fa1f0dc
    • Kevin Wolf's avatar
      vl: Split off user_creatable_print_help() · 3e9297f3
      Kevin Wolf authored
      
      Printing help for --object is something that we not only want in the
      system emulator, but also in tools that support --object. Move it into a
      separate function in qom/object_interfaces.c to make the code accessible
      for tools.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      3e9297f3
    • Hanna Reitz's avatar
      iotests/028: Fix for long $TEST_DIRs · 48c8d3ce
      Hanna Reitz authored
      
      For long test image paths, the order of the "Formatting" line and the
      "(qemu)" prompt after a drive_backup HMP command may be reversed.  In
      fact, the interaction between the prompt and the line may lead to the
      "Formatting" to being greppable at all after "read"-ing it (if the
      prompt injects an IFS character into the "Formatting" string).
      
      So just wait until we get a prompt.  At that point, the block job must
      have been started, so "info block-jobs" will only return "No active
      jobs" once it is done.
      
      Reported-by: default avatarThomas Huth <thuth@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      48c8d3ce
    • Alberto Garcia's avatar
      block: Reject misaligned write requests with BDRV_REQ_NO_FALLBACK · f2208fdc
      Alberto Garcia authored
      
      The BDRV_REQ_NO_FALLBACK flag means that an operation should only be
      performed if it can be offloaded or otherwise performed efficiently.
      
      However a misaligned write request requires a RMW so we should return
      an error and let the caller decide how to proceed.
      
      This hits an assertion since commit c8bb23cb if the required
      alignment is larger than the cluster size:
      
      qemu-img create -f qcow2 -o cluster_size=2k img.qcow2 4G
      qemu-io -c "open -o driver=qcow2,file.align=4k blkdebug::img.qcow2" \
              -c 'write 0 512'
      qemu-io: block/io.c:1127: bdrv_driver_pwritev: Assertion `!(flags & BDRV_REQ_NO_FALLBACK)' failed.
      Aborted
      
      The reason is that when writing to an unallocated cluster we try to
      skip the copy-on-write part and zeroize it using BDRV_REQ_NO_FALLBACK
      instead, resulting in a write request that is too small (2KB cluster
      size vs 4KB required alignment).
      
      Signed-off-by: default avatarAlberto Garcia <berto@igalia.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      f2208fdc
    • Pavel Dovgaluk's avatar
      replay: add BH oneshot event for block layer · e4ec5ad4
      Pavel Dovgaluk authored
      
      Replay is capable of recording normal BH events, but sometimes
      there are single use callbacks scheduled with aio_bh_schedule_oneshot
      function. This patch enables recording and replaying such callbacks.
      Block layer uses these events for calling the completion function.
      Replaying these calls makes the execution deterministic.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
      Acked-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      e4ec5ad4
    • Pavel Dovgaluk's avatar
      replay: finish record/replay before closing the disks · ae25dccb
      Pavel Dovgaluk authored
      
      After recent updates block devices cannot be closed on qemu exit.
      This happens due to the block request polling when replay is not finished.
      Therefore now we stop execution recording before closing the block devices.
      
      Signed-off-by: default avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      ae25dccb
    • Pavel Dovgaluk's avatar
      replay: don't drain/flush bdrv queue while RR is working · c8aa7895
      Pavel Dovgaluk authored
      
      In record/replay mode bdrv queue is controlled by replay mechanism.
      It does not allow saving or loading the snapshots
      when bdrv queue is not empty. Stopping the VM is not blocked by nonempty
      queue, but flushing the queue is still impossible there,
      because it may cause deadlocks in replay mode.
      This patch disables bdrv_drain_all and bdrv_flush_all in
      record/replay mode.
      
      Stopping the machine when the IO requests are not finished is needed
      for the debugging. E.g., breakpoint may be set at the specified step,
      and forcing the IO requests to finish may break the determinism
      of the execution.
      
      Signed-off-by: default avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Acked-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      c8aa7895
Loading