From: Stefan Hajnoczi <stefanha@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 00/11] block: allow blockjobs to coexist with dataplane
Date: Wed, 29 Oct 2014 12:11:31 +0000 [thread overview]
Message-ID: <20141029121131.GB32180@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1413889440-32577-1-git-send-email-stefanha@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]
On Tue, Oct 21, 2014 at 12:03:49PM +0100, Stefan Hajnoczi wrote:
> v2:
> * Protect block_job_defer_to_main_loop_bh() against AioContext change [Max]
> * Drop unnecessary if (buf) around qemu_vfree(buf) [Max]
>
> Almost all the infrastructure is in place to make blockjobs safe for use with
> dataplane:
>
> * Op blockers all us to exclude commands that could conflict with a blockjob
> or dataplane.
>
> * AioContext acquire/release allows threads to temporarily access a
> BlockDriverState that is running in another thread.
>
> This series introduces a few additional helpers:
>
> * block_job_defer_to_main_loop() which allows blockjobs to run their
> completion code in the QEMU main loop. This is necessary because some
> operations are not safe outside the QEMU global mutex.
>
> * bdrv_drain() which can be used in limited cases to wait for in-flight
> requests to complete (as opposed to the global bdrv_drain_all() function).
>
> The approach taken in this series is to convert the blockdev.c monitor command
> so it acquires the BlockDriverState's AioContext. Normally only 1 AioContext
> is involved at a time but the mirror job's to_replace argument can involve a
> second AioContext.
>
> Then the block job code itself is converted to defer main loop code using
> block_job_defer_to_main_loop().
>
> Example:
>
> $ qemu-system-x86_64 -enable-kvm -m 1024 \
> -drive if=none,id=drive0,file=test.img \
> -object iothread,iothread0 \
> -device virtio-blk-pci,drive=drive0,iothread=iothread0
> (qemu) drive_mirror drive0 test2.img
>
> Stefan Hajnoczi (11):
> block: acquire AioContext in generic blockjob QMP commands
> blockdev: acquire AioContext in do_qmp_query_block_jobs_one()
> blockdev: acquire AioContext in blockdev_mark_auto_del()
> blockdev: add note that block_job_cb() must be thread-safe
> blockjob: add block_job_defer_to_main_loop()
> block: add bdrv_drain()
> block: let backup blockjob run in BDS AioContext
> block: let stream blockjob run in BDS AioContext
> block: let mirror blockjob run in BDS AioContext
> block: let commit blockjob run in BDS AioContext
> block: declare blockjobs and dataplane friends!
>
> block.c | 49 +++++++++--
> block/backup.c | 21 ++++-
> block/commit.c | 70 ++++++++++------
> block/mirror.c | 85 +++++++++++++------
> block/stream.c | 50 +++++++----
> blockdev.c | 179 +++++++++++++++++++++++++++++-----------
> blockjob.c | 46 +++++++++++
> hw/block/dataplane/virtio-blk.c | 5 ++
> include/block/block.h | 1 +
> include/block/blockjob.h | 19 +++++
> 10 files changed, 402 insertions(+), 123 deletions(-)
Applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2014-10-29 12:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 11:03 [Qemu-devel] [PATCH v2 00/11] block: allow blockjobs to coexist with dataplane Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 01/11] block: acquire AioContext in generic blockjob QMP commands Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 02/11] blockdev: acquire AioContext in do_qmp_query_block_jobs_one() Stefan Hajnoczi
2014-10-22 11:10 ` Max Reitz
2014-10-29 12:10 ` Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 03/11] blockdev: acquire AioContext in blockdev_mark_auto_del() Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 04/11] blockdev: add note that block_job_cb() must be thread-safe Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 05/11] blockjob: add block_job_defer_to_main_loop() Stefan Hajnoczi
2014-10-21 11:24 ` Max Reitz
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 06/11] block: add bdrv_drain() Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 07/11] block: let backup blockjob run in BDS AioContext Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 08/11] block: let stream " Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 09/11] block: let mirror " Stefan Hajnoczi
2014-10-21 11:03 ` [Qemu-devel] [PATCH v2 10/11] block: let commit " Stefan Hajnoczi
2014-10-21 11:28 ` Max Reitz
2014-10-21 11:04 ` [Qemu-devel] [PATCH v2 11/11] block: declare blockjobs and dataplane friends! Stefan Hajnoczi
2014-10-29 12:11 ` Stefan Hajnoczi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141029121131.GB32180@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).