From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1HLG-0003Nb-RL for qemu-devel@nongnu.org; Wed, 07 Sep 2011 08:35:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1HLF-0003Qr-Dv for qemu-devel@nongnu.org; Wed, 07 Sep 2011 08:34:58 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:46043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1HLF-0003QU-BP for qemu-devel@nongnu.org; Wed, 07 Sep 2011 08:34:57 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p87C9VsJ002233 for ; Wed, 7 Sep 2011 08:09:33 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p87CX0iX146804 for ; Wed, 7 Sep 2011 08:33:00 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p87CWxCO009249 for ; Wed, 7 Sep 2011 09:32:59 -0300 From: Zhi Yong Wu Date: Wed, 7 Sep 2011 20:31:54 +0800 Message-Id: <1315398718-17206-1-git-send-email-wuzhy@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v8 0/4] The intro of QEMU block I/O throttling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, kvm@vger.kernel.org, mtosatti@redhat.com, Zhi Yong Wu , zwu.kernel@gmail.com, ryanh@us.ibm.com The main goal of the patch is to effectively cap the disk I/O speed or counts of one single VM.It is only one draft, so it unavoidably has some drawbacks, if you catch them, please let me know. The patch will mainly introduce one block I/O throttling algorithm, one timer and one block queue for each I/O limits enabled drive. When a block request is coming in, the throttling algorithm will check if its I/O rate or counts exceed the limits; if yes, then it will enqueue to the block queue; The timer will handle the I/O requests in it. Some available features follow as below: (1) global bps limit. -drive bps=xxx in bytes/s (2) only read bps limit -drive bps_rd=xxx in bytes/s (3) only write bps limit -drive bps_wr=xxx in bytes/s (4) global iops limit -drive iops=xxx in ios/s (5) only read iops limit -drive iops_rd=xxx in ios/s (6) only write iops limit -drive iops_wr=xxx in ios/s (7) the combination of some limits. -drive bps=xxx,iops=xxx Known Limitations: (1) #1 can not coexist with #2, #3 (2) #4 can not coexist with #5, #6 (3) When bps/iops limits are specified to a small value such as 511 bytes/s, this VM will hang up. We are considering how to handle this senario. Changes since code V7: fix the build per patch based on stefan's comments. Zhi Yong Wu (4): block: add the command line support block: add the block queue support block: add block timer and throttling algorithm qmp/hmp: add block_set_io_throttle v7: Mainly simply the block queue. Adjust codes based on stefan's comments. v6: Mainly fix the aio callback issue for block queue. Adjust codes based on Ram Pai's comments. v5: add qmp/hmp support. Adjust the codes based on stefan's comments qmp/hmp: add block_set_io_throttle v4: fix memory leaking based on ryan's feedback. v3: Added the code for extending slice time, and modified the method to compute wait time for the timer. v2: The codes V2 for QEMU disk I/O limits. Modified the codes mainly based on stefan's comments. v1: Submit the codes for QEMU disk I/O limits. Only a code draft. Makefile.objs | 2 +- block.c | 331 +++++++++++++++++++++++++++++++++++++++++++++++++++-- block.h | 6 +- block/blk-queue.c | 184 +++++++++++++++++++++++++++++ block/blk-queue.h | 59 ++++++++++ block_int.h | 30 +++++ blockdev.c | 98 ++++++++++++++++ blockdev.h | 2 + hmp-commands.hx | 15 +++ qemu-config.c | 24 ++++ qemu-options.hx | 1 + qerror.c | 4 + qerror.h | 3 + qmp-commands.hx | 52 ++++++++- 14 files changed, 796 insertions(+), 15 deletions(-) create mode 100644 block/blk-queue.c create mode 100644 block/blk-queue.h -- 1.7.6