From mboxrd@z Thu Jan 1 00:00:00 1970 From: a.p.zijlstra@chello.nl (Peter Zijlstra) Date: Thu, 16 Feb 2012 17:19:43 +0100 Subject: oprofile and ARM A9 hardware counter In-Reply-To: References: <1329323900.2293.150.camel@twins> <20120216150004.GE2641@mudshark.cambridge.arm.com> Message-ID: <1329409183.2293.245.camel@twins> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, 2012-02-17 at 00:12 +0800, Ming Lei wrote: > is triggered: u64 delta = 100 - 1000000 = 18446744073708551716. on x86 we do: int shift = 64 - x86_pmu.cntval_bits; s64 delta; delta = (new_raw_count << shift) - (prev_raw_count << shift); delta >>= shift; This deals with short overflows (on x86 the registers are typically 40 or 48 bits wide). If the arm register is 32 you can of course also get there with some u32 casts.