1. 25 8月, 2017 10 次提交
  2. 04 8月, 2017 29 次提交
    • E
      pc: Use "min-[x]level" on compat_props · 2401d8a4
      Eduardo Habkost 提交于
      Since the automatic cpuid-level code was introduced in commit
      c39c0edf ("target-i386: Automatically
      set level/xlevel/xlevel2 when needed"), the CPU model tables just define
      the default CPUID level code (set using "min-level").  Setting
      "[x]level" forces CPUID level to a specific value and disable the
      automatic-level logic.
      
      But the PC compat code was not updated and the existing "[x]level"
      compat properties broke compatibility for people using features that
      triggered the auto-level code.  To keep previous behavior, we should set
      "min-[x]level" instead of "[x]level" on compat_props.
      
      This was not a problem for most cases, because old machine-types don't
      have full-cpuid-auto-level enabled.  The only common use case it broke
      was the CPUID[7] auto-level code, that was already enabled since the
      first CPUID[7] feature was introduced (in QEMU 1.4.0).
      
      This causes the regression reported at:
      https://bugzilla.redhat.com/show_bug.cgi?id=1454641
      
      Change the PC compat code to use "min-[x]level" instead of "[x]level" on
      compat_props, and add new test cases to ensure we don't break this
      again.
      Reported-by: N"Guo, Zhiyi" <zhguo@redhat.com>
      Fixes: c39c0edf ("target-i386: Automatically set level/xlevel/xlevel2 when needed")
      Cc: qemu-stable@nongnu.org
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      (cherry picked from commit 1f435716)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      2401d8a4
    • M
      monitor: fix object_del for command-line-created objects · 1775fe61
      Michael Roth 提交于
      Currently objects specified on the command-line are only partially
      cleaned up when 'object_del' is issued in either HMP or QMP: the
      object itself is fully finalized, but the QemuOpts are not removed.
      This results in the following behavior:
      
        x86_64-softmmu/qemu-system-x86_64 -monitor stdio \
          -object memory-backend-ram,id=ram1,size=256M
      
        QEMU 2.7.91 monitor - type 'help' for more information
        (qemu) object_del ram1
        (qemu) object_del ram1
        object 'ram1' not found
        (qemu) object_add memory-backend-ram,id=ram1,size=256M
        Duplicate ID 'ram1' for object
        Try "help object_add" for more information
      
      which can be an issue for use-cases like memory hotplug.
      
      This happens on the HMP side because hmp_object_add() attempts to
      create a temporary QemuOpts entry with ID 'ram1', which ends up
      conflicting with the command-line-created entry, since it was never
      cleaned up during the previous hmp_object_del() call.
      
      We address this by adding a check in user_creatable_del(), which
      is called by both qmp_object_del() and hmp_object_del() to handle
      the actual object cleanup, to determine whether an option group entry
      matching the object's ID is present and removing it if it is.
      
      Note that qmp_object_add() never attempts to create a temporary
      QemuOpts entry, so it does not encounter the duplicate ID error,
      which is why this isn't generally visible in libvirt.
      
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Daniel Berrange <berrange@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1496531612-22166-3-git-send-email-mdroth@linux.vnet.ibm.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      (cherry picked from commit c645d5ac)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      1775fe61
    • M
      tests: check-qom-proplist: add checks for cmdline-created objects · b0a3eadd
      Michael Roth 提交于
      check-qom-proplist originally added tests for verifying that
      object-creation helpers object_new_with_{props,propv} behaved in
      similar fashion to the "traditional" method involving setting each
      individual property separately after object creation rather than
      via a single call.
      
      Another similar "helper" for creating Objects exists in the form of
      objects specified via -object command-line parameters. By that
      rationale, we extend check-qom-proplist to include similar checks
      for command-line-created objects by employing the same
      qemu_opts_parse()-based parsing the vl.c employs.
      
      This parser has a side-effect of parsing the object's options into
      a QemuOpt structure and registering this in the global QemuOptsList
      using the Object's ID. This can conflict with future Object instances
      that attempt to use the same ID if we don't ensure this is cleaned
      up as part of Object finalization, so we include a FIXME stub to test
      for this case, which will then be resolved in a subsequent patch.
      Suggested-by: NDaniel Berrange <berrange@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Daniel Berrange <berrange@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1496531612-22166-2-git-send-email-mdroth@linux.vnet.ibm.com>
      [Comment formatting tidied up]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      
      (cherry picked from commit a1af255f)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      b0a3eadd
    • P
      linuxboot_dma: compile for i486 · 3b428e95
      Paolo Bonzini 提交于
      The ROM uses the cmovne instruction, which is new in Pentium Pro and does not
      work when running QEMU with "-cpu 486".  Avoid producing that instruction.
      Suggested-by: NRichard W.M. Jones <rjones@redhat.com>
      Suggested-by: NThomas Huth <thuth@redhat.com>
      Reported-by: NRob Landley <rob@landley.net>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 7e018385)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      3b428e95
    • L
      virtio-serial-bus: Unset hotplug handler when unrealize · 11bac2f9
      Ladi Prosek 提交于
      Virtio serial device controls the lifetime of virtio-serial-bus and
      virtio-serial-bus links back to the device via its hotplug-handler
      property. This extra ref-count prevents the device from getting
      finalized, leaving the VirtIODevice memory listener registered and
      leading to use-after-free later on.
      
      This patch addresses the same issue as Fam Zheng's
      "virtio-scsi: Unset hotplug handler when unrealize"
      only for a different virtio device.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      (cherry picked from commit f811f970)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      11bac2f9
    • K
      mirror: Drop permissions on s->target on completion · 0ebbef1f
      Kevin Wolf 提交于
      This fixes an assertion failure that was triggered by qemu-iotests 129
      on some CI host, while the same test case didn't seem to fail on other
      hosts.
      
      Essentially the problem is that the blk_unref(s->target) in
      mirror_exit() doesn't necessarily mean that the BlockBackend goes away
      immediately. It is possible that the job completion was triggered nested
      in mirror_drain(), which looks like this:
      
          BlockBackend *target = s->target;
          blk_ref(target);
          blk_drain(target);
          blk_unref(target);
      
      In this case, the write permissions for s->target are retained until
      after blk_drain(), which makes removing mirror_top_bs fail for the
      active commit case (can't have a writable backing file in the chain
      without the filter driver).
      
      Explicitly dropping the permissions first means that the additional
      reference doesn't hurt and the job can complete successfully even if
      called from the nested blk_drain().
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit 63c8ef28)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      0ebbef1f
    • E
      block: Guarantee that *file is set on bdrv_get_block_status() · 64945cb5
      Eric Blake 提交于
      We document that *file is valid if the return is not an error and
      includes BDRV_BLOCK_OFFSET_VALID, but forgot to obey this contract
      when a driver (such as blkdebug) lacks a callback.  Messed up in
      commit 67a0fd2a (v2.6), when we added the file parameter.
      
      Enhance qemu-iotest 177 to cover this, using a sequence that would
      print garbage or even SEGV, because it was dererefencing through
      uninitialized memory.  [The resulting test output shows that we
      have less-than-ideal block status from the blkdebug driver, but
      that's a separate fix coming up soon.]
      
      Setting *file on all paths that return BDRV_BLOCK_OFFSET_VALID is
      enough to fix the crash, but we can go one step further: always
      setting *file, even on error, means that a broken caller that
      blindly dereferences file without checking for error is now more
      likely to get a reliable SEGV instead of randomly acting on garbage,
      making it easier to diagnose such buggy callers.  Adding an
      assertion that file is set where expected doesn't hurt either.
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      (cherry picked from commit 81c219ac)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      64945cb5
    • E
      block: Simplify BDRV_BLOCK_RAW recursion · 6a3f9c5c
      Eric Blake 提交于
      Since we are already in coroutine context during the body of
      bdrv_co_get_block_status(), we can shave off a few layers of
      wrappers when recursing to query the protocol when a format driver
      returned BDRV_BLOCK_RAW.
      
      Note that we are already using the correct recursion later on in
      the same function, when probing whether the protocol layer is sparse
      in order to find out if we can add BDRV_BLOCK_ZERO to an existing
      BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-id: 20170504173745.27414-1-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      (cherry picked from commit ee29d6ad)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      6a3f9c5c
    • E
      tests: Add coverage for recent block geometry fixes · 3f3fe284
      Eric Blake 提交于
      Use blkdebug's new geometry constraints to emulate setups that
      have needed past regression fixes: write zeroes asserting
      when running through a loopback block device with max-transfer
      smaller than cluster size, and discard rounding away portions
      of requests not aligned to preferred boundaries.  Also, add
      coverage that the block layer is honoring max transfer limits.
      
      For now, a single iotest performs all actions, with the idea
      that we can add future blkdebug constraint test cases in the
      same file; but it can be split into multiple iotests if we find
      reason to run one portion of the test in more setups than what
      are possible in the other.
      
      For reference, the final portion of the test (checking whether
      discard passes as much as possible to the lowest layers of the
      stack) works as follows:
      
      qemu-io: discard 30M at 80000001, passed to blkdebug
        blkdebug: discard 511 bytes at 80000001, -ENOTSUP (smaller than
      blkdebug's 512 align)
        blkdebug: discard 14371328 bytes at 80000512, passed to qcow2
          qcow2: discard 739840 bytes at 80000512, -ENOTSUP (smaller than
      qcow2's 1M align)
          qcow2: discard 13M bytes at 77M, succeeds
        blkdebug: discard 15M bytes at 90M, passed to qcow2
          qcow2: discard 15M bytes at 90M, succeeds
        blkdebug: discard 1356800 bytes at 105M, passed to qcow2
          qcow2: discard 1M at 105M, succeeds
          qcow2: discard 308224 bytes at 106M, -ENOTSUP (smaller than qcow2's
      1M align)
        blkdebug: discard 1 byte at 111457280, -ENOTSUP (smaller than
      blkdebug's 512 align)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170429191419.30051-10-eblake@redhat.com
      [mreitz: For cooperation with image locking, add -r to the qemu-io
               invocation which verifies the image content]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      
      (cherry picked from commit 40812d93)
       Conflicts:
      	tests/qemu-iotests/group
      * dropped context dependency on other test groups
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      3f3fe284
    • E
      blkdebug: Add ability to override unmap geometries · 48f2dc06
      Eric Blake 提交于
      Make it easier to simulate various unusual hardware setups (for
      example, recent commits 3482b9bc and b8d0a980 affect the Dell
      Equallogic iSCSI with its 15M preferred and maximum unmap and
      write zero sizing, or b2f95fee deals with the Linux loopback
      block device having a max_transfer of 64k), by allowing blkdebug
      to wrap any other device with further restrictions on various
      alignments.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170429191419.30051-9-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit 430b26a8)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      48f2dc06
    • E
      blkdebug: Simplify override logic · 3ae74003
      Eric Blake 提交于
      Rather than store into a local variable, then copy to the struct
      if the value is valid, then reporting errors otherwise, it is
      simpler to just store into the struct and report errors if the
      value is invalid.  This however requires that the struct store
      a 64-bit number, rather than a narrower type.  Likewise, setting
      a sane errno value in ret prior to the sequence of parsing and
      jumping to out: on error makes it easier for the next patch to
      add a chain of similar checks.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170429191419.30051-8-eblake@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit 3dc834f8)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      3ae74003
    • E
      blkdebug: Add pass-through write_zero and discard support · 577cf9e6
      Eric Blake 提交于
      In order to test the effects of artificial geometry constraints
      on operations like write zero or discard, we first need blkdebug
      to manage these actions.  It also allows us to inject errors on
      those operations, just like we can for read/write/flush.
      
      We can also test the contract promised by the block layer; namely,
      if a device has specified limits on alignment or maximum size,
      then those limits must be obeyed (for now, the blkdebug driver
      merely inherits limits from whatever it is wrapping, but the next
      patch will further enhance it to allow specific limit overrides).
      
      This patch intentionally refuses to service requests smaller than
      the requested alignments; this is because an upcoming patch adds
      a qemu-iotest to prove that the block layer is correctly handling
      fragmentation, but the test only works if there is a way to tell
      the difference at artificial alignment boundaries when blkdebug is
      using a larger-than-default alignment.  If we let the blkdebug
      layer always defer to the underlying layer, which potentially has
      a smaller granularity, the iotest will be thwarted.
      
      Tested by setting up an NBD server with export 'foo', then invoking:
      $ ./qemu-io
      qemu-io> open -o driver=blkdebug blkdebug::nbd://localhost:10809/foo
      qemu-io> d 0 15M
      qemu-io> w -z 0 15M
      
      Pre-patch, the server never sees the discard (it was silently
      eaten by the block layer); post-patch it is passed across the
      wire.  Likewise, pre-patch the write is always passed with
      NBD_WRITE (with 15M of zeroes on the wire), while post-patch
      it can utilize NBD_WRITE_ZEROES (for less traffic).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170429191419.30051-7-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit 63188c24)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      577cf9e6
    • E
      blkdebug: Refactor error injection · 138cf638
      Eric Blake 提交于
      Rather than repeat the logic at each caller of checking if a Rule
      exists that warrants an error injection, fold that logic into
      inject_error(); and rename it to rule_check() for legibility.
      This will help the next patch, which adds two more callers that
      need to check rules for the potential of injecting errors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170429191419.30051-6-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit d157ed5f)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      138cf638
    • E
      blkdebug: Sanity check block layer guarantees · a1a3d603
      Eric Blake 提交于
      Commits 04ed95f4 and 1a62d0ac updated the block layer to auto-fragment
      any I/O to fit within device boundaries. Additionally, when using a
      minimum alignment of 4k, we want to ensure the block layer does proper
      read-modify-write rather than requesting I/O on a slice of a sector.
      Let's enforce that the contract is obeyed when using blkdebug.  For
      now, blkdebug only allows alignment overrides, and just inherits other
      limits from whatever device it is wrapping, but a future patch will
      further enhance things.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170429191419.30051-5-eblake@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit e0ef4395)
      * prereq for 81c219acSigned-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      a1a3d603
    • Y
      virtio-net: fix wild pointer when remove virtio-net queues · 0b185544
      Yunjian Wang 提交于
      The tx_bh or tx_timer will free in virtio_net_del_queue() function, when
      removing virtio-net queues if the guest doesn't support multiqueue. But
      it might be still referenced by virtio_net_set_status(), which needs to
      be set NULL. And also the tx_waiting needs to be set zero to prevent
      virtio_net_set_status() accessing tx_bh or tx_timer.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NYunjian Wang <wangyunjian@huawei.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      (cherry picked from commit f989c30c)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      0b185544
    • H
      s390x/css: catch section mismatch on load · f3676379
      Halil Pasic 提交于
      Prior to the virtio-ccw-2.7 machine (and commit 2a79eb1a), our virtio
      devices residing under the virtual-css bus do not have qdev_path based
      migration stream identifiers (because their qdev_path is NULL). The ids
      are instead generated when the device is registered as a composition of
      the so called idstr, which takes the vmsd name as its value, and an
      instance_id, which is which is calculated as a maximal instance_id
      registered with the same idstr plus one, or zero (if none was registered
      previously).
      
      That means, under certain circumstances, one device might try, and even
      succeed, to load the state of a different device. This can lead to
      trouble.
      
      Let us fail the migration if the above problem is detected during load.
      
      How to reproduce the problem:
      1) start qemu-system-s390x making sure you have the following devices
         defined on your command line:
           -device virtio-rng-ccw,id=rng1,devno=fe.0.0001
           -device virtio-rng-ccw,id=rng2,devno=fe.0.0002
      2) detach the devices and reattach in reverse order using the monitor:
           (qemu) device_del rng1
           (qemu) device_del rng2
           (qemu) device_add virtio-rng-ccw,id=rng2,devno=fe.0.0002
           (qemu) device_add virtio-rng-ccw,id=rng1,devno=fe.0.0001
      3) save the state of the vm into a temporary file and quit QEMU:
           (qemu) migrate "exec:gzip -c > /tmp/tmp_vmstate.gz"
           (qemu) q
      4) use your command line from step 1 with
           -incoming "exec:gzip -c -d /tmp/tmp_vmstate.gz"
         appended to reproduce the problem (while trying to to load the saved vm)
      
      CC: qemu-stable@nongnu.org
      Signed-off-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reviewed-by: NDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Message-Id: <20170518111405.56947-1-pasic@linux.vnet.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      (cherry picked from commit 8ed179c9)
      * removed context dep on d8d98db5Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      f3676379
    • S
      e1000e: Fix ICR "Other" causes clear logic · 4921c573
      Sameeh Jubran 提交于
      This commit fixes a bug which causes the guest to hang. The bug was
      observed upon a "receive overrun" (bit #6 of the ICR register)
      interrupt which could be triggered post migration in a heavy traffic
      environment. Even though the "receive overrun" bit (#6) is masked out
      by the IMS register (refer to the log below) the driver still receives
      an interrupt as the "receive overrun" bit (#6) causes the "Other" -
      bit #24 of the ICR register - bit to be set as documented below. The
      driver handles the interrupt and clears the "Other" bit (#24) but
      doesn't clear the "receive overrun" bit (#6) which leads to an
      infinite loop. Apparently the Windows driver expects that the "receive
      overrun" bit and other ones - documented below - to be cleared when
      the "Other" bit (#24) is cleared.
      
      So to sum that up:
      1. Bit #6 of the ICR register is set by heavy traffic
      2. As a results of setting bit #6, bit #24 is set
      3. The driver receives an interrupt for bit 24 (it doesn't receieve an
         interrupt for bit #6 as it is masked out by IMS)
      4. The driver handles and clears the interrupt of bit #24
      5. Bit #6 is still set.
      6. 2 happens all over again
      
      The Interrupt Cause Read - ICR register:
      
      The ICR has the "Other" bit - bit #24 - that is set when one or more
      of the following ICR register's bits are set:
      
      LSC - bit #2, RXO - bit #6, MDAC - bit #9, SRPD - bit #16, ACK - bit
      #17, MNG - bit #18
      
      This bug can occur with any of these bits depending on the driver's
      behaviour and the way it configures the device. However, trying to
      reproduce it with any bit other than RX0 is challenging and came to
      failure as the drivers don't implement most of these bits, trying to
      reproduce it with LSC (Link Status Change - bit #2) bit didn't succeed
      too as it seems that Windows handles this bit differently.
      
      Log sample of the storm:
      
      27563@1494850819.411877:e1000e_irq_pending_interrupts ICR PENDING: 0x1000000 (ICR: 0x815000c2, IMS: 0x1a00004)
      27563@1494850819.411900:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.411915:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.412380:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.412395:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.412436:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.412441:e1000e_irq_pending_interrupts ICR PENDING: 0x0 (ICR: 0x815000c2, IMS: 0xa00004)
      27563@1494850819.412998:e1000e_irq_pending_interrupts ICR PENDING: 0x1000000 (ICR: 0x815000c2, IMS: 0x1a00004)
      
      * This bug behaviour wasn't observed with the Linux driver.
      
      This commit solves:
      https://bugzilla.redhat.com/show_bug.cgi?id=1447935
      https://bugzilla.redhat.com/show_bug.cgi?id=1449490
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NSameeh Jubran <sjubran@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      (cherry picked from commit 82342e91)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      4921c573
    • F
      virtio-scsi: Unset hotplug handler when unrealize · 952cc382
      Fam Zheng 提交于
      This matches the qbus_set_hotplug_handler in realize, and it releases
      the final reference to the embedded VirtIODevice so that it is
      properly finalized.
      
      A use-after-free is fixed with this patch, indirectly:
      virtio_device_instance_finalize wasn't called at hot-unplug, and the
      vdev->listener would be a dangling pointer in the global and the per
      address space listener list. See also RHBZ 1449031.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <20170518102808.30046-1-famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      (cherry picked from commit 2cbe2de5)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      952cc382
    • G
      virtio: allow broken device to notify guest · c6b510d1
      Greg Kurz 提交于
      According to section 2.1.2 of the virtio-1 specification:
      
      "The device SHOULD set DEVICE_NEEDS_RESET when it enters an error state that
      a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET,
      the device MUST send a device configuration change notification to the
      driver."
      
      Commit "f5ed3663 virtio: stop virtqueue processing if device is broken"
      introduced a virtio_error() call that just does that:
      
      - internally mark the device as broken
      - set the DEVICE_NEEDS_RESET bit in the status
      - send a configuration change notification
      
      Unfortunately, virtio_notify_vector(), called by virtio_notify_config(),
      returns right away when the device is marked as broken and the notification
      isn't sent in this case.
      
      The spec doesn't say whether a broken device can send notifications
      in other situations or not. But since the driver isn't supposed to do
      anything but to reset the device, it makes sense to keep the check in
      virtio_notify_config().
      
      Marking the device as broken AFTER the configuration change notification was
      sent is enough to fix the issue.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      (cherry picked from commit 66453cff)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      c6b510d1
    • H
      vvfat: fix qemu-img map and qemu-img convert · 636eacb6
      Hervé Poussineau 提交于
      - bs->total_sectors is the number of sectors of the whole disk
      - s->sector_count is the number of sectors of the FAT partition
      
      This fixes the following assert in qemu-img map:
      qemu-img.c:2641: get_block_status: Assertion `nb_sectors' failed.
      
      This also fixes an infinite loop in qemu-img convert.
      
      Fixes: 4480e0f9
      Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      (cherry picked from commit 139921aa)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      636eacb6
    • A
      stream: fix crash in stream_start() when block_job_create() fails · c60a8ed8
      Alberto Garcia 提交于
      The code that tries to reopen a BlockDriverState in stream_start()
      when the creation of a new block job fails crashes because it attempts
      to dereference a pointer that is known to be NULL.
      
      This is a regression introduced in a170a91f,
      likely because the code was copied from stream_complete().
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NKashyap Chamarthy <kchamart@redhat.com>
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Tested-by: NKashyap Chamarthy <kchamart@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      (cherry picked from commit 525989a5)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      c60a8ed8
    • P
      curl: avoid recursive locking of BDRVCURLState mutex · c79bef68
      Paolo Bonzini 提交于
      The curl driver has a ugly hack where, if it cannot find an empty CURLState,
      it just uses aio_poll to wait for one to be empty.  This is probably
      buggy when used together with dataplane, and the simplest way to fix it
      is to use coroutines instead.
      
      A more immediate effect of the bug however is that it can cause a
      recursive call to curl_readv_bh_cb and recursively taking the
      BDRVCURLState mutex.  This causes a deadlock.
      
      The fix is to unlock the mutex around aio_poll, but for cleanliness we
      should also take the mutex around all calls to curl_init_state, even if
      reaching the unlock/lock pair is impossible.  The same is true for
      curl_clean_state.
      Reported-by: NKun Wei <kuwei@redhat.com>
      Tested-by: NRichard W.M. Jones <rjones@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 20170515100059.15795-4-pbonzini@redhat.com
      Cc: qemu-stable@nongnu.org
      Cc: Jeff Cody <jcody@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      (cherry picked from commit 456af346)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      c79bef68
    • P
      curl: never invoke callbacks with s->mutex held · 4b519b9f
      Paolo Bonzini 提交于
      All curl callbacks go through curl_multi_do, and hence are called with
      s->mutex held.  Note that with comments, and make curl_read_cb drop the
      lock before invoking the callback.
      
      Likewise for curl_find_buf, where the callback can be invoked by the
      caller.
      
      Cc: qemu-stable@nongnu.org
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170515100059.15795-3-pbonzini@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      (cherry picked from commit 34db05e7)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      4b519b9f
    • P
      curl: strengthen assertion in curl_clean_state · f00c08cb
      Paolo Bonzini 提交于
      curl_clean_state should only be called after all AIOCBs have been
      completed.  This is not so obvious for the call from curl_detach_aio_context,
      so assert that.
      
      Cc: qemu-stable@nongnu.org
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170515100059.15795-2-pbonzini@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      (cherry picked from commit 675a7756)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      f00c08cb
    • M
      target/xtensa: fix return value of read/write simcalls · d81db0be
      Max Filippov 提交于
      Return value of read/write simcalls is not calculated correctly in case
      of operations crossing page boundary and in case of short reads/writes.
      Read and write simcalls should return the size of data actually
      read/written or -1 in case of error.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      (cherry picked from commit 347ec030)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      d81db0be
    • M
      target/xtensa: fix mapping direction in read/write simcalls · e4422534
      Max Filippov 提交于
      Read and write simcalls map physical memory to access I/O buffers, but
      'read' simcall need to map it for writing and 'write' simcall need to
      map it for reading, i.e. the opposite of what they do now. Fix that.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      (cherry picked from commit 30c2afd1)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      e4422534
    • J
      blockdev: use drained_begin/end for qmp_block_resize · af8ca55a
      John Snow 提交于
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1447551
      
      If one tries to issue a block_resize while a guest is busy
      accessing the disk, it is possible that qemu may deadlock
      when invoking aio_poll from both the main loop and the iothread.
      
      Replace another instance of bdrv_drain_all that doesn't
      quite belong.
      
      Cc: qemu-stable@nongnu.org
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      (cherry picked from commit 698bdfa0)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      af8ca55a
    • M
      block: Add errp to b{lk,drv}_truncate() · 5797a36a
      Max Reitz 提交于
      For one thing, this allows us to drop the error message generation from
      qemu-img.c and blockdev.c and instead have it unified in
      bdrv_truncate().
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170328205129.15138-3-mreitz@redhat.com
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit ed3d2ec9)
      * prereq for 698bdfa0Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      5797a36a
    • M
      block/vhdx: Make vhdx_create() always set errp · 73aa7ad7
      Max Reitz 提交于
      This patch makes vhdx_create() always set errp in case of an error. It
      also adds errp parameters to vhdx_create_bat() and
      vhdx_create_new_region_table() so we can pass on the error object
      generated by blk_truncate() as of a future commit.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Message-id: 20170328205129.15138-2-mreitz@redhat.com
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      (cherry picked from commit 55b9392b)
      * prereq for 698bdfa0Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      73aa7ad7
  3. 01 8月, 2017 1 次提交