2009-06-11 22:11:06

by john stultz

[permalink] [raw]
Subject: [PATCH] Convert alpha to use arch_gettimeoffset()

This patch converts alpha to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

I suspect the alpha arch could even be further improved to provide and
rpcc() based clocksource, but not having the hardware, I don't feel
comfortable attempting the more complicated conversion (but I'd be glad
to help if anyone else is interested).

This patch applies on top of Linus' current -git tree (pre 2.6.31-rc1).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. It does cross compile, so that's hopefully a good sign.
Any assistance from arch maintainers or testers to get this merged would
be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---

Kconfig | 8 ++++++
kernel/time.c | 72 +++-------------------------------------------------------
2 files changed, 12 insertions(+), 68 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 9fb8aae..4434481 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -45,6 +45,14 @@ config GENERIC_CALIBRATE_DELAY
bool
default y

+config GENERIC_TIME
+ bool
+ default y
+
+config ARCH_USES_GETTIMEOFFSET
+ bool
+ default y
+
config ZONE_DMA
bool
default y
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index b04e2cb..8f7eb6d 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -408,28 +408,17 @@ time_init(void)
* part. So we can't do the "find absolute time in terms of cycles" thing
* that the other ports do.
*/
-void
-do_gettimeofday(struct timeval *tv)
+u32 arch_gettimeoffset(void)
{
- unsigned long flags;
- unsigned long sec, usec, seq;
unsigned long delta_cycles, delta_usec, partial_tick;

- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
-
- delta_cycles = rpcc() - state.last_time;
- sec = xtime.tv_sec;
- usec = (xtime.tv_nsec / 1000);
- partial_tick = state.partial_tick;
-
- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
#ifdef CONFIG_SMP
/* Until and unless we figure out how to get cpu cycle counters
in sync and keep them there, we can't use the rpcc tricks. */
delta_usec = 0;
#else
+ delta_cycles = rpcc() - state.last_time;
+ partial_tick = state.partial_tick;
/*
* usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
* = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks)
@@ -448,62 +437,9 @@ do_gettimeofday(struct timeval *tv)
delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
#endif

- usec += delta_usec;
- if (usec >= 1000000) {
- sec += 1;
- usec -= 1000000;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int
-do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
- unsigned long delta_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
-
- /* The offset that is added into time in do_gettimeofday above
- must be subtracted out here to keep a coherent view of the
- time. Without this, a full-tick error is possible. */
-
-#ifdef CONFIG_SMP
- delta_nsec = 0;
-#else
- delta_nsec = rpcc() - state.last_time;
- delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle
- + state.partial_tick) * 15625;
- delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
- delta_nsec *= 1000;
-#endif
-
- nsec -= delta_nsec;
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
-
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
- return 0;
+ return delta_usec * 1000;
}

-EXPORT_SYMBOL(do_settimeofday);
-
-
/*
* In order to set the CMOS clock precisely, set_rtc_mmss has to be
* called 500 ms after the second nowtime has started, because when


2009-06-11 22:52:59

by john stultz

[permalink] [raw]
Subject: [PATCH] Convert m32r to use arch_gettimeoffset()

This patch converts m32r to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

I also noted that m32r doesn't seem to be taking the xtime write lock
before calling do_timer()! That looks like a pretty bad bug to me. If
folks agree, let me know and I can move the lock grab to the correct
spot.

This patch applies on top of Linus' current -git tree (pre 2.6.31-rc1).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. It does cross compile, so that's hopefully a good sign.
Any assistance from arch maintainers or testers to get this merged would
be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---
Kconfig | 6 ++++
kernel/time.c | 74 ++--------------------------------------------------------
2 files changed, 9 insertions(+), 71 deletions(-)

diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index cabba33..c41234f 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -41,6 +41,12 @@ config HZ
int
default 100

+config GENERIC_TIME
+ def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
+ def_bool y
+
source "init/Kconfig"

source "kernel/Kconfig.freezer"
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index cada3ba..ba61c4c 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -48,7 +48,7 @@ extern void smp_local_timer_interrupt(void);

static unsigned long latch;

-static unsigned long do_gettimeoffset(void)
+u32 arch_gettimeoffset(void)
{
unsigned long elapsed_time = 0; /* [us] */

@@ -93,79 +93,10 @@ static unsigned long do_gettimeoffset(void)
#error no chip configuration
#endif

- return elapsed_time;
+ return elapsed_time * 1000;
}

/*
- * This version of gettimeofday has near microsecond resolution.
- */
-void do_gettimeofday(struct timeval *tv)
-{
- unsigned long seq;
- unsigned long usec, sec;
- unsigned long max_ntp_tick = tick_usec - tickadj;
-
- do {
- seq = read_seqbegin(&xtime_lock);
-
- usec = do_gettimeoffset();
-
- /*
- * If time_adjust is negative then NTP is slowing the clock
- * so make sure not to go into next possible interval.
- * Better to lose some accuracy than have time go backwards..
- */
- if (unlikely(time_adjust < 0))
- usec = min(usec, max_ntp_tick);
-
- sec = xtime.tv_sec;
- usec += (xtime.tv_nsec / 1000);
- } while (read_seqretry(&xtime_lock, seq));
-
- while (usec >= 1000000) {
- usec -= 1000000;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /*
- * This is revolting. We need to set "xtime" correctly. However, the
- * value in this location is the value at the most recent update of
- * wall time. Discover what correction gettimeofday() would have
- * made, and then undo it!
- */
- nsec -= do_gettimeoffset() * NSEC_PER_USEC;
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
-
- return 0;
-}
-
-EXPORT_SYMBOL(do_settimeofday);
-
-/*
* In order to set the CMOS clock precisely, set_rtc_mmss has to be
* called 500 ms after the second nowtime has started, because when
* nowtime is written into the registers of the CMOS clock, it will
@@ -192,6 +123,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
#ifndef CONFIG_SMP
profile_tick(CPU_PROFILING);
#endif
+ /* XXX FIXME. Uh, the xtime_lock should be held here, no? */
do_timer(1);

#ifndef CONFIG_SMP

2009-06-11 23:21:19

by Dialup Jon Norstog

[permalink] [raw]
Subject: Re: [PATCH] Convert alpha to use arch_gettimeoffset()

John,

Thank you so much!


jn

---------- Original Message -----------
From: john stultz <[email protected]>
To: [email protected], [email protected]
Cc: lkml <[email protected]>, [email protected]
Sent: Thu, 11 Jun 2009 15:10:10 -0700
Subject: [PATCH] Convert alpha to use arch_gettimeoffset()

> This patch converts alpha to use GENERIC_TIME via the
> arch_getoffset() infrastructure, reducing the amount of arch
> specific code we need to maintain.
>
> I suspect the alpha arch could even be further improved to provide
> and rpcc() based clocksource, but not having the hardware, I don't feel
> comfortable attempting the more complicated conversion (but I'd be glad
> to help if anyone else is interested).
>
> This patch applies on top of Linus' current -git tree (pre 2.6.31-
> rc1).
>
> I've taken my best swing at converting this, but I'm not 100% confident
> I got it right. It does cross compile, so that's hopefully a good sign.
> Any assistance from arch maintainers or testers to get this merged would
> be great.
>
> thanks
> -john
>
> Signed-off-by: John Stultz <[email protected]>
> ---
>
> Kconfig | 8 ++++++
> kernel/time.c | 72 +++--------------------------------------------
> ----------- 2 files changed, 12 insertions(+), 68 deletions(-)
>
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 9fb8aae..4434481 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -45,6 +45,14 @@ config GENERIC_CALIBRATE_DELAY
> bool
> default y
>
> +config GENERIC_TIME
> + bool
> + default y
> +
> +config ARCH_USES_GETTIMEOFFSET
> + bool
> + default y
> +
> config ZONE_DMA
> bool
> default y
> diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
> index b04e2cb..8f7eb6d 100644
> --- a/arch/alpha/kernel/time.c
> +++ b/arch/alpha/kernel/time.c
> @@ -408,28 +408,17 @@ time_init(void)
> * part. So we can't do the "find absolute time in terms of
> cycles" thing * that the other ports do. */ -void -
> do_gettimeofday(struct timeval *tv) +u32 arch_gettimeoffset(void) { -
> unsigned long flags; - unsigned long sec, usec, seq; unsigned long
> delta_cycles, delta_usec, partial_tick;
>
> - do {
> - seq = read_seqbegin_irqsave(&xtime_lock, flags);
> -
> - delta_cycles = rpcc() - state.last_time;
> - sec = xtime.tv_sec;
> - usec = (xtime.tv_nsec / 1000);
> - partial_tick = state.partial_tick;
> -
> - } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> -
> #ifdef CONFIG_SMP
> /* Until and unless we figure out how to get cpu cycle counters
> in sync and keep them there, we can't use the rpcc tricks. */
> delta_usec = 0;
> #else
> + delta_cycles = rpcc() - state.last_time;
> + partial_tick = state.partial_tick;
> /*
> * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
> * = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks)
> @@ -448,62 +437,9 @@ do_gettimeofday(struct timeval *tv)
> delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1)
> / 2; #endif
>
> - usec += delta_usec;
> - if (usec >= 1000000) {
> - sec += 1;
> - usec -= 1000000;
> - }
> -
> - tv->tv_sec = sec;
> - tv->tv_usec = usec;
> -}
> -
> -EXPORT_SYMBOL(do_gettimeofday);
> -
> -int
> -do_settimeofday(struct timespec *tv)
> -{
> - time_t wtm_sec, sec = tv->tv_sec;
> - long wtm_nsec, nsec = tv->tv_nsec;
> - unsigned long delta_nsec;
> -
> - if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
> - return -EINVAL;
> -
> - write_seqlock_irq(&xtime_lock);
> -
> - /* The offset that is added into time in do_gettimeofday above
> - must be subtracted out here to keep a coherent view of the
> - time. Without this, a full-tick error is possible. */
> -
> -#ifdef CONFIG_SMP
> - delta_nsec = 0;
> -#else
> - delta_nsec = rpcc() - state.last_time;
> - delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle
> - + state.partial_tick) * 15625;
> - delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1)
> / 2; - delta_nsec *= 1000; -#endif
> -
> - nsec -= delta_nsec;
> -
> - wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
> - wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
> -
> - set_normalized_timespec(&xtime, sec, nsec);
> - set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
> -
> - ntp_clear();
> -
> - write_sequnlock_irq(&xtime_lock);
> - clock_was_set();
> - return 0;
> + return delta_usec * 1000;
> }
>
> -EXPORT_SYMBOL(do_settimeofday);
> -
> -
> /*
> * In order to set the CMOS clock precisely, set_rtc_mmss has to be
> * called 500 ms after the second nowtime has started, because when
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> alpha" in the body of a message to [email protected] More
> majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
------- End of Original Message -------

2009-06-12 07:03:42

by Richard Henderson

[permalink] [raw]
Subject: Re: [PATCH] Convert alpha to use arch_gettimeoffset()

john stultz wrote:
> I suspect the alpha arch could even be further improved to provide and
> rpcc() based clocksource, but not having the hardware, I don't feel
> comfortable attempting the more complicated conversion (but I'd be glad
> to help if anyone else is interested).

Unfortunately this isn't possible. The rpcc value is only 32-bits wide,
and so rolls over in approx 3 to 4 seconds. Thus all the contortions to
try and use the truncated value for sub 1 second adjustments.

> + delta_cycles = rpcc() - state.last_time;
> + partial_tick = state.partial_tick;
> /*
> * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
> * = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks)
> @@ -448,62 +437,9 @@ do_gettimeofday(struct timeval *tv)
> delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
> #endif
...
> + return delta_usec * 1000;

If we're going to be computing nsec now, we might as well adjust
the computation here.

nsec = cycles * ticks_per_cycle * 1e9 / HZ
= cycles * s_t_p_c * 1e9 / (2**48 * HZ)
= cycles * s_t_p_c * 1953125 / (2**39 * HZ)

delta_nsec = delta_cycles*state.scaled_ticks_per_cycle + partial_tick;
delta_nsec *= 1953125
delta_nsec /= HZ << (FIX_SHIFT - 9 - 1);
delta_nsec = (delta_nsec + 1) / 2;

As far as I can tell, the range of the dividend is about 7e17,
which still fits in an unsigned long.


r~

2009-06-12 18:42:19

by john stultz

[permalink] [raw]
Subject: Re: [PATCH] Convert alpha to use arch_gettimeoffset()

On Fri, 2009-06-12 at 00:03 -0700, Richard Henderson wrote:
> john stultz wrote:
> > I suspect the alpha arch could even be further improved to provide and
> > rpcc() based clocksource, but not having the hardware, I don't feel
> > comfortable attempting the more complicated conversion (but I'd be glad
> > to help if anyone else is interested).
>
> Unfortunately this isn't possible. The rpcc value is only 32-bits wide,
> and so rolls over in approx 3 to 4 seconds. Thus all the contortions to
> try and use the truncated value for sub 1 second adjustments.

That's actually ok. The ACPI PM clocksource on x86 is only 24 bits wide
and wraps every 5 seconds. The generic timekeeping code handles the
wrapping and accumulation for you.


> > + delta_cycles = rpcc() - state.last_time;
> > + partial_tick = state.partial_tick;
> > /*
> > * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
> > * = cycles * (s_t_p_c) * 1e6 / (2**48 * ticks)
> > @@ -448,62 +437,9 @@ do_gettimeofday(struct timeval *tv)
> > delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
> > #endif
> ...
> > + return delta_usec * 1000;
>
> If we're going to be computing nsec now, we might as well adjust
> the computation here.
>
> nsec = cycles * ticks_per_cycle * 1e9 / HZ
> = cycles * s_t_p_c * 1e9 / (2**48 * HZ)
> = cycles * s_t_p_c * 1953125 / (2**39 * HZ)
>
> delta_nsec = delta_cycles*state.scaled_ticks_per_cycle + partial_tick;
> delta_nsec *= 1953125
> delta_nsec /= HZ << (FIX_SHIFT - 9 - 1);
> delta_nsec = (delta_nsec + 1) / 2;
>
> As far as I can tell, the range of the dividend is about 7e17,
> which still fits in an unsigned long.

That seems like a good optimization, although I'm hesitant to submit
anything but structural, but equivalent code changes since I don't have
the hardware to test with.

Might you create a patch that does this conversion and apply it on top
of mine?

thanks
-john

2009-06-16 17:45:29

by Richard Henderson

[permalink] [raw]
Subject: Re: [PATCH] Convert alpha to use arch_gettimeoffset()

john stultz wrote:
> On Fri, 2009-06-12 at 00:03 -0700, Richard Henderson wrote:
>
>> john stultz wrote:
>>
>>> I suspect the alpha arch could even be further improved to provide and
>>> rpcc() based clocksource, but not having the hardware, I don't feel
>>> comfortable attempting the more complicated conversion (but I'd be glad
>>> to help if anyone else is interested).
>>>
>> Unfortunately this isn't possible. The rpcc value is only 32-bits wide,
>> and so rolls over in approx 3 to 4 seconds. Thus all the contortions to
>> try and use the truncated value for sub 1 second adjustments.
>>
>
> That's actually ok. The ACPI PM clocksource on x86 is only 24 bits wide
> and wraps every 5 seconds. The generic timekeeping code handles the
> wrapping and accumulation for you.
>
Interesting.
> Might you create a patch that does this conversion and apply it on top
> of mine?
Unfortunately I don't have working hardware anymore. Perhaps Ivan will
be able to help here.


r~

2009-06-17 15:29:56

by Ivan Kokshaysky

[permalink] [raw]
Subject: Re: [PATCH] Convert alpha to use arch_gettimeoffset()

On Tue, Jun 16, 2009 at 10:45:16AM -0700, Richard Henderson wrote:
> Unfortunately I don't have working hardware anymore. Perhaps Ivan will be
> able to help here.

I can give it a try next week (I'm away from hardware currently).

Ivan.

2009-07-17 00:15:11

by john stultz

[permalink] [raw]
Subject: [RESEND][PATCH] Convert m32r to use arch_gettimeoffset()

This patch converts m32r to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

I also noted that m32r doesn't seem to be taking the xtime write lock
before calling do_timer()! That looks like a pretty bad bug to me. If
folks agree, let me know and I can move the lock grab to the correct
spot.

This patch applies on top of Linus' current -git tree (2.6.31-rc3).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. My cross-compiler is now out of date (gcc4.2) so I
wasn't able to check if it compiled. Any assistance from arch
maintainers or testers to get this merged would be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---

Kconfig | 6 ++++
kernel/time.c | 74 ++--------------------------------------------------------
2 files changed, 9 insertions(+), 71 deletions(-)

diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index cabba33..c41234f 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -41,6 +41,12 @@ config HZ
int
default 100

+config GENERIC_TIME
+ def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
+ def_bool y
+
source "init/Kconfig"

source "kernel/Kconfig.freezer"
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index cada3ba..ba61c4c 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -48,7 +48,7 @@ extern void smp_local_timer_interrupt(void);

static unsigned long latch;

-static unsigned long do_gettimeoffset(void)
+u32 arch_gettimeoffset(void)
{
unsigned long elapsed_time = 0; /* [us] */

@@ -93,79 +93,10 @@ static unsigned long do_gettimeoffset(void)
#error no chip configuration
#endif

- return elapsed_time;
+ return elapsed_time * 1000;
}

/*
- * This version of gettimeofday has near microsecond resolution.
- */
-void do_gettimeofday(struct timeval *tv)
-{
- unsigned long seq;
- unsigned long usec, sec;
- unsigned long max_ntp_tick = tick_usec - tickadj;
-
- do {
- seq = read_seqbegin(&xtime_lock);
-
- usec = do_gettimeoffset();
-
- /*
- * If time_adjust is negative then NTP is slowing the clock
- * so make sure not to go into next possible interval.
- * Better to lose some accuracy than have time go backwards..
- */
- if (unlikely(time_adjust < 0))
- usec = min(usec, max_ntp_tick);
-
- sec = xtime.tv_sec;
- usec += (xtime.tv_nsec / 1000);
- } while (read_seqretry(&xtime_lock, seq));
-
- while (usec >= 1000000) {
- usec -= 1000000;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /*
- * This is revolting. We need to set "xtime" correctly. However, the
- * value in this location is the value at the most recent update of
- * wall time. Discover what correction gettimeofday() would have
- * made, and then undo it!
- */
- nsec -= do_gettimeoffset() * NSEC_PER_USEC;
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
-
- return 0;
-}
-
-EXPORT_SYMBOL(do_settimeofday);
-
-/*
* In order to set the CMOS clock precisely, set_rtc_mmss has to be
* called 500 ms after the second nowtime has started, because when
* nowtime is written into the registers of the CMOS clock, it will
@@ -192,6 +123,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
#ifndef CONFIG_SMP
profile_tick(CPU_PROFILING);
#endif
+ /* XXX FIXME. Uh, the xtime_lock should be held here, no? */
do_timer(1);

#ifndef CONFIG_SMP

2009-07-17 00:18:36

by john stultz

[permalink] [raw]
Subject: [PATCH] Convert cris to use arch_gettimeoffset()

This patch converts cris to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

This patch applies on top of Linus' current -git tree (2.6.31-rc3).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. My cross-compiler is now out of date (gcc4.2) so I
wasn't able to check if it compiled. Any assistance from arch
maintainers or testers to get this merged would be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---
Kconfig | 6 +++++
kernel/time.c | 68 +---------------------------------------------------------
2 files changed, 8 insertions(+), 66 deletions(-)

diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 7adac38..059eac6 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -20,6 +20,12 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM
bool

+config GENERIC_TIME
+ def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
+ def_bool y
+
config GENERIC_IOMAP
bool
default y
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 074fe7d..a05dd31 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -42,75 +42,11 @@ unsigned long loops_per_usec;
extern unsigned long do_slow_gettimeoffset(void);
static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;

-/*
- * This version of gettimeofday has near microsecond resolution.
- *
- * Note: Division is quite slow on CRIS and do_gettimeofday is called
- * rather often. Maybe we should do some kind of approximation here
- * (a naive approximation would be to divide by 1024).
- */
-void do_gettimeofday(struct timeval *tv)
-{
- unsigned long flags;
- signed long usec, sec;
- local_irq_save(flags);
- usec = do_gettimeoffset();
-
- /*
- * If time_adjust is negative then NTP is slowing the clock
- * so make sure not to go into next possible interval.
- * Better to lose some accuracy than have time go backwards..
- */
- if (unlikely(time_adjust < 0) && usec > tickadj)
- usec = tickadj;
-
- sec = xtime.tv_sec;
- usec += xtime.tv_nsec / 1000;
- local_irq_restore(flags);
-
- while (usec >= 1000000) {
- usec -= 1000000;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
+u32 arch_gettimeoffset(void)
{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /*
- * This is revolting. We need to set "xtime" correctly. However, the
- * value in this location is the value at the most recent update of
- * wall time. Discover what correction gettimeofday() would have
- * made, and then undo it!
- */
- nsec -= do_gettimeoffset() * NSEC_PER_USEC;
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
- return 0;
+ return do_gettimeoffset() * 1000;
}

-EXPORT_SYMBOL(do_settimeofday);
-
-
/*
* BUG: This routine does not handle hour overflow properly; it just
* sets the minutes. Usually you'll only notice that after reboot!

2009-07-17 00:21:38

by john stultz

[permalink] [raw]
Subject: [PATCH] Convert m68k to use arch_gettimeoffset()

This patch converts m68k to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

This patch applies on top of Linus' current -git tree (2.6.31-rc3).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. My cross-compiler is now out of date (gcc4.2) so I
wasn't able to check if it compiled. Any assistance from arch
maintainers or testers to get this merged would be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---
Kconfig | 6 ++++
kernel/time.c | 70 +---------------------------------------------------------
2 files changed, 8 insertions(+), 68 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index fb87c08..29dd848 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -58,6 +58,12 @@ config HZ
int
default 100

+config GENERIC_TIME
+ def_bool y
+
+config ARCH_USES_GETTIMEOFFSET
+ def_bool y
+
mainmenu "Linux/68k Kernel Configuration"

source "init/Kconfig"
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 54d9807..17dc2a3 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -91,77 +91,11 @@ void __init time_init(void)
mach_sched_init(timer_interrupt);
}

-/*
- * This version of gettimeofday has near microsecond resolution.
- */
-void do_gettimeofday(struct timeval *tv)
+u32 arch_gettimeoffset(void)
{
- unsigned long flags;
- unsigned long seq;
- unsigned long usec, sec;
- unsigned long max_ntp_tick = tick_usec - tickadj;
-
- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
-
- usec = mach_gettimeoffset();
-
- /*
- * If time_adjust is negative then NTP is slowing the clock
- * so make sure not to go into next possible interval.
- * Better to lose some accuracy than have time go backwards..
- */
- if (unlikely(time_adjust < 0))
- usec = min(usec, max_ntp_tick);
-
- sec = xtime.tv_sec;
- usec += xtime.tv_nsec/1000;
- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
-
- while (usec >= 1000000) {
- usec -= 1000000;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /* This is revolting. We need to set the xtime.tv_nsec
- * correctly. However, the value in this location is
- * is value at the last tick.
- * Discover what correction gettimeofday
- * would have done, and then undo it!
- */
- nsec -= 1000 * mach_gettimeoffset();
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
- return 0;
+ return mach_gettimeoffset() * 1000;
}

-EXPORT_SYMBOL(do_settimeofday);
-
-
static int __init rtc_init(void)
{
struct platform_device *pdev;

2009-07-17 00:26:41

by john stultz

[permalink] [raw]
Subject: [PATCH] Convert blackfin to use arch_gettimeoffset()

This patch converts blackfin to use GENERIC_TIME via the arch_getoffset()
infrastructure, reducing the amount of arch specific code we need to
maintain.

This patch applies on top of Linus' current -git tree (2.6.31-rc3).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. My cross-compiler is now out of date (gcc4.2) so I
wasn't able to check if it compiled. Any assistance from arch
maintainers or testers to get this merged would be great.

thanks
-john

Signed-off-by: John Stultz <[email protected]>
---
Kconfig | 16 +++++++++++---
kernel/time.c | 63 +---------------------------------------------------------
2 files changed, 14 insertions(+), 65 deletions(-)

diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 7faa2f5..263b133 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -229,7 +229,7 @@ endchoice

config SMP
depends on BF561
- select GENERIC_TIME
+ select NO_ARCH_GETTIMEOFFSET
bool "Symmetric multi-processing support"
---help---
This enables support for systems with more than one CPU,
@@ -612,12 +612,13 @@ comment "Kernel Timer/Scheduler"
source kernel/Kconfig.hz

config GENERIC_TIME
- bool "Generic time"
- default y
+ def_bool y
+
+config NO_ARCH_GETTIMEOFFSET
+ def_bool n

config GENERIC_CLOCKEVENTS
bool "Generic clock events"
- depends on GENERIC_TIME
default y

choice
@@ -639,6 +640,7 @@ config CYCLES_CLOCKSOURCE
depends on GENERIC_CLOCKEVENTS
depends on !BFIN_SCRATCH_REG_CYCLES
depends on !SMP
+ select NO_ARCH_GETTIMEOFFSET
help
If you say Y here, you will enable support for using the 'cycles'
registers as a clock source. Doing so means you will be unable to
@@ -649,9 +651,15 @@ config CYCLES_CLOCKSOURCE
config GPTMR0_CLOCKSOURCE
bool "Use GPTimer0 as a clocksource (higher rating)"
select BFIN_GPTIMERS
+ select NO_ARCH_GETTIMEOFFSET
depends on GENERIC_CLOCKEVENTS
depends on !TICKSOURCE_GPTMR0

+config ARCH_USES_GETTIMEOFFSET
+ depends on !NO_ARCH_GETTIMEOFFSET
+ def_bool y
+
+
source kernel/time/Kconfig

comment "Misc"
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index adb54aa..e5069fe 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -81,11 +81,11 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *))
#endif
}

+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
/*
* Should return useconds since last timer tick
*/
-#ifndef CONFIG_GENERIC_TIME
-static unsigned long gettimeoffset(void)
+u32 arch_gettimeoffset(void)
{
unsigned long offset;
unsigned long clocks_per_jiffy;
@@ -184,65 +184,6 @@ void __init time_init(void)
time_sched_init(timer_interrupt);
}

-#ifndef CONFIG_GENERIC_TIME
-void do_gettimeofday(struct timeval *tv)
-{
- unsigned long flags;
- unsigned long seq;
- unsigned long usec, sec;
-
- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
- usec = gettimeoffset();
- sec = xtime.tv_sec;
- usec += (xtime.tv_nsec / NSEC_PER_USEC);
- }
- while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
- while (usec >= USEC_PER_SEC) {
- usec -= USEC_PER_SEC;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /*
- * This is revolting. We need to set the xtime.tv_usec
- * correctly. However, the value in this location is
- * is value at the last tick.
- * Discover what correction gettimeofday
- * would have done, and then undo it!
- */
- nsec -= (gettimeoffset() * NSEC_PER_USEC);
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
-
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
-
- return 0;
-}
-EXPORT_SYMBOL(do_settimeofday);
-#endif /* !CONFIG_GENERIC_TIME */
-
/*
* Scheduler clock - returns current time in nanosec units.
*/

2009-07-17 02:26:26

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH] Convert blackfin to use arch_gettimeoffset()

On Thu, Jul 16, 2009 at 20:25, john stultz wrote:
> This patch converts blackfin to use GENERIC_TIME via the arch_getoffset()
> infrastructure, reducing the amount of arch specific code we need to
> maintain.
>
> This patch applies on top of Linus' current -git tree (2.6.31-rc3).
>
> I've taken my best swing at converting this, but I'm not 100% confident
> I got it right. My cross-compiler is now out of date (gcc4.2) so I
> wasn't able to  check if it compiled. Any assistance from arch
> maintainers or testers to get this merged would be great.

something seems to be off as the Blackfin defconfig now does:
LD .tmp_vmlinux1
kernel/built-in.o: In function `clocksource_forward_now':
kernel/time/timekeeping.c:82: undefined reference to `arch_gettimeoffset'
kernel/built-in.o: In function `getnstimeofday':
kernel/time/timekeeping.c:119: undefined reference to `arch_gettimeoffset'
make: *** [.tmp_vmlinux1] Error 1

most likely because the Blackfin time.c is the old stuff
(non-clocksource) while time-ts.c is the newer stuff (clocksource) and
this change only touches time.c
-mike

2009-07-17 05:17:40

by john stultz

[permalink] [raw]
Subject: Re: [PATCH] Convert blackfin to use arch_gettimeoffset()

On Thu, 2009-07-16 at 22:26 -0400, Mike Frysinger wrote:
> On Thu, Jul 16, 2009 at 20:25, john stultz wrote:
> > This patch converts blackfin to use GENERIC_TIME via the arch_getoffset()
> > infrastructure, reducing the amount of arch specific code we need to
> > maintain.
> >
> > This patch applies on top of Linus' current -git tree (2.6.31-rc3).
> >
> > I've taken my best swing at converting this, but I'm not 100% confident
> > I got it right. My cross-compiler is now out of date (gcc4.2) so I
> > wasn't able to check if it compiled. Any assistance from arch
> > maintainers or testers to get this merged would be great.
>
> something seems to be off as the Blackfin defconfig now does:
> LD .tmp_vmlinux1
> kernel/built-in.o: In function `clocksource_forward_now':
> kernel/time/timekeeping.c:82: undefined reference to `arch_gettimeoffset'
> kernel/built-in.o: In function `getnstimeofday':
> kernel/time/timekeeping.c:119: undefined reference to `arch_gettimeoffset'
> make: *** [.tmp_vmlinux1] Error 1
>
> most likely because the Blackfin time.c is the old stuff
> (non-clocksource) while time-ts.c is the newer stuff (clocksource) and
> this change only touches time.c

Hrm.. Ok. I'll take a look. Thanks for testing and the pointer!

-john

2009-07-17 05:33:49

by john stultz

[permalink] [raw]
Subject: Re: [PATCH] Convert blackfin to use arch_gettimeoffset()

On Thu, 2009-07-16 at 22:26 -0400, Mike Frysinger wrote:
> On Thu, Jul 16, 2009 at 20:25, john stultz wrote:
> > This patch converts blackfin to use GENERIC_TIME via the arch_getoffset()
> > infrastructure, reducing the amount of arch specific code we need to
> > maintain.
> >
> > This patch applies on top of Linus' current -git tree (2.6.31-rc3).
> >
> > I've taken my best swing at converting this, but I'm not 100% confident
> > I got it right. My cross-compiler is now out of date (gcc4.2) so I
> > wasn't able to check if it compiled. Any assistance from arch
> > maintainers or testers to get this merged would be great.
>
> something seems to be off as the Blackfin defconfig now does:
> LD .tmp_vmlinux1
> kernel/built-in.o: In function `clocksource_forward_now':
> kernel/time/timekeeping.c:82: undefined reference to `arch_gettimeoffset'
> kernel/built-in.o: In function `getnstimeofday':
> kernel/time/timekeeping.c:119: undefined reference to `arch_gettimeoffset'
> make: *** [.tmp_vmlinux1] Error 1
>
> most likely because the Blackfin time.c is the old stuff
> (non-clocksource) while time-ts.c is the newer stuff (clocksource) and
> this change only touches time.c

Ok. So I guess I missed that time.c isn't built if GENERIC_CLOCKEVENTS
isn't enabled, so ARCH_HAS_GETTIMEOFFSET needs to depend on !
GENERIC_CLOCKEVENTS.

Hopefully I've got it cleared up now. Let me know if I'm still causing
trouble.

thanks
-john



This patch converts blackfin to use GENERIC_TIME via the
arch_getoffset() infrastructure, reducing the amount of arch specific
code we need to maintain.

This patch applies on top of Linus' current -git tree (2.6.31-rc3).

I've taken my best swing at converting this, but I'm not 100% confident
I got it right. My cross-compiler is now out of date (gcc4.2) so I
wasn't able to check if it compiled. Any assistance from arch
maintainers or testers to get this merged would be great.

Signed-off-by: John Stultz <[email protected]>
---

diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 7faa2f5..c8f5c3d 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -229,7 +229,7 @@ endchoice

config SMP
depends on BF561
- select GENERIC_TIME
+ select GENERIC_CLOCKEVENTS
bool "Symmetric multi-processing support"
---help---
This enables support for systems with more than one CPU,
@@ -612,12 +612,10 @@ comment "Kernel Timer/Scheduler"
source kernel/Kconfig.hz

config GENERIC_TIME
- bool "Generic time"
- default y
+ def_bool y

config GENERIC_CLOCKEVENTS
bool "Generic clock events"
- depends on GENERIC_TIME
default y

choice
@@ -652,6 +650,10 @@ config GPTMR0_CLOCKSOURCE
depends on GENERIC_CLOCKEVENTS
depends on !TICKSOURCE_GPTMR0

+config ARCH_USES_GETTIMEOFFSET
+ depends on !GENERIC_CLOCKEVENTS
+ def_bool y
+
source kernel/time/Kconfig

comment "Misc"
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index adb54aa..e5069fe 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -81,11 +81,11 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *))
#endif
}

+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
/*
* Should return useconds since last timer tick
*/
-#ifndef CONFIG_GENERIC_TIME
-static unsigned long gettimeoffset(void)
+u32 arch_gettimeoffset(void)
{
unsigned long offset;
unsigned long clocks_per_jiffy;
@@ -184,65 +184,6 @@ void __init time_init(void)
time_sched_init(timer_interrupt);
}

-#ifndef CONFIG_GENERIC_TIME
-void do_gettimeofday(struct timeval *tv)
-{
- unsigned long flags;
- unsigned long seq;
- unsigned long usec, sec;
-
- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
- usec = gettimeoffset();
- sec = xtime.tv_sec;
- usec += (xtime.tv_nsec / NSEC_PER_USEC);
- }
- while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
- while (usec >= USEC_PER_SEC) {
- usec -= USEC_PER_SEC;
- sec++;
- }
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, sec = tv->tv_sec;
- long wtm_nsec, nsec = tv->tv_nsec;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irq(&xtime_lock);
- /*
- * This is revolting. We need to set the xtime.tv_usec
- * correctly. However, the value in this location is
- * is value at the last tick.
- * Discover what correction gettimeofday
- * would have done, and then undo it!
- */
- nsec -= (gettimeoffset() * NSEC_PER_USEC);
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
- set_normalized_timespec(&xtime, sec, nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- ntp_clear();
-
- write_sequnlock_irq(&xtime_lock);
- clock_was_set();
-
- return 0;
-}
-EXPORT_SYMBOL(do_settimeofday);
-#endif /* !CONFIG_GENERIC_TIME */
-
/*
* Scheduler clock - returns current time in nanosec units.
*/

2009-07-20 08:24:49

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH] Convert blackfin to use arch_gettimeoffset()

On Fri, Jul 17, 2009 at 01:33, john stultz wrote:
> On Thu, 2009-07-16 at 22:26 -0400, Mike Frysinger wrote:
>> On Thu, Jul 16, 2009 at 20:25, john stultz wrote:
>> > This patch converts blackfin to use GENERIC_TIME via the arch_getoffset()
>> > infrastructure, reducing the amount of arch specific code we need to
>> > maintain.
>> >
>> > This patch applies on top of Linus' current -git tree (2.6.31-rc3).
>> >
>> > I've taken my best swing at converting this, but I'm not 100% confident
>> > I got it right. My cross-compiler is now out of date (gcc4.2) so I
>> > wasn't able to  check if it compiled. Any assistance from arch
>> > maintainers or testers to get this merged would be great.
>>
>> something seems to be off as the Blackfin defconfig now does:
>>   LD      .tmp_vmlinux1
>> kernel/built-in.o: In function `clocksource_forward_now':
>> kernel/time/timekeeping.c:82: undefined reference to `arch_gettimeoffset'
>> kernel/built-in.o: In function `getnstimeofday':
>> kernel/time/timekeeping.c:119: undefined reference to `arch_gettimeoffset'
>> make: *** [.tmp_vmlinux1] Error 1
>>
>> most likely because the Blackfin time.c is the old stuff
>> (non-clocksource) while time-ts.c is the newer stuff (clocksource) and
>> this change only touches time.c
>
> Ok. So I guess I missed that time.c isn't built if GENERIC_CLOCKEVENTS
> isn't enabled, so ARCH_HAS_GETTIMEOFFSET needs to depend on !
> GENERIC_CLOCKEVENTS.
>
> Hopefully I've got it cleared up now. Let me know if I'm still causing
> trouble.

this one seems to build & boot for GENERIC_CLOCKEVENTS set to y or n. thanks.
-mike