Received: from eggs.gnu.org ([2001:4830:134:3::10]:49232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0raf-00052A-CP for qemu-devel@nongnu.org; Thu, 12 May 2016 10:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0rab-00011x-4P for qemu-devel@nongnu.org; Thu, 12 May 2016 10:27:48 -0400 Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]:38395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0raa-00011r-Sr for qemu-devel@nongnu.org; Thu, 12 May 2016 10:27:45 -0400 Received: by mail-ig0-x234.google.com with SMTP id m9so53554052ige.1 for ; Thu, 12 May 2016 07:27:44 -0700 (PDT) From: Huaicheng Li Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 12 May 2016 09:27:42 -0500 Message-Id: <3B15D6D8-794C-482B-8431-D52C81FF56AE@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: [Qemu-devel] use timer for adding latency to each block I/O List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Paolo Bonzini , mst@redhat.com Hi all, My goal is to add latency for each I/O without blocking the submission = path. Now=20 I can know how long each I/O should wait before it=E2=80=99s submitted = to the AIO queue=20 via a model. Now the question is how can I make the I/O wait for that = long time before it=E2=80=99s finally handled by worker threads. I=E2=80=99m thinking about adding a timer for each block I/O and its = callback function will do the submission job. Below is some of my thought and questions about = this idea:=20 (1). The callback will be triggered by the thread where corresponding = event queue locates, not VCPU thread which previously submits I/Os. How can I make = safely submit I/O from the event-queue thread? (2). If each I/O is associated with a timer, and we also put per-I/O = timer into the=20 event queue. Will the event queue be capable of handling intensive I/O = timers in accurate timing manner?=20 (3). Which device interface would be better to work on? =46rom my = perspective, the=20 virtio-data-plane would be a good choice since it has its own thread and = event queue. (4). Any other concerns about this idea? =20 Any suggestions will be greatly appreciated. Thanks for all your time. Best, Huaicheng =20=