From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] davinci: Implement sched_clock()
Date: Thu, 07 Oct 2010 10:12:04 -0700 [thread overview]
Message-ID: <87pqvm9bbv.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1286354335-31819-1-git-send-email-Andreas.Gaer@baslerweb.com> (Andreas Gaer's message of "Wed, 6 Oct 2010 10:38:55 +0200")
Andreas.Gaer at baslerweb.com writes:
> From: Andreas Gaeer <Andreas.Gaer@baslerweb.com>
>
> Overwrite the default implementation of sched_clock that is based on
> jiffies by something more precise. This improves timestamps in ftrace.
> Implementation is copied from OMAP platform code.
>
> Signed-off-by: Andreas Gaeer <Andreas.Gaer@baslerweb.com>
Thanks, applying to davinci git.
Will queue for 2.6.38 (it's a bit too late for 2.6.37 as Linus only
wants real regression fixes after -rc6.)
Kevin
> ---
> arch/arm/mach-davinci/time.c | 24 +++++++++++++++++++++++-
> 1 files changed, 23 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
> index 0f21c36..5d1eea0 100644
> --- a/arch/arm/mach-davinci/time.c
> +++ b/arch/arm/mach-davinci/time.c
> @@ -272,15 +272,36 @@ static cycle_t read_cycles(struct clocksource *cs)
> return (cycles_t)timer32_read(t);
> }
>
> +/*
> + * Kernel assumes that sched_clock can be called early but may not have
> + * things ready yet.
> + */
> +static cycle_t read_dummy(struct clocksource *cs)
> +{
> + return 0;
> +}
> +
> +
> static struct clocksource clocksource_davinci = {
> .rating = 300,
> - .read = read_cycles,
> + .read = read_dummy,
> .mask = CLOCKSOURCE_MASK(32),
> .shift = 24,
> .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> };
>
> /*
> + * Overwrite weak default sched_clock with something more precise
> + */
> +unsigned long long notrace sched_clock(void)
> +{
> + const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci);
> +
> + return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
> + clocksource_davinci.shift);
> +}
> +
> +/*
> * clockevent
> */
> static int davinci_set_next_event(unsigned long cycles,
> @@ -377,6 +398,7 @@ static void __init davinci_timer_init(void)
> davinci_clock_tick_rate = clk_get_rate(timer_clk);
>
> /* setup clocksource */
> + clocksource_davinci.read = read_cycles;
> clocksource_davinci.name = id_to_name[clocksource_id];
> clocksource_davinci.mult =
> clocksource_khz2mult(davinci_clock_tick_rate/1000,
next prev parent reply other threads:[~2010-10-07 17:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 8:38 [PATCH] davinci: Implement sched_clock() Andreas.Gaer at baslerweb.com
2010-10-07 17:12 ` Kevin Hilman [this message]
2010-10-08 9:52 ` Sergei Shtylyov
2010-10-08 18:17 ` Kevin Hilman
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=87pqvm9bbv.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.