All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Tim Bird <tim.bird@am.sony.com>
Cc: linux kernel <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.arm.linux.org.uk>,
	linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH] omap: add sched_clock for omap1 based on MPU timer
Date: Fri, 22 May 2009 13:41:58 -0700	[thread overview]
Message-ID: <87eiug50q1.fsf@deeprootsystems.com> (raw)
In-Reply-To: <4A17014C.7080305@am.sony.com> (Tim Bird's message of "Fri\, 22 May 2009 12\:47\:24 -0700")

Tim Bird <tim.bird@am.sony.com> writes:

> Define a higher-resolution sched_clock for OMAP
> using the MPU timer, when it is configured on.
>
> This produces better results from ftrace.
>
> Signed-off-by: Tim Bird <tim.bird@am.sony.com>
> ---
>  arch/arm/mach-omap1/time.c  |    9 +++++++++
>  arch/arm/plat-omap/common.c |    2 ++
>  2 files changed, 11 insertions(+)
>
> --- a/arch/arm/mach-omap1/time.c
> +++ b/arch/arm/mach-omap1/time.c
> @@ -212,6 +212,15 @@ static struct clocksource clocksource_mp
>  	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
>  };
>
> +unsigned long long notrace sched_clock(void)
> +{
> +	unsigned long long ret;
> +
> +	ret = (unsigned long long) ~omap_mpu_timer_read(1);
> +	ret = (ret * clocksource_mpu.mult_orig) >> clocksource_mpu.shift;
> +	return ret;
> +}
> +

Minor nit: I think this should rather look something like:

     cycle_t c;

     c = clocksource_read(&clocksource_mpu);
     return cyc2ns(&clocksource_mpu, c);

This way, if the clocksource implementation is changed (to use a
different timer for example) this doesn't have to be changed as well.

Kevin

>  static void __init omap_init_clocksource(unsigned long rate)
>  {
>  	static char err[] __initdata = KERN_ERR
> --- a/arch/arm/plat-omap/common.c
> +++ b/arch/arm/plat-omap/common.c
> @@ -199,6 +199,7 @@ static struct clocksource clocksource_32
>  	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
>  };
>
> +#ifndef CONFIG_OMAP_MPU_TIMER
>  /*
>   * Returns current time from boot in nsecs. It's OK for this to wrap
>   * around for now, as it's just a relative time stamp.
> @@ -211,6 +212,7 @@ unsigned long long notrace sched_clock(v
>  	ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift;
>  	return ret;
>  }
> +#endif
>
>  static int __init omap_init_clocksource_32k(void)
>  {


      reply	other threads:[~2009-05-22 20:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 19:47 [PATCH] omap: add sched_clock for omap1 based on MPU timer Tim Bird
2009-05-22 20:41 ` Kevin Hilman [this message]

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=87eiug50q1.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap-open-source@linux.omap.com \
    --cc=tim.bird@am.sony.com \
    /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.