Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755581Ab3H3Kfd (ORCPT ); Fri, 30 Aug 2013 06:35:33 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:59752 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754779Ab3H3Kfc (ORCPT ); Fri, 30 Aug 2013 06:35:32 -0400 Date: Fri, 30 Aug 2013 12:35:29 +0200 From: Frederic Weisbecker To: Don Zickus Cc: LKML , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , "Paul E. McKenney" , John Stultz , Steven Rostedt Subject: Re: [RFC PATCH 2/6] x86: nsecs to cycles conversion Message-ID: <20130830103528.GA7806@somewhere> References: <1377103341-15235-1-git-send-email-fweisbec@gmail.com> <1377103341-15235-3-git-send-email-fweisbec@gmail.com> <20130821182646.GU239280@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130821182646.GU239280@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2366 Lines: 73 On Wed, Aug 21, 2013 at 02:26:46PM -0400, Don Zickus wrote: > On Wed, Aug 21, 2013 at 06:42:17PM +0200, Frederic Weisbecker wrote: > > hw_nmi_get_sample_period() is simply a conversion from a period > > to cycles. Lets generalize the API naming so that it can be used for > > wider purpose than just watchdog perf event settings. Also it makes the > > function name less opaque about what it really does. > > > > > > > diff --git a/arch/x86/include/asm/cycles.h b/arch/x86/include/asm/cycles.h > > new file mode 100644 > > index 0000000..7dedeb3 > > --- /dev/null > > +++ b/arch/x86/include/asm/cycles.h > > @@ -0,0 +1,11 @@ > > +#ifndef _ASM_X86_CYCLES_H > > +#define _ASM_X86_CYCLES_H > > + > > +#include > > +#include > > + > > +static inline u64 nsecs_to_cycles(u64 nsecs) > > +{ > > + return (u64)((cpu_khz) * nsecs) / NSEC_PER_MSEC; > > +} > > +#endif /* #ifndef _ASM_X86_CYCLES_H */ > > diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c > > index a698d71..4015906 100644 > > --- a/arch/x86/kernel/apic/hw_nmi.c > > +++ b/arch/x86/kernel/apic/hw_nmi.c > > @@ -19,13 +19,6 @@ > > #include > > #include > > > > -#ifdef CONFIG_HARDLOCKUP_DETECTOR > > -u64 hw_nmi_get_sample_period(int watchdog_thresh) > > -{ > > - return (u64)(cpu_khz) * 1000 * watchdog_thresh; > > -} > > -#endif > > - > > #ifdef arch_trigger_all_cpu_backtrace > > /* For reliability, we're prepared to waste bits here. */ > > static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > > index 1241d8c..e04887c 100644 > > --- a/kernel/watchdog.c > > +++ b/kernel/watchdog.c > > @@ -26,6 +26,7 @@ > > #include > > > > #include > > +#include > > #include > > #include > > Do you have to wrap the above with #ifdef CONFIG_HARDLOCKUP_DETECTOR? > Otherwise non-x86 boxes won't compile unless I missed stub > nsecs_to_cycles() somewhere. Good catch, I forgot that. Thanks. > > Cheers, > Don -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/