From: Don Zickus <dzickus@redhat.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
John Stultz <john.stultz@linaro.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RFC PATCH 2/6] x86: nsecs to cycles conversion
Date: Wed, 21 Aug 2013 14:26:46 -0400 [thread overview]
Message-ID: <20130821182646.GU239280@redhat.com> (raw)
In-Reply-To: <1377103341-15235-3-git-send-email-fweisbec@gmail.com>
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.
>
<snip>
> 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 <linux/time.h>
> +#include <asm/tsc.h>
> +
> +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 <linux/module.h>
> #include <linux/delay.h>
>
> -#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 <linux/sched/rt.h>
>
> #include <asm/irq_regs.h>
> +#include <asm/cycles.h>
> #include <linux/kvm_para.h>
> #include <linux/perf_event.h>
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.
Cheers,
Don
next prev parent reply other threads:[~2013-08-21 18:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 16:42 [RFC PATCH 0/6] timekeeping: Missing timekeeping update detection Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 1/6] sched: Let arch tell us if sched clock is NMI-safe Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 2/6] x86: nsecs to cycles conversion Frederic Weisbecker
2013-08-21 18:26 ` Don Zickus [this message]
2013-08-30 10:35 ` Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 3/6] x86: Tell that sched clock is callable in nmi Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 4/6] seqlock: Add raw_seqbegin() for non-waiting readers Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 5/6] jiffies: Add jiffies_to_nsecs Frederic Weisbecker
2013-08-21 16:42 ` [RFC PATCH 6/6] timekeeping: Debug missing timekeeping updates Frederic Weisbecker
2013-08-21 17:25 ` John Stultz
2013-08-30 11:05 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130821182646.GU239280@redhat.com \
--to=dzickus@redhat.com \
--cc=fweisbec@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox