linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Add sched_clock to AT91 TCB clocksource driver
Date: Sun, 31 Jul 2011 16:07:07 +0100	[thread overview]
Message-ID: <20110731150707.GA2975@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1312124593-6088-1-git-send-email-linux@bohmer.net>

On Sun, Jul 31, 2011 at 05:03:13PM +0200, Remy Bohmer wrote:
> On AT91 there is no architecture specific sched_clock() implementation,
> so the default fallback is used. This fallback uses the jiffie counter
> as sched_clock().
> There is NO standard clocksource available that is accurate enough,
> except the TC-based clocksource implementation. Therefor this
> implementation is used as base for the sched_clock(). This clocksource
> offers sub-millisecond time-stamping. (< 200 ns)
> 
> Signed-off-by: Remy Bohmer <linux@bohmer.net>
> ---
>  arch/arm/Kconfig                 |    1 +
>  arch/arm/kernel/sched_clock.c    |    7 +++++++
>  drivers/clocksource/tcb_clksrc.c |   23 +++++++++++++++++++++++
>  3 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 9adc278..e0563a7 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -296,6 +296,7 @@ config ARCH_AT91
>  	select HAVE_CLK
>  	select CLKDEV_LOOKUP
>  	select ARM_PATCH_PHYS_VIRT if MMU
> +	select HAVE_SCHED_CLOCK if ATMEL_TCB_CLKSRC
>  	help
>  	  This enables support for systems based on the Atmel AT91RM9200,
>  	  AT91SAM9 and AT91CAP9 processors.
> diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
> index 9a46370..f9028e4 100644
> --- a/arch/arm/kernel/sched_clock.c
> +++ b/arch/arm/kernel/sched_clock.c
> @@ -20,6 +20,13 @@ static void (*sched_clock_update_fn)(void);
>  
>  static void sched_clock_poll(unsigned long wrap_ticks)
>  {
> +	/*
> +	 * The sched_clock_update_fn may be initialised AFTER first call to
> +	 * time_init()
> +	 */
> +	if (unlikely(!sched_clock_update_fn))
> +		return;

NAK.  I've said this before - sched_clock _must_ be up and running by the
time this function is called - because shortly after this call is when
the scheduler initializes, and the scheduler wants sched_clock() working
at that point.

  reply	other threads:[~2011-07-31 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-31 15:03 [PATCH] Add sched_clock to AT91 TCB clocksource driver Remy Bohmer
2011-07-31 15:07 ` Russell King - ARM Linux [this message]
2011-08-01  8:42   ` Remy Bohmer
2011-08-01  9:28     ` Russell King - ARM Linux
2011-08-01 18:08       ` Remy Bohmer
2011-08-01 19:48         ` Russell King - ARM Linux
2011-08-01 20:00           ` Remy Bohmer

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=20110731150707.GA2975@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).