1. 14 3月, 2018 10 次提交
    • S
      iotests: add 208 nbd-server + blockdev-snapshot-sync test case · 44a8174e
      Stefan Hajnoczi 提交于
      This test case adds an NBD server export and then invokes
      blockdev-snapshot-sync, which changes the BlockDriverState node that the
      NBD server's BlockBackend points to.  This is an interesting scenario to
      test and exercises the code path fixed by the previous commit.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20180306204819.11266-3-stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      44a8174e
    • S
      block: let blk_add/remove_aio_context_notifier() tolerate BDS changes · d03654ea
      Stefan Hajnoczi 提交于
      Commit 2019ba0a ("block: Add AioContextNotifier functions to BB")
      added blk_add/remove_aio_context_notifier() and implemented them by
      passing through the bdrv_*() equivalent.
      
      This doesn't work across bdrv_append(), which detaches child->bs and
      re-attaches it to a new BlockDriverState.  When
      blk_remove_aio_context_notifier() is called we will access the new BDS
      instead of the one where the notifier was added!
      
      >From the point of view of the blk_*() API user, changes to the root BDS
      should be transparent.
      
      This patch maintains a list of AioContext notifiers in BlockBackend and
      adds/removes them from the BlockDriverState as needed.
      Reported-by: NStefano Panella <spanella@gmail.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20180306204819.11266-2-stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d03654ea
    • E
      nbd/server: Honor FUA request on NBD_CMD_TRIM · 65529782
      Eric Blake 提交于
      The NBD spec states that since trim requests can affect disk contents,
      then they should allow for FUA semantics just like writes for ensuring
      the disk has settled before returning.  As bdrv_[co_]pdiscard() does
      not support a flags argument, we can't pass FUA down the block layer
      stack, and must therefore emulate it with a flush at the NBD layer.
      
      Note that in all reality, generic well-behaved clients will never
      send TRIM+FUA (in fact, qemu as a client never does, and we have no
      intention to plumb flags into bdrv_pdiscard).  This is because the
      NBD protocol states that it is unspecified to READ a trimmed area
      (you might read stale data, all zeroes, or even random unrelated
      data) without first rewriting it, and even the experimental
      BLOCK_STATUS extension states that TRIM need not affect reported
      status.  Thus, in the general case, a client cannot tell the
      difference between an arbitrary server that ignores TRIM, a server
      that had a power outage without flushing to disk, and a server that
      actually affected the disk before returning; so waiting for the
      trim actions to flush to disk makes little sense.  However, for a
      specific client and server pair, where the client knows the server
      treats TRIM'd areas as guaranteed reads-zero, waiting for a flush
      makes sense, hence why the protocol documents that FUA is valid on
      trim.  So, even though the NBD protocol doesn't have a way for the
      server to advertise what effects (if any) TRIM will actually have,
      and thus any client that relies on specific effects is probably
      in error, we can at least support a client that requests TRIM+FUA.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180307225732.155835-1-eblake@redhat.com>
      65529782
    • V
      nbd/server: refactor nbd_trip: split out nbd_handle_request · 6f302e60
      Vladimir Sementsov-Ogievskiy 提交于
      Split out request handling logic.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20180308184636.178534-6-vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [eblake: touch up blank line placement]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6f302e60
    • V
      nbd/server: refactor nbd_trip: cmd_read and generic reply · 6a417599
      Vladimir Sementsov-Ogievskiy 提交于
      nbd_trip has difficult logic when sending replies: it tries to use one
      code path for all replies. It is ok for simple replies, but is not
      comfortable for structured replies. Also, two types of error (and
      corresponding messages in local_err) - fatal (leading to disconnect)
      and not-fatal (just to be sent to the client) are difficult to follow.
      
      To make things a bit clearer, the following is done:
       - split CMD_READ logic to separate function. It is the most difficult
         command for now, and it is definitely cramped inside nbd_trip. Also,
         it is difficult to follow CMD_READ logic, shared between
         "case NBD_CMD_READ" and "if"s under "reply:" label.
       - create separate helper function nbd_send_generic_reply() and use it
         both in new nbd_do_cmd_read and for other commands in nbd_trip instead
         of common code-path under "reply:" label in nbd_trip. The helper
         supports an error message, so logic with local_err in nbd_trip is
         simplified.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20180308184636.178534-5-vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [eblake: grammar tweaks and blank line placement]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6a417599
    • V
      nbd/server: fix: check client->closing before sending reply · a0d7ce20
      Vladimir Sementsov-Ogievskiy 提交于
      Since the unchanged code has just set client->recv_coroutine to
      NULL before calling nbd_client_receive_next_request(), we are
      spawning a new coroutine unconditionally, but the first thing
      that coroutine will do is check for client->closing, making it
      a no-op if we have already detected that the client is going
      away.  Furthermore, for any error other than EIO (where we
      disconnect, which itself sets client->closing), if the client
      has already gone away, we'll probably encounter EIO later
      in the function and attempt disconnect at that point.  Logically,
      as soon as we know the connection is closing, there is no need
      to try a likely-to-fail a response or spawn a no-op coroutine.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20180308184636.178534-4-vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [eblake: squash in further reordering: hoist check before spawning
      next coroutine, and document rationale in commit message]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a0d7ce20
    • V
      nbd/server: fix sparse read · 37e02aeb
      Vladimir Sementsov-Ogievskiy 提交于
      In case of io error in nbd_co_send_sparse_read we should not
      "goto reply:", as it was a fatal error and the common behavior
      is to disconnect in this case. We should not try to send the
      client an additional error reply, since we already hit a
      channel-io error on our previous attempt to send one.
      
      Fix this by handling block-status error in nbd_co_send_sparse_read,
      so nbd_co_send_sparse_read fails only on io error. Then just skip
      common "reply:" code path in nbd_trip.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20180308184636.178534-3-vsementsov@virtuozzo.com>
      [eblake: grammar tweaks]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      37e02aeb
    • V
      nbd/server: move nbd_co_send_structured_error up · 60ace2ba
      Vladimir Sementsov-Ogievskiy 提交于
      To be reused in nbd_co_send_sparse_read() in the following patch.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20180308184636.178534-2-vsementsov@virtuozzo.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      60ace2ba
    • E
      iotests: Fix stuck NBD process on 33 · 6eba9f01
      Eric Blake 提交于
      Commit afe35cde added additional actions to test 33, but forgot
      to reset the image between tests.  As a result, './check -nbd 33'
      fails because the qemu-nbd process from the first half is still
      occupying the port, preventing the second half from starting a
      new qemu-nbd process.  Worse, the failure leaves a rogue qemu-nbd
      process behind even after the test fails, which causes knock-on
      failures to later tests that also want to start qemu-nbd.
      Reported-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180312211156.452139-1-eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      6eba9f01
    • P
      Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging · 026aaf47
      Peter Maydell 提交于
      Python queue, 2018-03-12
      
      # gpg: Signature made Mon 12 Mar 2018 22:10:36 GMT
      # gpg:                using RSA key 2807936F984DC5A6
      # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
      # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6
      
      * remotes/ehabkost/tags/python-next-pull-request:
        device-crash-test: Use 'python' binary
        qmp.py: Encode json data before sending
        qemu.py: Use items() instead of iteritems()
        device-crash-test: New known crashes
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      026aaf47
  2. 13 3月, 2018 15 次提交
  3. 12 3月, 2018 15 次提交
    • P
      Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180312-pull-request' into staging · b16a54da
      Peter Maydell 提交于
      gtk,spice: add dmabuf support.
      sdl,vnc,gtk: bugfixes.
      ui/qapi: add device ID and head parameters to screendump.
      build: try improve handling of clang warnings.
      
      # gpg: Signature made Mon 12 Mar 2018 09:13:28 GMT
      # gpg:                using RSA key 4CB6D8EED3E87138
      # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
      # gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
      # gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
      # Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138
      
      * remotes/kraxel/tags/ui-20180312-pull-request:
        qapi: Add device ID and head parameters to screendump
        spice: add cursor_dmabuf support
        spice: add scanout_dmabuf support
        spice: drop dprint() debug logging
        vnc: deal with surface NULL pointers
        ui/gtk-egl: add cursor_dmabuf support
        ui/gtk-egl: add scanout_dmabuf support
        ui/gtk: use GtkGlArea on wayland only
        ui/opengl: Makefile cleanup
        ui/gtk: group gtk.mo declarations in Makefile
        ui/gtk: make GtkGlArea usage a runtime option
        sdl: workaround bug in sdl 2.0.8 headers
        make: switch language file build to be gtk module aware
        build: try improve handling of clang warnings
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b16a54da
    • P
      Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180309a' into staging · 819fd469
      Peter Maydell 提交于
      Migration pull 2018-03-09
      
      # gpg: Signature made Fri 09 Mar 2018 17:52:46 GMT
      # 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-20180309a:
        tests: Silence migration-test 'bad' test
        migration: fix applying wrong capabilities
        migration/block: rename MAX_INFLIGHT_IO to MAX_IO_BUFFERS
        migration/block: reset dirty bitmap before read in bulk phase
        migration: do not transfer ram during bulk storage migration
        migration: fix minor finalize leak
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      819fd469
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180309' into staging · 5df08956
      Peter Maydell 提交于
      target-arm queue:
       * i.MX: Add i.MX7 SOC implementation and i.MX7 Sabre board
       * Report the correct core count in A53 L2CTLR on the ZynqMP board
       * linux-user: preliminary SVE support work (signal handling)
       * hw/arm/boot: fix memory leak in case of error loading ELF file
       * hw/arm/boot: avoid reading off end of buffer if passed very
         small image file
       * hw/arm: Use more CONFIG switches for the object files
       * target/arm: Add "-cpu max" support
       * hw/arm/virt: Support -machine gic-version=max
       * hw/sd: improve debug tracing
       * hw/sd: sdcard: Add the Tuning Command (CMD 19)
       * MAINTAINERS: add Philippe as odd-fixes maintainer for SD
      
      # gpg: Signature made Fri 09 Mar 2018 17:24:23 GMT
      # gpg:                using RSA key 3C2525ED14360CDE
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20180309: (25 commits)
        MAINTAINERS: Add entries for SD (SDHCI, SDBus, SDCard)
        sdhci: Fix a typo in comment
        sdcard: Add the Tuning Command (CMD19)
        sdcard: Display which protocol is used when tracing (SD or SPI)
        sdcard: Display command name when tracing CMD/ACMD
        sdcard: Do not trace CMD55, except when we already expect an ACMD
        hw/arm/virt: Support -machine gic-version=max
        hw/arm/virt: Add "max" to the list of CPU types "virt" supports
        target/arm: Make 'any' CPU just an alias for 'max'
        target/arm: Add "-cpu max" support
        target/arm: Move definition of 'host' cpu type into cpu.c
        target/arm: Query host CPU features on-demand at instance init
        arm: avoid heap-buffer-overflow in load_aarch64_image
        arm: fix load ELF error leak
        hw/arm: Use more CONFIG switches for the object files
        aarch64-linux-user: Add support for SVE signal frame records
        aarch64-linux-user: Add support for EXTRA signal frame records
        aarch64-linux-user: Remove struct target_aux_context
        aarch64-linux-user: Split out helpers for guest signal handling
        linux-user: Implement aarch64 PR_SVE_SET/GET_VL
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      5df08956
    • D
      trace: only permit standard C types and fixed size integer types · 73ff0610
      Daniel P. Berrangé 提交于
      Some trace backends will compile code based on the declared trace
      events. It should not be assumed that the backends can resolve any QEMU
      specific typedefs. So trace events should restrict their argument
      types to the standard C types and fixed size integer types. Any complex
      pointer types can be declared as "void *" for purposes of trace events,
      since nothing will be dereferencing these pointer arguments.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      Message-id: 20180308155524.5082-3-berrange@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      73ff0610
    • D
      trace: remove use of QEMU specific types from trace probes · 88584448
      Daniel P. Berrangé 提交于
      Any compound structs / unions / etc, should always be declared as
      'void *' pointers, since it cannot be assumed that trace backends
      are able to resolve QEMU typedefs.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      Message-id: 20180308155524.5082-2-berrange@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      88584448
    • D
      trace: include filename when printing parser error messages · 86b5aacf
      Daniel P. Berrangé 提交于
      Improves error messages from:
      
        ValueError: Error on line 72: need more than 1 value to unpack
      
      To
      
        ValueError: Error at /home/berrange/src/virt/qemu/trace-events:72:
          need more than 1 value to unpack
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-id: 20180306154650.24075-1-berrange@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      86b5aacf
    • S
      simpletrace: fix timestamp argument type · e42860ae
      Stefan Hajnoczi 提交于
      The timestamp argument to a trace event method is documented as follows:
      
        The method can also take a timestamp argument before the trace event
        arguments:
      
          def runstate_set(self, timestamp, new_state):
              ...
      
        Timestamps have the uint64_t type and are in nanoseconds.
      
      In reality methods with a timestamp argument actually receive a tuple
      like (123456789,) as the timestamp argument.  This is due to a bug in
      simpletrace.py.
      
      This patch unpacks the tuple so that methods receive the correct
      timestamp argument type.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 20180222163901.14095-1-stefanha@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      e42860ae
    • P
      log-for-trace.h: Split out parts of log.h used by trace.h · be0aa7ac
      Peter Maydell 提交于
      A persistent build problem we see is where a source file
      accidentally omits the #include of log.h. This slips through
      local developer testing because if you configure with the
      default (log) trace backend trace.h will pull in log.h for you.
      Compilation fails only if some other backend is selected.
      
      To make this error cause a compile failure regardless of
      the configured trace backend, split out the parts of log.h
      that trace.h requires into a new log-for-trace.h header.
      Since almost all manual uses of the log.h functions will
      use constants or functions which aren't in log-for-trace.h,
      this will let us catch missing #include "qemu/log.h" more
      consistently.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20180213140029.8308-1-peter.maydell@linaro.org
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      be0aa7ac
    • S
      block: make BDRV_POLL_WHILE() re-entrancy safe · 7376eda7
      Stefan Hajnoczi 提交于
      Nested BDRV_POLL_WHILE() calls can occur.  Currently
      assert(!wait_->wakeup) fails in AIO_WAIT_WHILE() when this happens.
      
      This patch converts the bool wait_->need_kick flag to an unsigned
      wait_->num_waiters counter.
      
      Nesting works correctly because outer AIO_WAIT_WHILE() callers evaluate
      the condition again after the inner caller completes (invoking the inner
      caller counts as aio_poll() progress).
      Reported-by: N"fuweiwei (C)" <fuweiwei2@huawei.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 20180307124619.6218-1-stefanha@redhat.com
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7376eda7
    • G
      vga: fix region calculation · 7cdc61be
      Gerd Hoffmann 提交于
      Typically the scanline length and the line offset are identical.  But
      in case they are not our calculation for region_end is incorrect.  Using
      line_offset is fine for all scanlines, except the last one where we have
      to use the actual scanline length.
      
      Fixes: CVE-2018-7550
      Reported-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Tested-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Message-id: 20180309143704.13420-1-kraxel@redhat.com
      7cdc61be
    • Z
      usbredir: reorder fields in USBRedirDevice to reduce padding · c7ac1ab0
      zhenwei.pi 提交于
      Changing the current ordering saves 8 bytes per entry in x86_64.
      Signed-off-by: Nzhenwei.pi <zhenwei.pi@youruncloud.com>
      Message-id: 1520318781-22644-1-git-send-email-zhenwei.pi@youruncloud.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      c7ac1ab0
    • G
      audio/sdl: build as module · 051c7d5c
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180306074053.22856-8-kraxel@redhat.com
      051c7d5c
    • G
      audio/pulseaudio: build as module · d2f623da
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180306074053.22856-7-kraxel@redhat.com
      d2f623da
    • G
      audio/oss: build as module · 22d81543
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180306074053.22856-6-kraxel@redhat.com
      22d81543
    • G
      audio/alsa: build as module · ce3dc033
      Gerd Hoffmann 提交于
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20180306074053.22856-5-kraxel@redhat.com
      ce3dc033