From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 0/8] block: Asynchronous request cancellation
Date: Tue, 2 Sep 2014 16:09:46 +0100 [thread overview]
Message-ID: <20140902150946.GL29067@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1409107756-5967-1-git-send-email-famz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2533 bytes --]
On Wed, Aug 27, 2014 at 10:49:08AM +0800, Fam Zheng wrote:
> v3: Drop "RFC".
> Improvements according to Paolo's comments:
> 05: Just use THREAD_DONE and ret = -ECANCELED in thread-pool.c
> 06: Don't check dbs->cancelled for twice.
> Don't set dbs->acb to NULL.
>
> v2: Drop the unfinished scsi part, which was broken in v1. (Paolo)
> Add refcnt in BlockDriverAIOCB to maintain invariant of acb availability in
> bdrv_aio_cancel_async. (Paolo)
> Drop blkdebug change. (Stefan)
>
> This series adds a new block layer API:
>
> void bdrv_aio_cancel_async(BlockDriverAIOCB *acb);
>
> which is similar to existing bdrv_aio_cancel in that it cancels an AIO request,
> but different that it doesn't block until the request is completely cancelled
> or done.
>
> More importantly, the completion callback, BlockDriverAIOCB.cb, is guaranteed
> to be called, so that the cb can take care of resource releasing and status
> reporting to guest, etc.
>
> In the following work, scsi emulation code will be shifted to use the async
> cancelling.
>
> One major benefit would be that when guest tries to cancel a request, where the
> request cannot be cancelled easily, (due to throttled BlockDriverState, a lost
> connection, or a large request queue), we don't need to block the whole vm with
> a busy loop, which is how bdrv_aio_cancel is implemented now.
>
> A test case that is easy to reproduce is, throttle a scsi-disk to a very low
> limit, for example 50 bps, then stress the guest block device with dd or fio.
>
> Currently, the vm will quickly hang when it loses patience and send a tmf
> command to cancel the request, at which point we will busy wait in
> bdrv_aio_cancel, until the request is slowly spit out from throttled_reqs.
>
> Later, we will change scsi device code to make this asynchronous, on top of
> bdrv_aio_cancel_async.
We need to get rid of .bdrv_aio_cancel(). Keeping both
.bdrv_aio_cancel() and .bdrv_aio_cancel_async() around is problematic
because they have slightly different semantics.
This patch series makes block driver cancellation more complex because
we support both approaches :(.
Could we do something like:
void bdrv_aio_cancel(BdrvAIOCB *acb)
{
bdrv_aiocb_ref(acb);
bdrv_aio_cancel_async(acb);
while (acb->ref > 1) {
aio_poll(bdrv_get_aio_context(acb->bs), true);
}
bdrv_aiocb_release(acb);
}
(pseudo-code)
Then .bdrv_aio_cancel() should be deleted.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-09-02 15:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 2:49 [Qemu-devel] [PATCH v3 0/8] block: Asynchronous request cancellation Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 1/8] block: Add refcnt in BlockDriverAIOCB Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 2/8] block: Add bdrv_aio_cancel_async Fam Zheng
2014-09-02 10:55 ` Stefan Hajnoczi
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 3/8] tests: Add testing code for bdrv_aio_cancel_async Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 4/8] linux-aio: Implement .cancel_async Fam Zheng
2014-09-02 14:55 ` Stefan Hajnoczi
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 5/8] thread-pool: " Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 6/8] dma: " Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 7/8] block: Implement bdrv_em_co_aiocb_info.cancel_async Fam Zheng
2014-08-27 2:49 ` [Qemu-devel] [PATCH v3 8/8] iscsi: Implement .cancel_async in acb info Fam Zheng
2014-09-02 15:09 ` Stefan Hajnoczi [this message]
2014-09-03 0:35 ` [Qemu-devel] [PATCH v3 0/8] block: Asynchronous request cancellation Fam Zheng
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=20140902150946.GL29067@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).