linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] davinci: Implement sched_clock()
@ 2010-10-06  8:38 Andreas.Gaer at baslerweb.com
  2010-10-07 17:12 ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas.Gaer at baslerweb.com @ 2010-10-06  8:38 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 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,
-- 
1.7.2.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] davinci: Implement sched_clock()
  2010-10-06  8:38 [PATCH] davinci: Implement sched_clock() Andreas.Gaer at baslerweb.com
@ 2010-10-07 17:12 ` Kevin Hilman
  2010-10-08  9:52   ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2010-10-07 17:12 UTC (permalink / raw)
  To: linux-arm-kernel

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,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] davinci: Implement sched_clock()
  2010-10-07 17:12 ` Kevin Hilman
@ 2010-10-08  9:52   ` Sergei Shtylyov
  2010-10-08 18:17     ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2010-10-08  9:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 07-10-2010 21:12, Kevin Hilman wrote:

>> 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.)

    Did you mean 2.6.37 and 2.6.36 respecitvely?

WBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] davinci: Implement sched_clock()
  2010-10-08  9:52   ` Sergei Shtylyov
@ 2010-10-08 18:17     ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2010-10-08 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

Sergei Shtylyov <sshtylyov@mvista.com> writes:

> Hello.
>
> On 07-10-2010 21:12, Kevin Hilman wrote:
>
>>> 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.)
>
>    Did you mean 2.6.37 and 2.6.36 respecitvely?

Nope.

IOW, for the upcoming merge window (2.6.37), Linus does not want to see
new features done after 2.6.36-rc6.  He wants to sure that by the time
the merge window opens, that things have received some testing and
validation, particularily in linux-next.

This means, that most maintainers (myself included) will not be taking
patches/features for 2.6.N merge window after 2.6.(N-1)-rc6 is released,
unless they are regression fixes.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-08 18:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06  8:38 [PATCH] davinci: Implement sched_clock() Andreas.Gaer at baslerweb.com
2010-10-07 17:12 ` Kevin Hilman
2010-10-08  9:52   ` Sergei Shtylyov
2010-10-08 18:17     ` Kevin Hilman

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).