From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj6Sp-0006ED-Cn for qemu-devel@nongnu.org; Mon, 05 Oct 2015 10:10:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zj6Sj-0007lN-L1 for qemu-devel@nongnu.org; Mon, 05 Oct 2015 10:10:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj6Sj-0007lG-FU for qemu-devel@nongnu.org; Mon, 05 Oct 2015 10:09:57 -0400 References: <1430417667-4245-5-git-send-email-christopher.covington@linaro.org> <1443123824-26866-1-git-send-email-cov@codeaurora.org> <560A9B3B.3090407@codeaurora.org> <560EB472.1000901@codeaurora.org> <560EDA12.1090307@codeaurora.org> <560EEDBA.2020201@codeaurora.org> From: Paolo Bonzini Message-ID: <561284B0.4070007@redhat.com> Date: Mon, 5 Oct 2015 16:09:52 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-arm: Use common CPU cycle infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Christopher Covington Cc: Laurent Vivier , Peter Crosthwaite , "qemu-devel@nongnu.org Developers" , Alistair Francis On 03/10/2015 00:41, Peter Maydell wrote: > > What I meant to ask was, do you see any reason for cpu_get_ticks() to exist? > > If no architecture besides i386 wants to use it, perhaps the code should be > > moved there. > > OTOH various non-x86 things do use the closely related cpu_get_real_ticks(), > and the implementation of cpu_get_ticks() is very closely related to > the other clock code in cpus.c. cpu_get_real_ticks() is returning the host cycle counter; cpu_get_ticks() is stopping/resuming it when the VM is stopped/resumed. In other words, cpu_get_real_ticks() is to cpu_get_ticks() what QEMU_CLOCK_REALTIME is to QEMU_CLOCK_VIRTUAL. They are also similar in that both cpu_get_ticks() and QEMU_CLOCK_VIRTUAL "morph" to the instruction count in icount mode. cpu_get_ticks() should be the right implementation for the ARM PMCCNTR cycle counter, since: 1) PMCCNTR is roughly the same as the x86 RDTSC; 2) cpu_get_ticks() is the only monotonically increasing value outside icount mode. Paolo