qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH v2 0/8] block: Asynchronous request cancellation
@ 2014-08-26  6:08 Fam Zheng
  2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 1/8] block: Add refcnt in BlockDriverAIOCB Fam Zheng
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Fam Zheng @ 2014-08-26  6:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Stefan Hajnoczi

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 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 sends a tmf
command to cancel the request, at which point we will spin in bdrv_aio_cancel,
until the request is slowly spit out from throttled_reqs.

We should change scsi device code to make this asynchronous on top of
bdrv_aio_cancel_async.

Fam


Fam Zheng (8):
  block: Add refcnt in BlockDriverAIOCB
  block: Add bdrv_aio_cancel_async
  tests: Add testing code for bdrv_aio_cancel_async
  linux-aio: Implement .cancel_async
  thread-pool: Implement .cancel_async
  dma: Implement .cancel_async
  block: Implement bdrv_em_co_aiocb_info.cancel_async
  iscsi: Implement .cancel_async in acb info

 block.c                  | 45 ++++++++++++++++++++++++++++++++++++-
 block/iscsi.c            | 18 ++++++++++++---
 block/linux-aio.c        | 20 +++++++++++++++--
 dma-helpers.c            | 28 +++++++++++++++++++++++
 include/block/aio.h      |  3 +++
 include/block/block.h    |  1 +
 tests/test-thread-pool.c | 39 +++++++++++++++++++++++++-------
 thread-pool.c            | 58 +++++++++++++++++++++++++++++++++++++++---------
 8 files changed, 187 insertions(+), 25 deletions(-)

-- 
2.1.0

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

end of thread, other threads:[~2014-08-26  9:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26  6:08 [Qemu-devel] [RFC PATCH v2 0/8] block: Asynchronous request cancellation Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 1/8] block: Add refcnt in BlockDriverAIOCB Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 2/8] block: Add bdrv_aio_cancel_async Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 3/8] tests: Add testing code for bdrv_aio_cancel_async Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 4/8] linux-aio: Implement .cancel_async Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 5/8] thread-pool: " Fam Zheng
2014-08-26  8:42   ` Paolo Bonzini
2014-08-26  9:26     ` Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 6/8] dma: " Fam Zheng
2014-08-26  8:46   ` Paolo Bonzini
2014-08-26  9:21     ` Fam Zheng
2014-08-26  9:57       ` Paolo Bonzini
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 7/8] block: Implement bdrv_em_co_aiocb_info.cancel_async Fam Zheng
2014-08-26  6:08 ` [Qemu-devel] [RFC PATCH v2 8/8] iscsi: Implement .cancel_async in acb info Fam Zheng

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).