From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpD5h-0006f2-QW for qemu-devel@nongnu.org; Mon, 04 May 2015 05:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpD5c-0007ej-WC for qemu-devel@nongnu.org; Mon, 04 May 2015 05:55:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpD5c-0007cT-Og for qemu-devel@nongnu.org; Mon, 04 May 2015 05:55:04 -0400 Message-ID: <554741F3.1070705@redhat.com> Date: Mon, 04 May 2015 11:54:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1430417667-4245-1-git-send-email-christopher.covington@linaro.org> <1430417667-4245-5-git-send-email-christopher.covington@linaro.org> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC 5/5] arm: Simplify cycle counter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Christopher Covington Cc: QEMU Developers On 01/05/2015 00:02, Peter Maydell wrote: > On 30 April 2015 at 22:33, Christopher Covington > wrote: >> On Apr 30, 2015 2:28 PM, "Peter Maydell" wrote: >>> Are you really really sure the _raw function is the correct one? >>> Nowhere else in the codebase calls it except the other wrappers >>> in cpu.c which provide a sane view of the instruction count... >>> (I suspect cpu_get_icount_raw() should really be static.) >> >> I thought it wasn't being used because it was new, having been introduced by >> Pavel Dovgalyuk's determinism patches. >> >> When you talk about sanity, what would this patch make insane? The right function is cpu_get_ticks(). This one works without icount as well. At the top there is: if (use_icount) { return cpu_get_icount(); } and perhaps it would be correct to use cpu_get_icount_raw() if you do not want the cycle counter to increase in halted state. But at least x86 wants it to increase. Paolo The >> instructions per second and cycles per second that would result? If so, what >> if seconds/timer ticks were changed in the same patch to be derived from the >> instruction count. All of this could potentially only apply with -icount >> specified. > > I don't really know for certain how the code here works, but > it makes me very dubious when I see a function that is being > used literally nowhere else in any other target CPU, and > where every other code path to it goes via taking a lock. > > Paolo: can you suggest what the right function to call to implement > a cycle counter is? > > thanks > -- PMM >