Skip to contentSkip to conversation

Convert alpha to use arch_gettimeoffset()

PATCH In review john stultz 5 participants 15 messages Jun 11, 2009 – Jul 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---

 Kconfig       |    8 ++++++
 kernel/time.c |   72 +++-------------------------------------------------------
 2 files changed, 12 insertions(+), 68 deletions(-)
arch/alpha/Kconfig +8 -0
index 9fb8aae..4434481 100644
@@ -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
arch/alpha/kernel/time.c +4 -68

94 lines not on this page · raw message

#1 lore raw

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

Quoted 142 lines

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

---

 Kconfig       |    8 ++++++
 kernel/time.c |   72 +++--------------------------------------------

----------- 2 files changed, 12 insertions(+), 68 deletions(-)

arch/alpha/Kconfig +8 -0
index 9fb8aae..4434481 100644
@@ -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
arch/alpha/kernel/time.c +0 -0
index b04e2cb..8f7eb6d 100644
@@ -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;

arch/alpha/kernel/time.c +3 -63
-	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
 
--
Quoted 8 lines

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

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

------- End of Original Message -------

#2 lore raw

PATCH 1/1 Convert m32r to use arch_gettimeoffset()

In reply to john stultz

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

---
 Kconfig       |    6 ++++
 kernel/time.c |   74 ++--------------------------------------------------------
 2 files changed, 9 insertions(+), 71 deletions(-)
arch/m32r/Kconfig +6 -0
index cabba33..c41234f 100644
@@ -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"
arch/m32r/kernel/time.c +3 -71

95 lines not on this page · raw message

#3 lore raw
In reply to john stultz
Quoted 4 lines · john stultz

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.

Quoted 8 lines
arch/alpha/kernel/time.c +2 -0
+	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

...

arch/alpha/kernel/time.c do_gettimeofday(struct timeval *tv) · line 440

Quoted 1 line
arch/alpha/kernel/time.c +1 -0
+	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~

#4 lore raw
Quoted 9 lines · Richard Henderson
Quoted 4 lines · john stultz

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.

Quoted 23 lines
Quoted 8 lines
arch/alpha/kernel/time.c +2 -0
+	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

...

arch/alpha/kernel/time.c do_gettimeofday(struct timeval *tv) · line 440

Quoted 1 line
arch/alpha/kernel/time.c +1 -0
+	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;
Quoted 2 lines

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

#5 lore raw
Quoted 9 lines · john stultz
Quoted 7 lines · Richard Henderson
Quoted 5 lines · john stultz

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

Quoted 9 lines
Quoted 4 lines

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.

Quoted 2 lines

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~

#6 lore raw
Quoted 2 lines · Richard Henderson

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.

#7 lore raw

PATCH RESEND 1/1 Convert m32r to use arch_gettimeoffset()

In reply to john stultz

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

---

 Kconfig       |    6 ++++
 kernel/time.c |   74 ++--------------------------------------------------------
 2 files changed, 9 insertions(+), 71 deletions(-)
arch/m32r/Kconfig +6 -0
index cabba33..c41234f 100644
@@ -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"
arch/m32r/kernel/time.c +3 -71

95 lines not on this page · raw message

#8 lore raw

PATCH 1/1 Convert cris to use arch_gettimeoffset()

In reply to john stultz

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

---
 Kconfig       |    6 +++++
 kernel/time.c |   68 +---------------------------------------------------------
 2 files changed, 8 insertions(+), 66 deletions(-)
arch/cris/Kconfig +6 -0
index 7adac38..059eac6 100644
@@ -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
arch/cris/kernel/time.c +2 -66

77 lines not on this page · raw message

#9 lore raw

PATCH 1/1 Convert m68k to use arch_gettimeoffset()

In reply to john stultz

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

---
 Kconfig       |    6 ++++
 kernel/time.c |   70 +---------------------------------------------------------
 2 files changed, 8 insertions(+), 68 deletions(-)
arch/m68k/Kconfig +6 -0
index fb87c08..29dd848 100644
@@ -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"
arch/m68k/kernel/time.c +2 -68

79 lines not on this page · raw message

#10 lore raw

PATCH 1/1 Convert blackfin to use arch_gettimeoffset()

In reply to john stultz

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

---
 Kconfig       |   16 +++++++++++---
 kernel/time.c |   63 +---------------------------------------------------------
 2 files changed, 14 insertions(+), 65 deletions(-)
arch/blackfin/Kconfig +12 -4
index 7faa2f5..263b133 100644
@@ -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"
arch/blackfin/kernel/time.c +2 -61

78 lines not on this page · raw message

#11 lore raw

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

Quoted 10 lines · john stultz

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

#12 lore raw

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

Quoted 20 lines · Mike Frysinger
Quoted 10 lines · john stultz

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

Quoted 3 lines

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

#13 lore raw

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

In reply to Mike Frysinger
Quoted 20 lines · Mike Frysinger
Quoted 10 lines · john stultz

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

Quoted 3 lines

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.

---

arch/blackfin/Kconfig +6 -4
index 7faa2f5..c8f5c3d 100644
@@ -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"
arch/blackfin/kernel/time.c +2 -61

78 lines not on this page · raw message

#14 lore raw

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

Quoted 25 lines · john stultz
Quoted 20 lines · Mike Frysinger
Quoted 10 lines · john stultz

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

Quoted 3 lines

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

Quoted 6 lines

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