qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] fed105: virtio-blk-dataplane: delete bottom h


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] fed105: virtio-blk-dataplane: delete bottom half before th...
Date: Wed, 29 Jul 2015 11:00:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: fed105e2756dde98efa5e80baca02ae516dd1e51
      
https://github.com/qemu/qemu/commit/fed105e2756dde98efa5e80baca02ae516dd1e51
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-07-29 (Wed, 29 Jul 2015)

  Changed paths:
    M hw/block/dataplane/virtio-blk.c

  Log Message:
  -----------
  virtio-blk-dataplane: delete bottom half before the AioContext is freed

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: Cornelia Huck <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: a076972a4d36381d610a854f0c336507650a1d34
      
https://github.com/qemu/qemu/commit/a076972a4d36381d610a854f0c336507650a1d34
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2015-07-29 (Wed, 29 Jul 2015)

  Changed paths:
    M async.c

  Log Message:
  -----------
  AioContext: avoid leaking BHs on cleanup

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: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: ca96ac44dcd290566090b2435bc828fded356ad9
      
https://github.com/qemu/qemu/commit/ca96ac44dcd290566090b2435bc828fded356ad9
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2015-07-29 (Wed, 29 Jul 2015)

  Changed paths:
    M async.c
    M include/block/aio.h

  Log Message:
  -----------
  AioContext: force event loop iteration using BH

The notify_me optimization introduced in commit eabc97797310
("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 <address@hidden> for investigating this bug
with me.

Cc: Christian Borntraeger <address@hidden>
Cc: Cornelia Huck <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 46739a2d7ace71b43cacf73ea71c10429db0d5e8
      
https://github.com/qemu/qemu/commit/46739a2d7ace71b43cacf73ea71c10429db0d5e8
  Author: Peter Maydell <address@hidden>
  Date:   2015-07-29 (Wed, 29 Jul 2015)

  Changed paths:
    M async.c
    M hw/block/dataplane/virtio-blk.c
    M include/block/aio.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into 
staging

Pull request

These fixes make dataplane work again after the notify_me optimization was
added.  They also solve QEMUBH memory leaks and fix a bug in dataplane's
cleanup code.

# gpg: Signature made Wed Jul 29 14:50:26 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>"
# gpg:                 aka "Stefan Hajnoczi <address@hidden>"

* remotes/stefanha/tags/block-pull-request:
  AioContext: force event loop iteration using BH
  AioContext: avoid leaking BHs on cleanup
  virtio-blk-dataplane: delete bottom half before the AioContext is freed

Signed-off-by: Peter Maydell <address@hidden>


  Commit: 7008d580acad326148a725bd20695882ba10247a
      
https://github.com/qemu/qemu/commit/7008d580acad326148a725bd20695882ba10247a
  Author: Peter Maydell <address@hidden>
  Date:   2015-07-29 (Wed, 29 Jul 2015)

  Changed paths:
    M VERSION

  Log Message:
  -----------
  Update version for v2.4.0-rc3 release

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/b83d017d88b2...7008d580acad

reply via email to

[Prev in Thread] Current Thread [Next in Thread]