Received: from eggs.gnu.org ([208.118.235.92]:47483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfbuS-0000DW-GK for qemu-devel@nongnu.org; Fri, 15 Jun 2012 15:10:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfbuO-0001Rc-4o for qemu-devel@nongnu.org; Fri, 15 Jun 2012 15:10:16 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:45751 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfbuN-0001Pl-Q4 for qemu-devel@nongnu.org; Fri, 15 Jun 2012 15:10:12 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20120613031426.GA8174@cs.nctu.edu.tw> <20120614031826.GA88265@cs.nctu.edu.tw> <87ipetttk0.fsf@fimbulvetr.bsc.es> Date: Fri, 15 Jun 2012 22:10:03 +0300 In-Reply-To: (Laurent Desnogues's message of "Fri, 15 Jun 2012 10:23:50 +0200") Message-ID: <87ehpgxugk.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] How to measure guest memory access (qemu_ld/qemu_st) time? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: stefanha@gmail.com, qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Laurent Desnogues writes: > On Fri, Jun 15, 2012 at 12:30 AM, Llu=C3=ADs Vilanova wrote: > [...] >> Now that I think of it, you will have problems generating code to surrou= nd each >> qemu_ld/st with a lightweight mechanism to get the time. In x86 it would= be >> rdtsc, but you want to generate a host rdtsc instruction inside the code >> generated by QEMU's TCG, so you should also have to hack TCG (or the code >> generation pointers) to issue an rdtsc instruction. > Even rdtsc would introduce enough noise that it wouldn't be reliable > for such a micro measurement: as far as I understand it, this instruction > can be reordered, so you need to flush the pipeline before issuing it. > Intel has a document about that: > download.intel.com/embedded/software/IA/324264.pdf > The overhead of their proposed method is so high that it's likely it > would take longer than the execution of the fast path itself. > IMHO a mix of YeongKyoon Lee way to count ld/st and comparison > between user mode and softmmu still seems to be the best approach > (well unless you have access to a cycle accurate simulator :-). Ah, true; I forgot about the architectural implications. Sometimes you just assume the nice in-order world :) Lluis --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth