1. 01 8月, 2015 1 次提交
  2. 30 7月, 2015 2 次提交
  3. 29 7月, 2015 5 次提交
    • S
      AioContext: force event loop iteration using BH · ca96ac44
      Stefan Hajnoczi 提交于
      The notify_me optimization introduced in commit eabc9779
      ("AioContext: fix broken ctx->dispatching optimization") skips
      event_notifier_set() calls when the event loop thread is not blocked in
      ppoll(2).
      
      This optimization causes a deadlock if two aio_context_acquire() calls
      race.  notify_me = 0 during the race so the winning thread can enter
      ppoll(2) unaware that the other thread is waiting its turn to acquire
      the AioContext.
      
      This patch forces ppoll(2) to return by scheduling a BH instead of
      calling aio_notify().
      
      The following deadlock with virtio-blk dataplane is fixed:
      
        qemu ... -object iothread,id=iothread0 \
                 -drive if=none,id=drive0,file=test.img,... \
                 -device virtio-blk-pci,iothread=iothread0,drive=drive0
      
      This command-line results in a hang early on without this patch.
      
      Thanks to Paolo Bonzini <pbonzini@redhat.com> for investigating this bug
      with me.
      
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1438101249-25166-4-git-send-email-pbonzini@redhat.com
      Message-Id: <1438014819-18125-3-git-send-email-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      ca96ac44
    • S
      AioContext: avoid leaking BHs on cleanup · a076972a
      Stefan Hajnoczi 提交于
      BHs are freed during aio_bh_poll().  This leads to memory leaks if there
      is no aio_bh_poll() between qemu_bh_delete() and aio_ctx_finalize().
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1438101249-25166-3-git-send-email-pbonzini@redhat.com
      Message-Id: <1438014819-18125-2-git-send-email-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      a076972a
    • P
      virtio-blk-dataplane: delete bottom half before the AioContext is freed · fed105e2
      Paolo Bonzini 提交于
      Other uses of aio_bh_new are safe as long as all scheduled bottom
      halves are run before an iothread is destroyed, which bdrv_drain will
      ensure:
      
      - archipelago_finish_aiocb: BH deletes itself
      
      - inject_error: BH deletes itself
      
      - blkverify_aio_bh: BH deletes itself
      
      - abort_aio_request: BH deletes itself
      
      - curl_aio_readv: BH deletes itself
      
      - gluster_finish_aiocb: BH deletes itself
      
      - bdrv_aio_rw_vector: BH deletes itself
      
      - bdrv_co_maybe_schedule_bh: BH deletes itself
      
      - iscsi_schedule_bh, iscsi_co_generic_cb: BH deletes itself
      
      - laio_attach_aio_context: deleted in laio_detach_aio_context,
      called through bdrv_detach_aio_context before deleting the iothread
      
      - nfs_co_generic_cb: BH deletes itself
      
      - null_aio_common: BH deletes itself
      
      - qed_aio_complete: BH deletes itself
      
      - rbd_finish_aiocb: BH deletes itself
      
      - dma_blk_cb: BH deletes itself
      
      - virtio_blk_dma_restart_cb: BH deletes itself
      
      - qemu_bh_new: main loop AioContext is never destroyed
      
      - test-aio.c: bh_delete_cb deletes itself, otherwise deleted in
      the same function that calls aio_bh_new
      Reported-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1438101249-25166-2-git-send-email-pbonzini@redhat.com
      Message-Id: <1438086628-13000-1-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      fed105e2
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging · b83d017d
      Peter Maydell 提交于
      Pull request
      
      These two .can_receive() are now reviewed.  The net subsystem queue for 2.4 is now empty.
      
      # gpg: Signature made Tue Jul 28 13:26:03 2015 BST using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      
      * remotes/stefanha/tags/net-pull-request:
        xen: Drop net_rx_ok
        hw/net: handle flow control in mcf_fec driver receiver
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      b83d017d
    • P
      Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging · 170f209d
      Peter Maydell 提交于
      virtio fixes for 2.4
      
      Mostly virtio 1 spec compliance fixes.
      We are unlikely to make it perfectly compliant in
      the first release, but it seems worth it to try.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      
      # gpg: Signature made Mon Jul 27 21:55:48 2015 BST using RSA key ID D28D5469
      # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
      # gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
      
      * remotes/mst/tags/for_upstream:
        virtio: minor cleanup
        acpi: fix pvpanic device is not shown in ui
        virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
        virtio-blk: fail get_features when both scsi and 1.0 were set
        virtio: get_features() can fail
        virtio-pci: fix memory MR cleanup for modern
        virtio: set any_layout in virtio core
        virtio-9p: fix any_layout
        virtio-serial: fix ANY_LAYOUT
        virtio: hide legacy features from modern guests
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      170f209d
  4. 28 7月, 2015 30 次提交
  5. 27 7月, 2015 2 次提交
    • J
      block: qemu-iotests - add check for multiplication overflow in vpc · 77c102c2
      Jeff Cody 提交于
      This checks that VPC is able to successfully fail (without segfault)
      on an image file with a max_table_entries that exceeds 0x40000000.
      
      This table entry is within the valid range for VPC (although too large
      for this sample image).
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      77c102c2
    • J
      block: vpc - prevent overflow if max_table_entries >= 0x40000000 · b15deac7
      Jeff Cody 提交于
      When we allocate the pagetable based on max_table_entries, we multiply
      the max table entry value by 4 to accomodate a table of 32-bit integers.
      However, max_table_entries is a uint32_t, and the VPC driver accepts
      ranges for that entry over 0x40000000.  So during this allocation:
      
      s->pagetable = qemu_try_blockalign(bs->file, s->max_table_entries * 4);
      
      The size arg overflows, allocating significantly less memory than
      expected.
      
      Since qemu_try_blockalign() size argument is size_t, cast the
      multiplication correctly to prevent overflow.
      
      The value of "max_table_entries * 4" is used elsewhere in the code as
      well, so store the correct value for use in all those cases.
      
      We also check the Max Tables Entries value, to make sure that it is <
      SIZE_MAX / 4, so we know the pagetable size will fit in size_t.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NRichard W.M. Jones <rjones@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b15deac7