qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/17] Fix some jobs/drain/aio_poll related hangs
@ 2018-09-13 12:52 Kevin Wolf
  2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 01/17] job: Fix missing locking due to mismerge Kevin Wolf
                   ` (16 more replies)
  0 siblings, 17 replies; 47+ messages in thread
From: Kevin Wolf @ 2018-09-13 12:52 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, famz, pbonzini, slp, jsnow, qemu-devel

Especially the combination of iothreads, block jobs and drain tends to
lead to hangs currently. This series fixes a few of these bugs, although
there are more of them, to be addressed in separate patches.

The primary goal of this series is to fix the scenario from:
https://bugzilla.redhat.com/show_bug.cgi?id=1601212

A simplified reproducer of the reported problem looks like this (two concurrent
commit block jobs for disks in an iothread):

$qemu -qmp stdio \
    -object iothread,id=iothread1 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=0x6,iothread=iothread1 \
    -drive  id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=qcow2,file=hd0 \
    -device scsi-hd,drive=drive_image1,id=image1,bootindex=1 \
    -drive  id=drive_image2,if=none,snapshot=off,aio=threads,cache=none,format=qcow2,file=hd1 \
    -device scsi-hd,drive=drive_image2,id=image2,bootindex=2

{"execute":"qmp_capabilities"}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image1","snapshot-file":"sn1"}}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image1","snapshot-file":"sn11"}}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image1","snapshot-file":"sn111"}}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image2","snapshot-file":"sn2"}}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image2","snapshot-file":"sn22"}}
{"execute":"blockdev-snapshot-sync","arguments":{"device":"drive_image2","snapshot-file":"sn222"}}

{ "execute": "block-commit", "arguments": { "device": "drive_image2","base":"sn2","backing-file":"sn2","top":"sn22"}}
{ "execute": "block-commit", "arguments": { "device": "drive_image1","base":"sn1","backing-file":"sn1","top":"sn11"}}

{"execute":"quit"}

v2:
- Rebased on top of mreitz/block (including fixes for new bugs: patch 1 and 16)
- Patch 12: Added missing bdrv_unref() calls in error path [Fam]

Kevin Wolf (17):
  job: Fix missing locking due to mismerge
  blockjob: Wake up BDS when job becomes idle
  aio-wait: Increase num_waiters even in home thread
  test-bdrv-drain: Drain with block jobs in an I/O thread
  test-blockjob: Acquire AioContext around job_cancel_sync()
  job: Use AIO_WAIT_WHILE() in job_finish_sync()
  test-bdrv-drain: Test AIO_WAIT_WHILE() in completion callback
  block: Add missing locking in bdrv_co_drain_bh_cb()
  block-backend: Add .drained_poll callback
  block-backend: Fix potential double blk_delete()
  block-backend: Decrease in_flight only after callback
  mirror: Fix potential use-after-free in active commit
  blockjob: Lie better in child_job_drained_poll()
  block: Remove aio_poll() in bdrv_drain_poll variants
  test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level()
  job: Avoid deadlocks in job_completed_txn_abort()
  test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort

 include/block/aio-wait.h |   2 +
 include/block/blockjob.h |  13 +++
 include/qemu/coroutine.h |   5 ++
 include/qemu/job.h       |  12 +++
 block/block-backend.c    |  26 +++++-
 block/io.c               |  23 +++--
 block/mirror.c           |  11 +++
 blockjob.c               |  20 ++++-
 job.c                    |  50 ++++++++---
 tests/test-bdrv-drain.c  | 215 ++++++++++++++++++++++++++++++++++++++++++++---
 tests/test-blockjob.c    |   6 ++
 util/qemu-coroutine.c    |   5 ++
 12 files changed, 354 insertions(+), 34 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2018-09-14 17:39 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-13 12:52 [Qemu-devel] [PATCH v2 00/17] Fix some jobs/drain/aio_poll related hangs Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 01/17] job: Fix missing locking due to mismerge Kevin Wolf
2018-09-13 13:56   ` Max Reitz
2018-09-13 17:38   ` John Snow
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 02/17] blockjob: Wake up BDS when job becomes idle Kevin Wolf
2018-09-13 14:31   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 03/17] aio-wait: Increase num_waiters even in home thread Kevin Wolf
2018-09-13 15:11   ` Paolo Bonzini
2018-09-13 17:21     ` Kevin Wolf
2018-09-14 15:14       ` Paolo Bonzini
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 04/17] test-bdrv-drain: Drain with block jobs in an I/O thread Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 05/17] test-blockjob: Acquire AioContext around job_cancel_sync() Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 06/17] job: Use AIO_WAIT_WHILE() in job_finish_sync() Kevin Wolf
2018-09-13 14:45   ` Max Reitz
2018-09-13 15:15   ` Paolo Bonzini
2018-09-13 17:39     ` Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 07/17] test-bdrv-drain: Test AIO_WAIT_WHILE() in completion callback Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 08/17] block: Add missing locking in bdrv_co_drain_bh_cb() Kevin Wolf
2018-09-13 14:58   ` Max Reitz
2018-09-13 15:17   ` Paolo Bonzini
2018-09-13 17:36     ` Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 09/17] block-backend: Add .drained_poll callback Kevin Wolf
2018-09-13 15:01   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 10/17] block-backend: Fix potential double blk_delete() Kevin Wolf
2018-09-13 15:19   ` Paolo Bonzini
2018-09-13 19:50   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 11/17] block-backend: Decrease in_flight only after callback Kevin Wolf
2018-09-13 15:10   ` Paolo Bonzini
2018-09-13 16:59     ` Kevin Wolf
2018-09-14  7:47       ` Fam Zheng
2018-09-14 15:12       ` Paolo Bonzini
2018-09-14 17:14         ` Kevin Wolf
2018-09-14 17:38           ` Paolo Bonzini
2018-09-13 20:50   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 12/17] mirror: Fix potential use-after-free in active commit Kevin Wolf
2018-09-13 20:55   ` Max Reitz
2018-09-13 21:43     ` Max Reitz
2018-09-14 16:25     ` Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 13/17] blockjob: Lie better in child_job_drained_poll() Kevin Wolf
2018-09-13 21:52   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 14/17] block: Remove aio_poll() in bdrv_drain_poll variants Kevin Wolf
2018-09-13 21:55   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 15/17] test-bdrv-drain: Test nested poll in bdrv_drain_poll_top_level() Kevin Wolf
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 16/17] job: Avoid deadlocks in job_completed_txn_abort() Kevin Wolf
2018-09-13 22:01   ` Max Reitz
2018-09-13 12:52 ` [Qemu-devel] [PATCH v2 17/17] test-bdrv-drain: AIO_WAIT_WHILE() in job .commit/.abort Kevin Wolf
2018-09-13 22:05   ` Max Reitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).