From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH v2] kvm tools: Add QCOW level2 caching support Date: Thu, 2 Jun 2011 10:57:29 +0200 Message-ID: <20110602085729.GA7800@elte.hu> References: <1306956366-4634-1-git-send-email-prasadjoshi124@gmail.com> <20110602072850.GC2150@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, penberg@kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, levinsasha928@gmail.com, chaitanyakulkarni15@gmail.com, ashwini.kulkarni@gmail.com, anup shendkar To: Prasad Joshi Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:42539 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530Ab1FBI5c (ORCPT ); Thu, 2 Jun 2011 04:57:32 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: * Prasad Joshi wrote: > I am not sure how to induce the delay you mentioned. [...] In the simplest version just add: if (debug__io_delay) udelay(1000); to the code that does a read() from the disk image. This will introduce a 1 msec delay - that should be plenty enough to simulate most effects of IO delays. Later on you could complicate it with some disk geometry approximation: delay = read_size_in_kb; /* 1 usec per KB read */ delay += seek_distance_in_kb; /* 1 usec per KB disk-head movement */ udelay(delay); Where 'read_size_in_kb' is the number of bytes read in KB, while seek_distance_in_kb measures the position of the the last byte read by the previous read() call to the first byte of the current read(). ( Also, instead of copying the disk image to /dev/shm you could add a debug switch to mmap() and mlock() it directly. Assuming there's enough RAM in the box. ) But i'd strongly suggest to keep the initial version simple. Thanks, Ingo