1. 18 12月, 2015 40 次提交
    • K
      qemu-iotests: Test cache mode option inheritance · 8f7acbe6
      Kevin Wolf 提交于
      This is doing a more complete test on setting cache modes both while
      opening an image (i.e. in a -drive command line) and in reopen
      situations. It checks that reopen can specify options for child nodes
      and that cache modes are correctly inherited from parent nodes where
      they are not specified.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      8f7acbe6
    • K
      qemu-iotests: Try setting cache mode for children · 768ee459
      Kevin Wolf 提交于
      This is a basic test for specifying cache modes for child nodes on the
      command line. It doesn't take much time and works without O_DIRECT
      support.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      768ee459
    • K
      blkdebug: Enable reopen · c5e8bfb7
      Kevin Wolf 提交于
      Just reopening the children (as block.c does now) is enough.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      c5e8bfb7
    • K
      block: Move cache options into options QDict · 91a097e7
      Kevin Wolf 提交于
      This adds the cache mode options to the QDict, so that they can be
      specified for child nodes (e.g. backing.cache.direct=off).
      
      The cache modes are not removed from the flags at this point; instead,
      options and flags are kept in sync. If the user specifies both flags and
      options, the options take precedence.
      
      Child node inherit cache modes as options now, they don't use flags any
      more.
      
      Note that this forbids specifying the cache mode for empty drives. It
      didn't make sense anyway to specify it there, because it didn't have any
      effect. blockdev_init() considers the cache options now bdrv_open()
      options and therefore doesn't create an empty drive any more but calls
      into bdrv_open(). This in turn will fail with no driver and filename
      specified.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      91a097e7
    • K
      block: reopen: Extract QemuOpts for generic block layer options · ccf9dc07
      Kevin Wolf 提交于
      This patch adds a QemuOpts for generic block layer options to
      bdrv_reopen_prepare(). The only two options that currently exist
      (node-name and driver) cannot be changed, so the only thing we do is
      putting them right back into the QDict so that we check at the end that
      they are indeed unchanged.
      
      We will add new options soon that can actually be changed.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      ccf9dc07
    • K
      qemu-iotests: Remove cache mode test without medium · fc17c259
      Kevin Wolf 提交于
      Specifying the cache mode for a driver without a medium is not a useful
      thing to do: As long as there is no medium, the cache mode doesn't make
      a difference, and once the 'change' command is used to insert a medium,
      it ignores the old cache mode and makes the new medium use
      cache=writethrough.
      
      Later patches will make it an error to specify the cache mode for an
      empty drive. Remove the corresponding test case.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      fc17c259
    • K
      blockdev: Set 'format' indicates non-empty drive · 39c4ae94
      Kevin Wolf 提交于
      Creating an empty drive while specifying 'format' doesn't make sense.
      The specified format driver would simply be ignored.
      
      Make a set 'format' option an indication that a non-empty drive should
      be created. This makes 'format' consistent with 'driver' and allows
      using it with a block driver that doesn't need any other options (like
      null-co/null-aio).
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      39c4ae94
    • K
      block: Introduce bs->explicit_options · 145f598e
      Kevin Wolf 提交于
      bs->options doesn't only contain options that the user explicitly
      requested, but also option that were derived from flags, the filename or
      inherited from the parent node.
      
      For reopen, it is important to know the difference because reopening the
      parent can change inherited values in child nodes, but it shouldn't
      change any options that were explicitly specified for the child.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      145f598e
    • K
      block: Split out parse_json_protocol() · de3b53f0
      Kevin Wolf 提交于
      The next patch distinguishes options that were explicitly set and
      options that were derived. bdrv_fill_option() added options of both
      types: Options given by json: syntax should be counted as explicit, but
      the rest is derived.
      
      In preparation for the distinction, move json: parse to a separate
      function.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      de3b53f0
    • K
      block: Add infrastructure for option inheritance · 8e2160e2
      Kevin Wolf 提交于
      Options are not actually inherited from the parent node yet, but this
      commit lays the grounds for doing so.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      8e2160e2
    • K
      block: reopen: Document option precedence and refactor accordingly · 28518102
      Kevin Wolf 提交于
      The interesting part of reopening an image is from which sources the
      effective options should be taken, i.e. which options take precedence
      over which other options. This patch documents the precedence that will
      be implemented in the following patches.
      
      It also refactors bdrv_reopen_queue(), so that the top-level reopened
      node is handled the same way as children are. Option/flag inheritance
      from the parent becomes just one item in the list and is done at the
      beginning of the function, similar to how the other items are/will be
      handled.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      28518102
    • K
      block: Allow specifying child options in reopen · 4c9dfe5d
      Kevin Wolf 提交于
      If the child was defined in the same context (-drive argument or
      blockdev-add QMP command) as its parent, a reopen of the parent should
      work the same and allow changing options of the child.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      4c9dfe5d
    • K
      block: Keep "driver" in bs->options · 62392ebb
      Kevin Wolf 提交于
      Instead of passing a separate drv argument to bdrv_open_common(), just
      make sure that a "driver" option is set in the QDict. This also means
      that a "driver" entry is consistently present in bs->options now.
      
      This is another step towards keeping all options in the QDict (which is
      the represenation of the blockdev-add QMP command).
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      62392ebb
    • K
      block: Pass driver-specific options to .bdrv_refresh_filename() · 4cdd01d3
      Kevin Wolf 提交于
      In order to decide whether a blkdebug: filename can be produced or a
      json: one is necessary, blkdebug checked whether bs->options had more
      options than just "config", "x-image" or "image" (the latter including
      nested options). That doesn't work well when generic block layer options
      are present.
      
      This patch passes an option QDict to the driver that contains only
      driver-specific options, i.e. the options for the general block layer as
      well as child nodes are already filtered out. Works much better this
      way.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      4cdd01d3
    • K
      block: Exclude nested options only for children in append_open_options() · 260fecf1
      Kevin Wolf 提交于
      Some drivers have nested options (e.g. blkdebug rule arrays), which
      don't belong to a child node and shouldn't be removed. Don't remove all
      options with "." in their name, but check for the complete prefixes of
      actually existing child nodes.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      260fecf1
    • K
      block: Consider all block layer options in append_open_options · 9e700c1a
      Kevin Wolf 提交于
      The code already special-cased "node-name", which is currently the only
      option passed in the QDict that isn't driver-specific. Generalise the
      code to take all general block layer options into consideration.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      9e700c1a
    • K
      block: Allow references for backing files · d9b7b057
      Kevin Wolf 提交于
      For bs->file, using references to existing BDSes has been possible for a
      while already. This patch enables the same for bs->backing.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      d9b7b057
    • K
      mirror: Error out when a BDS would get two BBs · 40365552
      Kevin Wolf 提交于
      bdrv_replace_in_backing_chain() asserts that not both old and new
      BlockDdriverState have a BlockBackend attached to them because both
      would have to end up pointing to the new BDS and we don't support more
      than one BB per BDS yet.
      
      Before we can safely allow references to existing nodes as backing
      files, we need to make sure that even if a backing file has a BB on it,
      this doesn't crash qemu.
      
      There are probably also some cases with the 'replaces' option set where
      drive-mirror could fail this assertion today. They are fixed with this
      error check as well.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      40365552
    • K
      block: Fix reopen with semantically overlapping options · cddff5ba
      Kevin Wolf 提交于
      This fixes bdrv_reopen() calls like the following one:
      
          qemu-io -c 'open -o overlap-check.template=all /tmp/test.qcow2' \
          -c 'reopen -o overlap-check=none'
      
      The approach taken so far would result in an options QDict that has both
      "overlap-check.template=all" and "overlap-check=none", which obviously
      conflicts. In this case, the old option should be overridden by the
      newly specified option.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      cddff5ba
    • K
      qcow2: Add .bdrv_join_options callback · 5365f44d
      Kevin Wolf 提交于
      qcow2 accepts a few driver-specific options that overlap semantically
      (e.g. "overlap-check" is an alias of "overlap-check.template", and any
      missing cache size option is derived from the given ones).
      
      When bdrv_reopen() merges the set of updated options with left out
      options that should be kept at their old value, we need to consider this
      and filter out any duplicates (which would generally cause errors
      because new and old value would contradict each other).
      
      This patch adds a .bdrv_join_options callback to BlockDriver and
      implements it for qcow2.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      5365f44d
    • J
      iotests: 124: don't reopen qcow2 · 35cea223
      John Snow 提交于
      Don't create two interfaces to the same drive in the recently moved
      failure test.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      35cea223
    • J
      iotests: 124: move incremental failure test · ce2cbc49
      John Snow 提交于
      Code motion only, in preparation for adjusting
      the setUp procedure for this test.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ce2cbc49
    • J
      iotests: 124: Split into two test classes · 1b19bb9d
      John Snow 提交于
      Split it into an abstract test class and an implementation class.
      
      The split is primarily to facilitate more flexible setUp variations
      for other kinds of tests without having to rewrite or shuffle around
      all of these helpers.
      
      See the following two patches for more of the "why."
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1b19bb9d
    • P
      Merge remote-tracking branch 'remotes/berrange/tags/pull-io-channel-base-2015-12-18-1' into staging · 67a70840
      Peter Maydell 提交于
      Merge I/O channels base classes
      
      # gpg: Signature made Fri 18 Dec 2015 12:18:38 GMT using RSA key ID 15104FDF
      # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
      # gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
      
      * remotes/berrange/tags/pull-io-channel-base-2015-12-18-1:
        io: add QIOChannelBuffer class
        io: add QIOChannelCommand class
        io: add QIOChannelWebsock class
        io: add QIOChannelTLS class
        io: add QIOChannelFile class
        io: add QIOChannelSocket class
        io: add QIOTask class for async operations
        io: add helper module for creating watches on FDs
        io: add abstract QIOChannel classes
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      67a70840
    • D
      io: add QIOChannelBuffer class · d98e4eb7
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of performing I/O
      to/from a memory buffer. This implementation does not attempt
      to support concurrent readers & writers. It is designed for
      serialized access where by a single thread at a time may write
      data, seek and then read data back out.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d98e4eb7
    • D
      io: add QIOChannelCommand class · 195e14d0
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of performing I/O
      to/from a separate process, via a pair of pipes. The command
      can be used for unidirectional or bi-directional I/O.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      195e14d0
    • D
      io: add QIOChannelWebsock class · 2d1d0e70
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that can run the websocket protocol over
      the top of another QIOChannel instance. This initial implementation
      is only capable of acting as a websockets server. There is no support
      for acting as a websockets client yet.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2d1d0e70
    • D
      io: add QIOChannelTLS class · ed8ee42c
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that can run the TLS protocol over
      the top of another QIOChannel instance. The object provides a
      simplified API to perform the handshake when starting the TLS
      session. The layering of TLS over the underlying channel does
      not have to be setup immediately. It is possible to take an
      existing QIOChannel that has done some handshake and then swap
      in the QIOChannelTLS layer. This allows for use with protocols
      which start TLS right away, and those which start plain text
      and then negotiate TLS.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ed8ee42c
    • D
      io: add QIOChannelFile class · d6e48869
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of operating on things
      that are files, such as plain files, pipes, character/block
      devices, but notably not sockets.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d6e48869
    • D
      io: add QIOChannelSocket class · 559607ea
      Daniel P. Berrange 提交于
      Implement a QIOChannel subclass that supports sockets I/O.
      The implementation is able to manage a single socket file
      descriptor, whether a TCP/UNIX listener, TCP/UNIX connection,
      or a UDP datagram. It provides APIs which can listen and
      connect either asynchronously or synchronously. Since there
      is no asynchronous DNS lookup API available, it uses the
      QIOTask helper for spawning a background thread to ensure
      non-blocking operation.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      559607ea
    • D
      io: add QIOTask class for async operations · b02db2d9
      Daniel P. Berrange 提交于
      A number of I/O operations need to be performed asynchronously
      to avoid blocking the main loop. The caller of such APIs need
      to provide a callback to be invoked on completion/error and
      need access to the error, if any. The small QIOTask provides
      a simple framework for dealing with such probes. The API
      docs inline provide an outline of how this is to be used.
      
      Some functions don't have the ability to run asynchronously
      (eg getaddrinfo always blocks), so to facilitate their use,
      the task class provides a mechanism to run a blocking
      function in a thread, while triggering the completion
      callback in the main event loop thread. This easily allows
      any synchronous function to be made asynchronous, albeit
      at the cost of spawning a thread.
      
      In this series, the QIOTask class will be used for things like
      the TLS handshake, the websockets handshake and TCP connect()
      progress.
      
      The concept of QIOTask is inspired by the GAsyncResult
      interface / GTask class in the GIO libraries. The min
      version requirements on glib don't allow those to be
      used from QEMU, so QIOTask provides a facsimilie which
      can be easily switched to GTask in the future if the
      min version is increased.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b02db2d9
    • D
      io: add helper module for creating watches on FDs · 1c809fa0
      Daniel P. Berrange 提交于
      A number of the channel implementations will require the
      ability to create watches on file descriptors / sockets.
      To avoid duplicating this code in each channel, provide a
      helper API for dealing with file descriptor watches.
      
      There are two watch implementations provided. The first
      is useful for bi-directional file descriptors such as
      sockets, regular files, character devices, etc. The
      second works with a pair of unidirectional file descriptors
      such as pipes.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c809fa0
    • D
      io: add abstract QIOChannel classes · 666a3af9
      Daniel P. Berrange 提交于
      Start the new generic I/O channel framework by defining a
      QIOChannel abstract base class. This is designed to feel
      similar to GLib's GIOChannel, but with the addition of
      support for using iovecs, qemu error reporting, file
      descriptor passing, coroutine integration and use of
      the QOM framework for easier sub-classing.
      
      The intention is that anywhere in QEMU that almost
      anywhere that deals with sockets will use this new I/O
      infrastructure, so that it becomes trivial to then layer
      in support for TLS encryption. This will at least include
      the VNC server, char device backend and migration code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      666a3af9
    • P
      Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging · 6a653321
      Peter Maydell 提交于
      * KVM: synic support, split irqchip support
      * memory: cleanups, optimizations, ioeventfd emulation
      * SCSI: small fixes, vmw_pvscsi compatibility improvements
      * qemu_log cleanups
      * Coverity model improvements
      
      # gpg: Signature made Thu 17 Dec 2015 16:35:21 GMT using RSA key ID 78C7AE83
      # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
      # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
      
      * remotes/bonzini/tags/for-upstream: (45 commits)
        coverity: Model g_memdup()
        coverity: Model g_poll()
        scsi: always call notifier on async cancellation
        scsi: use scsi_req_cancel_async when purging requests
        target-i386: kvm: clear unusable segments' flags in migration
        rcu: optimize rcu_read_lock
        memory: try to inline constant-length reads
        memory: inline a few small accessors
        memory: extract first iteration of address_space_read and address_space_write
        memory: split address_space_read and address_space_write
        memory: avoid unnecessary object_ref/unref
        memory: reorder MemoryRegion fields
        exec: make qemu_ram_ptr_length more similar to qemu_get_ram_ptr
        exec: always call qemu_get_ram_ptr within rcu_read_lock
        linux-user: convert DEBUG_SIGNAL logging to tracepoints
        linux-user: avoid "naked" qemu_log
        user: introduce "-d page"
        xtensa: avoid "naked" qemu_log
        tricore: avoid "naked" qemu_log
        ppc: cleanup logging
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      6a653321
    • M
      coverity: Model g_memdup() · 29cd81ff
      Markus Armbruster 提交于
      We model all the non-deprecated memory allocation functions from
      https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html
      except for g_memdup(), g_clear_pointer(), g_steal_pointer().  We don't
      use the latter two.  Model the former.
      
      Coverity now reports an OVERRUN
      vl.c:2317: alloc_strlen: Allocating insufficient memory for the terminating null of the string.
      Correct, but we omit the terminating null intentionally there.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1448901152-11716-1-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      29cd81ff
    • M
      coverity: Model g_poll() · 1e819697
      Markus Armbruster 提交于
      In my testing, Coverity reported two more CHECKED_RETURN:
      
      * qemu-char.c:1248: fixed in commit c1f24489: "qemu-char: retry g_poll
        on EINTR".
      
      * migration/qemu-file-unix.c:75: harmless, cleaned up in commit
        4e39f57c "migration: Clean up use of g_poll() in
        socket_writev_buffer()
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450336833-27710-1-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1e819697
    • P
      scsi: always call notifier on async cancellation · 36896bff
      Paolo Bonzini 提交于
      This was found by code inspection.  If the request is cancelled twice,
      the notifier is never called on the second cancellation request,
      and hence for example a TMF might never finish.
      
      All the calls in scsi_req_cancel_async are idempotent, so the change
      is safe.
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1450290827-30508-2-git-send-email-pbonzini@redhat.com>
      36896bff
    • P
      scsi: use scsi_req_cancel_async when purging requests · 8aad35f6
      Paolo Bonzini 提交于
      This avoids calls to aio_poll without having acquired the context first.
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1450290827-30508-1-git-send-email-pbonzini@redhat.com>
      8aad35f6
    • M
      target-i386: kvm: clear unusable segments' flags in migration · 4cae9c97
      Michael Chapman 提交于
      This commit fixes migration of a QEMU/KVM guest from kernel >= v3.9 to
      kernel <= v3.7 (e.g. from RHEL 7 to RHEL 6). Without this commit a guest
      migrated across these kernel versions fails to resume on the target host
      as its segment descriptors are invalid.
      
      Two separate kernel commits combined together to result in this bug:
      
        commit f0495f9b9992f80f82b14306946444b287193390
        Author: Avi Kivity <avi@redhat.com>
        Date:   Thu Jun 7 17:06:10 2012 +0300
      
            KVM: VMX: Relax check on unusable segment
      
            Some userspace (e.g. QEMU 1.1) munge the d and g bits of segment
            descriptors, causing us not to recognize them as unusable segments
            with emulate_invalid_guest_state=1.  Relax the check by testing for
            segment not present (a non-present segment cannot be usable).
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      
        commit 25391454e73e3156202264eb3c473825afe4bc94
        Author: Gleb Natapov <gleb@redhat.com>
        Date:   Mon Jan 21 15:36:46 2013 +0200
      
            KVM: VMX: don't clobber segment AR of unusable segments.
      
            Usability is returned in unusable field, so not need to clobber entire
            AR. Callers have to know how to deal with unusable segments already
            since if emulate_invalid_guest_state=true AR is not zeroed.
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      
      The first commit changed the KVM_SET_SREGS ioctl so that it did no treat
      segment flags == 0 as an unusable segment, instead only looking at the
      "present" flag.
      
      The second commit changed KVM_GET_SREGS so that it did not clear the
      flags of an unusable segment.
      
      Since QEMU does not itself maintain the "unusable" flag across a
      migration, the end result is that unusable segments read from a kernel
      with these commits and loaded into a kernel without these commits are
      not properly recognised as being unusable.
      
      This commit updates both get_seg and set_seg so that the problem is
      avoided even when migrating to or migrating from a QEMU without this
      commit. In get_seg, we clear the segment flags if the segment is marked
      unusable. In set_seg, we mark the segment unusable if the segment's
      "present" flag is not set.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      Message-Id: <1449464047-17467-1-git-send-email-mike@very.puzzling.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4cae9c97
    • P
      rcu: optimize rcu_read_lock · f6d153f1
      Paolo Bonzini 提交于
      rcu_read_lock cannot change rcu_gp_ongoing from true to false
      (the previous value of p_rcu_reader->ctr is zero), hence
      there is no need to check p_rcu_reader->waiting and wake up
      a concurrent synchronize_rcu.
      
      While at it mark the wakeup as unlikely in rcu_read_unlock.
      Reviewed-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1450265542-4323-1-git-send-email-pbonzini@redhat.com>
      f6d153f1