From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca ([132.207.4.11]:48498 "EHLO smtp.polymtl.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754472AbYKLXeM (ORCPT ); Wed, 12 Nov 2008 18:34:12 -0500 Message-Id: <20081112232258.559661836@polymtl.ca> References: <20081112231551.473569400@polymtl.ca> Date: Wed, 12 Nov 2008 18:15:53 -0500 From: Mathieu Desnoyers Subject: [patch 02/17] get_cycles() : x86 HAVE_GET_CYCLES Content-Disposition: inline; filename=get-cycles-x86-have-get-cycles.patch Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds , akpm@linux-foundation.org, Ingo Molnar , Peter Zijlstra , Steven Rostedt , linux-kernel@vger.kernel.org Cc: Mathieu Desnoyers , David Miller , Ingo Molnar , Thomas Gleixner , linux-arch@vger.kernel.org This patch selects HAVE_GET_CYCLES and makes sure get_cycles_barrier() and get_cycles_rate() are implemented. Signed-off-by: Mathieu Desnoyers CC: David Miller CC: Linus Torvalds CC: Andrew Morton CC: Ingo Molnar CC: Peter Zijlstra CC: Thomas Gleixner CC: Steven Rostedt CC: linux-arch@vger.kernel.org --- arch/x86/Kconfig | 1 + arch/x86/include/asm/tsc.h | 12 ++++++++++++ 2 files changed, 13 insertions(+) Index: linux.trees.git/arch/x86/Kconfig =================================================================== --- linux.trees.git.orig/arch/x86/Kconfig 2008-11-12 18:15:25.000000000 -0500 +++ linux.trees.git/arch/x86/Kconfig 2008-11-12 18:15:28.000000000 -0500 @@ -20,6 +20,7 @@ config X86 def_bool y select HAVE_AOUT if X86_32 select HAVE_UNSTABLE_SCHED_CLOCK + select HAVE_GET_CYCLES select HAVE_IDE select HAVE_OPROFILE select HAVE_IOREMAP_PROT Index: linux.trees.git/arch/x86/include/asm/tsc.h =================================================================== --- linux.trees.git.orig/arch/x86/include/asm/tsc.h 2008-11-12 18:15:25.000000000 -0500 +++ linux.trees.git/arch/x86/include/asm/tsc.h 2008-11-12 18:15:28.000000000 -0500 @@ -56,6 +56,18 @@ extern void mark_tsc_unstable(char *reas extern int unsynchronized_tsc(void); int check_tsc_unstable(void); +static inline cycles_t get_cycles_rate(void) +{ + if (check_tsc_unstable()) + return 0; + return tsc_khz; +} + +static inline void get_cycles_barrier(void) +{ + rdtsc_barrier(); +} + /* * Boot-time check whether the TSCs are synchronized across * all CPUs/cores: -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68