linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/20] localize xtime_lock usage to kernel/time/
@ 2011-01-27 14:58 Torben Hohn
  2011-01-27 14:58 ` [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c Torben Hohn
                   ` (19 more replies)
  0 siblings, 20 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:58 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

This patchseries cleans up the unnecessary export of xtime_lock
to arch code. After this series is applied its only used in
kernel/time/

- move do_timer() into kernel/time/timekeeping.c
  and provide a version which properly takes the xtime_lock.

- get_jiffies_64() is moved to kernel/time/jiffies.c

- provide get_xtime_and_monotonic_offset() for use in
  kernel/hrtimer.c and use that.

- make all arch code use the new xtime_update() function.

- finally moves do_timer() and xtime_lock into a header file
  private to kernel/time


ChangeLog:
   for v2:
      - add maintainer CC to all the arch commits.
      - improved commit logs based on tglx comments.
      - also deals with kernel/time.c and kernel/hrtimer.c
        by moving get_jiffies_64() and providing a function
	for kernel/hrtimer.c to use.
      - fix kdoc comment for xtime_update.
        
---

Torben Hohn (20):
      move do_timer() from kernel/timer.c into kernel/time/timekeeping.c
      move get_jiffies_64 to kernel/time/jiffies.c
      provide get_xtime_and_monotonic_offset() and use it in hrtimer.c
      provide xtime_update() which does not require the caller to hold xtime_lock
      alpha: change do_timer() to xtime_update()
      arm: switch from do_timer() to xtime_update()
      arm/mach-clps711x: switch do_timer() to xtime_update()
      blackfin: switch from do_timer() to xtime_update()
      cris/arch-v10: switch do_timer() to xtime_update()
      cris/arch-v32: switch do_timer() to xtime_update()
      frv: switch do_timer() to xtime_update()
      h8300: switch do_timer() to xtime_update()
      ia64: switch do_timer() to xtime_update()
      m32r: switch from do_timer() to xtime_update()
      m68k: switch do_timer() to xtime_update()
      mn10300: switch do_timer() to xtimer_update()
      parisc: switch do_timer() to xtime_update()
      sparc: switch do_timer() to xtime_update()
      xtensa: switch do_timer() to xtime_update()
      make do_timer() and xtime_lock private to the timer code


 arch/alpha/kernel/time.c                   |    8 +----
 arch/arm/kernel/time.c                     |    4 +-
 arch/arm/mach-clps711x/include/mach/time.h |    2 +
 arch/blackfin/kernel/time.c                |    6 +---
 arch/cris/arch-v10/kernel/time.c           |    4 +-
 arch/cris/arch-v32/kernel/time.c           |    6 +---
 arch/frv/kernel/time.c                     |    9 ++---
 arch/h8300/kernel/time.c                   |    4 +-
 arch/h8300/kernel/timer/timer8.c           |    2 +
 arch/ia64/kernel/time.c                    |   19 +++--------
 arch/ia64/xen/time.c                       |   13 +++-----
 arch/m32r/kernel/time.c                    |    5 +--
 arch/m68k/bvme6000/config.c                |    4 +-
 arch/m68k/kernel/time.c                    |    4 +-
 arch/m68k/mvme147/config.c                 |    4 +-
 arch/m68k/mvme16x/config.c                 |    4 +-
 arch/m68k/sun3/sun3ints.c                  |    2 +
 arch/m68knommu/kernel/time.c               |    8 +----
 arch/mn10300/kernel/time.c                 |    6 +---
 arch/parisc/kernel/time.c                  |    4 +-
 arch/sparc/kernel/pcic.c                   |    4 +-
 arch/sparc/kernel/time_32.c                |    9 +----
 arch/xtensa/kernel/time.c                  |    6 +---
 include/linux/sched.h                      |    2 +
 include/linux/time.h                       |    4 +-
 kernel/hrtimer.c                           |   12 +------
 kernel/time.c                              |   17 ----------
 kernel/time/jiffies.c                      |   17 ++++++++++
 kernel/time/ntp.c                          |    2 +
 kernel/time/tick-common.c                  |    1 +
 kernel/time/tick-sched.c                   |    1 +
 kernel/time/timekeeping.c                  |   47 +++++++++++++++++++++++++++-
 kernel/time/timer-internal.h               |    7 ++++
 kernel/timer.c                             |   12 -------
 34 files changed, 123 insertions(+), 136 deletions(-)
 create mode 100644 kernel/time/timer-internal.h

-- 
torben Hohn

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

* [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
@ 2011-01-27 14:58 ` Torben Hohn
  2011-01-31 14:03   ` [tip:timers/core] time: Move do_timer() to kernel/time/timekeeping.c tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c Torben Hohn
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:58 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

this allows us to make update_wall_time() static.

do_timer only updates the jiffies_64 value, and calls update_walltime
these actions are all residing in kernel/time, and require holding
a writelock on xtime_lock.

one goal of this patchset is to make xtime_lock local to kernel/time.
thats why we are moving things.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 include/linux/time.h      |    1 -
 kernel/time/timekeeping.c |   13 ++++++++++++-
 kernel/timer.c            |   12 ------------
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 1e6d3b5..86a9c48 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -166,7 +166,6 @@ extern void monotonic_to_bootbased(struct timespec *ts);
 extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
 extern int timekeeping_valid_for_hres(void);
 extern u64 timekeeping_max_deferment(void);
-extern void update_wall_time(void);
 extern void timekeeping_leap_insert(int leapsecond);
 
 struct tms;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d27c756..e4fd957 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -779,7 +779,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
  *
  * Called from the timer interrupt, must hold a write on xtime_lock.
  */
-void update_wall_time(void)
+static void update_wall_time(void)
 {
 	struct clocksource *clock;
 	cycle_t offset;
@@ -946,3 +946,14 @@ struct timespec get_monotonic_coarse(void)
 				now.tv_nsec + mono.tv_nsec);
 	return now;
 }
+
+/*
+ * The 64-bit jiffies value is not atomic - you MUST NOT read it
+ * without sampling the sequence number in xtime_lock.
+ * jiffies is defined in the linker script...
+ */
+void do_timer(unsigned long ticks)
+{
+	jiffies_64 += ticks;
+	update_wall_time();
+}
diff --git a/kernel/timer.c b/kernel/timer.c
index afdc13b..87f656c 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1293,18 +1293,6 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-/*
- * The 64-bit jiffies value is not atomic - you MUST NOT read it
- * without sampling the sequence number in xtime_lock.
- * jiffies is defined in the linker script...
- */
-
-void do_timer(unsigned long ticks)
-{
-	jiffies_64 += ticks;
-	update_wall_time();
-}
-
 #ifdef __ARCH_WANT_SYS_ALARM
 
 /*


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

* [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
  2011-01-27 14:58 ` [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 11:36   ` Thomas Gleixner
  2011-01-31 14:04   ` [tip:timers/core] time: Move " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
                   ` (17 subsequent siblings)
  19 siblings, 2 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

in order to make the xtime_lock local to kernel/time
all users of this lock need to be moved there.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 kernel/time.c         |   17 -----------------
 kernel/time/jiffies.c |   17 +++++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index 55337a8..9c72ba5 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -693,23 +693,6 @@ unsigned long nsecs_to_jiffies(u64 n)
 	return (unsigned long)nsecs_to_jiffies64(n);
 }
 
-#if (BITS_PER_LONG < 64)
-u64 get_jiffies_64(void)
-{
-	unsigned long seq;
-	u64 ret;
-
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		ret = jiffies_64;
-	} while (read_seqretry(&xtime_lock, seq));
-	return ret;
-}
-EXPORT_SYMBOL(get_jiffies_64);
-#endif
-
-EXPORT_SYMBOL(jiffies);
-
 /*
  * Add two timespec values and do a safety check for overflow.
  * It's assumed that both values are valid (>= 0)
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 5404a84..54441c4 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -64,6 +64,23 @@ struct clocksource clocksource_jiffies = {
 	.shift		= JIFFIES_SHIFT,
 };
 
+#if (BITS_PER_LONG < 64)
+u64 get_jiffies_64(void)
+{
+	unsigned long seq;
+	u64 ret;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		ret = jiffies_64;
+	} while (read_seqretry(&xtime_lock, seq));
+	return ret;
+}
+EXPORT_SYMBOL(get_jiffies_64);
+#endif
+
+EXPORT_SYMBOL(jiffies);
+
 static int __init init_jiffies_clocksource(void)
 {
 	return clocksource_register(&clocksource_jiffies);


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

* [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
  2011-01-27 14:58 ` [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 11:38   ` Thomas Gleixner
                     ` (2 more replies)
  2011-01-27 14:59 ` [PATCH v2 04/20] provide xtime_update() which does not require the caller to hold xtime_lock Torben Hohn
                   ` (16 subsequent siblings)
  19 siblings, 3 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

2 places in hrtimer need to take the xtime_lock, but we want it
to be private to kernel/time...

we just provide a function, which gets the values with proper
read locking the xtime_lock.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 include/linux/time.h      |    1 +
 kernel/hrtimer.c          |   12 ++----------
 kernel/time/timekeeping.c |   21 +++++++++++++++++++++
 3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 86a9c48..b9b2f5b 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -127,6 +127,7 @@ struct timespec current_kernel_time(void);
 struct timespec __current_kernel_time(void); /* does not take xtime_lock */
 struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
 struct timespec get_monotonic_coarse(void);
+void get_xtime_and_monotonic_offset(struct timespec *xts, struct timespec *tom);
 
 #define CURRENT_TIME		(current_kernel_time())
 #define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 0c8d7c0..6ef9d47 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -85,13 +85,8 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
 {
 	ktime_t xtim, tomono;
 	struct timespec xts, tom;
-	unsigned long seq;
 
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		xts = __current_kernel_time();
-		tom = __get_wall_to_monotonic();
-	} while (read_seqretry(&xtime_lock, seq));
+	get_xtime_and_monotonic_offset(&xts, &tom);
 
 	xtim = timespec_to_ktime(xts);
 	tomono = timespec_to_ktime(tom);
@@ -617,10 +612,7 @@ static void retrigger_next_event(void *arg)
 	if (!hrtimer_hres_active())
 		return;
 
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		wtm = __get_wall_to_monotonic();
-	} while (read_seqretry(&xtime_lock, seq));
+	get_xtime_and_monotonic_offset(NULL, &wtm);
 	set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);
 
 	base = &__get_cpu_var(hrtimer_bases);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e4fd957..6085fa5 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -957,3 +957,24 @@ void do_timer(unsigned long ticks)
 	jiffies_64 += ticks;
 	update_wall_time();
 }
+
+/**
+ * get_xtime_and_monotonic_offset() - get xtime and wall_to_monotonic
+ * @xts: pointer to struct timespec, filled with the current_time
+ * @tom: pointer to struct timespec, filled with the wall_to_monotonic offset
+ *
+ * this function does proper locking.
+ * and it allows passing NULL, when one is not interested in the value.
+ */
+void get_xtime_and_monotonic_offset(struct timespec *xts, struct timespec *tom)
+{
+	unsigned long seq;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		if (xts)
+			*xts = xtime;
+		if (tom)
+			*tom = wall_to_monotonic;
+	} while (read_seqretry(&xtime_lock, seq));
+}


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

* [PATCH v2 04/20] provide xtime_update() which does not require the caller to hold xtime_lock
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (2 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:05   ` [tip:timers/core] time: Provide xtime_update() tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 05/20] alpha: change do_timer() to xtime_update() Torben Hohn
                   ` (15 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

like do_timer().
this change avoids having this code sequence all over the place:

seq_writelock( &xtime_lock );
do_timer();
seq_writeunlock( &xtime_lock );

Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 include/linux/sched.h     |    1 +
 kernel/time/timekeeping.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 738ec15..c0b0bb7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2045,6 +2045,7 @@ extern void release_uids(struct user_namespace *ns);
 #include <asm/current.h>
 
 extern void do_timer(unsigned long ticks);
+extern void xtime_update(unsigned long ticks);
 
 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
 extern int wake_up_process(struct task_struct *tsk);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 6085fa5..8dd6e38 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -978,3 +978,16 @@ void get_xtime_and_monotonic_offset(struct timespec *xts, struct timespec *tom)
 			*tom = wall_to_monotonic;
 	} while (read_seqretry(&xtime_lock, seq));
 }
+
+/**
+ * xtime_update() - advances the timekeeping infrastructure
+ * @ticks:	number of ticks, that have elapsed since the last call.
+ *
+ * this function needs to be called with interrupts disabled.
+ */
+void xtime_update(unsigned long ticks)
+{
+	write_seqlock(&xtime_lock);
+	do_timer(ticks);
+	write_sequnlock(&xtime_lock);
+}


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

* [PATCH v2 05/20] alpha: change do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (3 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 04/20] provide xtime_update() which does not require the caller to hold xtime_lock Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 10:23   ` Thomas Gleixner
  2011-01-31 14:05   ` [tip:timers/core] alpha: Change " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 06/20] arm: switch from " Torben Hohn
                   ` (14 subsequent siblings)
  19 siblings, 2 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, johnstul, hch, yong.zhang0, Thomas Gleixner,
	Matt Turner, Richard Henderson

xtime_update() takes the xtime_lock itself.
state does not to be protected with this lock.
its only touched here and during init.

Cc: Richard Henderson <rth@twiddle.net>
Cc:Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/alpha/kernel/time.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index c1f3e7c..a58e84f 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -159,7 +159,7 @@ void read_persistent_clock(struct timespec *ts)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 irqreturn_t timer_interrupt(int irq, void *dev)
 {
@@ -172,8 +172,6 @@ irqreturn_t timer_interrupt(int irq, void *dev)
 	profile_tick(CPU_PROFILING);
 #endif
 
-	write_seqlock(&xtime_lock);
-
 	/*
 	 * Calculate how many ticks have passed since the last update,
 	 * including any previous partial leftover.  Save any resulting
@@ -187,9 +185,7 @@ irqreturn_t timer_interrupt(int irq, void *dev)
 	nticks = delta >> FIX_SHIFT;
 
 	if (nticks)
-		do_timer(nticks);
-
-	write_sequnlock(&xtime_lock);
+		xtime_update(nticks);
 
 	if (test_irq_work_pending()) {
 		clear_irq_work_pending();


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

* [PATCH v2 06/20] arm: switch from do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (4 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 05/20] alpha: change do_timer() to xtime_update() Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:06   ` [tip:timers/core] arm: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 07/20] arm/mach-clps711x: switch " Torben Hohn
                   ` (13 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Russell King, Peter Zijlstra, johnstul, hch, yong.zhang0,
	Thomas Gleixner

xtime_update takes the xtime_lock itself.


Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/arm/kernel/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 3d76bf2..1ff46ca 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -107,9 +107,7 @@ void timer_tick(void)
 {
 	profile_tick(CPU_PROFILING);
 	do_leds();
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));
 #endif


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

* [PATCH v2 07/20] arm/mach-clps711x: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (5 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 06/20] arm: switch from " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:06   ` [tip:timers/core] arm/mach-clps711x: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 08/20] blackfin: switch from " Torben Hohn
                   ` (12 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Russell King, Peter Zijlstra, johnstul, hch, yong.zhang0,
	Thomas Gleixner

do_timer() requires holding the xtime_lock, which this
code did not do.
use the safe version xtime_update()

Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/arm/mach-clps711x/include/mach/time.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-clps711x/include/mach/time.h b/arch/arm/mach-clps711x/include/mach/time.h
index 8fe283c..61fef91 100644
--- a/arch/arm/mach-clps711x/include/mach/time.h
+++ b/arch/arm/mach-clps711x/include/mach/time.h
@@ -30,7 +30,7 @@ p720t_timer_interrupt(int irq, void *dev_id)
 {
 	struct pt_regs *regs = get_irq_regs();
 	do_leds();
-	do_timer(1);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(regs));
 #endif


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

* [PATCH v2 08/20] blackfin: switch from do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (6 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 07/20] arm/mach-clps711x: switch " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-27 19:42   ` Mike Frysinger
  2011-01-31 14:07   ` [tip:timers/core] blackfin: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 09/20] cris/arch-v10: switch " Torben Hohn
                   ` (11 subsequent siblings)
  19 siblings, 2 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Mike Frysinger, Peter Zijlstra, johnstul, hch, yong.zhang0,
	Thomas Gleixner

xtime_update() takes the xtime_lock itself.


Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/blackfin/kernel/time.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index c911361..8d73724 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -114,16 +114,14 @@ u32 arch_gettimeoffset(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 #ifdef CONFIG_CORE_TIMER_IRQ_L1
 __attribute__((l1_text))
 #endif
 irqreturn_t timer_interrupt(int irq, void *dummy)
 {
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 #ifdef CONFIG_IPIPE
 	update_root_process_times(get_irq_regs());


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

* [PATCH v2 09/20] cris/arch-v10: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (7 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 08/20] blackfin: switch from " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:07   ` [tip:timers/core] cris: arch-v10: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 10/20] cris/arch-v32: switch " Torben Hohn
                   ` (10 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: hch, Jesper Nilsson, Peter Zijlstra, johnstul, Mikael Starvik,
	yong.zhang0, Thomas Gleixner

this code failed to take the xtime_lock, which must be held
when calling do_timer().

use the safe version xtime_update()

Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/cris/arch-v10/kernel/time.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 00eb36f..20c85b5 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -140,7 +140,7 @@ stop_watchdog(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 //static unsigned short myjiff; /* used by our debug routine print_timestamp */
@@ -176,7 +176,7 @@ timer_interrupt(int irq, void *dev_id)
 
 	/* call the real timer interrupt handler */
 
-	do_timer(1);
+	xtime_update(1);
 	
         cris_do_profile(regs); /* Save profiling information */
         return IRQ_HANDLED;


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

* [PATCH v2 10/20] cris/arch-v32: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (8 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 09/20] cris/arch-v10: switch " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:07   ` [tip:timers/core] cris: arch-v32: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 11/20] frv: switch " Torben Hohn
                   ` (9 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: hch, Jesper Nilsson, Peter Zijlstra, johnstul, Mikael Starvik,
	yong.zhang0, Thomas Gleixner

xtime_update() takes the xtime_lock itself.

Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/cris/arch-v32/kernel/time.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index a545211..bb978ed 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -183,7 +183,7 @@ void handle_watchdog_bite(struct pt_regs *regs)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick.
+ * as well as call the "xtime_update()" routine every clocktick.
  */
 extern void cris_do_profile(struct pt_regs *regs);
 
@@ -216,9 +216,7 @@ static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
 		return IRQ_HANDLED;
 
 	/* Call the real timer interrupt handler */
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
         return IRQ_HANDLED;
 }
 


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

* [PATCH v2 11/20] frv: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (9 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 10/20] cris/arch-v32: switch " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:08   ` [tip:timers/core] frv: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 12/20] h8300: switch " Torben Hohn
                   ` (8 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: hch, Peter Zijlstra, johnstul, David Howells, yong.zhang0,
	Thomas Gleixner

__set_LEDS() does not need to be protected by the lock.
its used unprotected in other places.

Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/frv/kernel/time.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 0ddbbae..dde2a8e 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -50,7 +50,7 @@ static struct irqaction timer_irq  = {
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 static irqreturn_t timer_interrupt(int irq, void *dummy)
 {
@@ -61,10 +61,11 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
 	 * CPU. We need to avoid to SMP race with it. NOTE: we don't need
 	 * the irq version of write_lock because as just said we have irq
 	 * locally disabled. -arca
+	 *
+	 * xtime_update() does poper locking.
 	 */
-	write_seqlock(&xtime_lock);
 
-	do_timer(1);
+	xtime_update(1);
 
 #ifdef CONFIG_HEARTBEAT
 	static unsigned short n;
@@ -72,8 +73,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
 	__set_LEDS(n);
 #endif /* CONFIG_HEARTBEAT */
 
-	write_sequnlock(&xtime_lock);
-
 	update_process_times(user_mode(get_irq_regs()));
 
 	return IRQ_HANDLED;


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

* [PATCH v2 12/20] h8300: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (10 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 11/20] frv: switch " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:08   ` [tip:timers/core] h8300: Switch " tip-bot for Torben Hohn
  2011-01-27 14:59 ` [PATCH v2 13/20] ia64: switch " Torben Hohn
                   ` (7 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Yoshinori Sato, Peter Zijlstra, johnstul, hch, yong.zhang0,
	Thomas Gleixner

xtime_update() takes the xtime_lock itself.


Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/h8300/kernel/time.c         |    4 +---
 arch/h8300/kernel/timer/timer8.c |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 165005a..32263a1 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -35,9 +35,7 @@ void h8300_timer_tick(void)
 {
 	if (current->pid)
 		profile_tick(CPU_PROFILING);
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
 }
 
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
index 3946c0f..7a1533f 100644
--- a/arch/h8300/kernel/timer/timer8.c
+++ b/arch/h8300/kernel/timer/timer8.c
@@ -61,7 +61,7 @@
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 static irqreturn_t timer_interrupt(int irq, void *dev_id)


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

* [PATCH v2 13/20] ia64: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (11 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 12/20] h8300: switch " Torben Hohn
@ 2011-01-27 14:59 ` Torben Hohn
  2011-01-31 14:09   ` [tip:timers/core] ia64: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 14/20] m32r: switch from " Torben Hohn
                   ` (6 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 14:59 UTC (permalink / raw)
  To: LKML
  Cc: Fenghua Yu, Tony Luck, Peter Zijlstra, johnstul, hch,
	yong.zhang0, Thomas Gleixner

local_cpu_data->itm_next = new_itm;  does not need to be protected
by this lock. and xtime_update() takes the lock itself.


Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/ia64/kernel/time.c |   19 +++++--------------
 arch/ia64/xen/time.c    |   13 +++++--------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 9702fa9..156ad80 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -190,19 +190,10 @@ timer_interrupt (int irq, void *dev_id)
 
 		new_itm += local_cpu_data->itm_delta;
 
-		if (smp_processor_id() == time_keeper_id) {
-			/*
-			 * Here we are in the timer irq handler. We have irqs locally
-			 * disabled, but we don't know if the timer_bh is running on
-			 * another CPU. We need to avoid to SMP race by acquiring the
-			 * xtime_lock.
-			 */
-			write_seqlock(&xtime_lock);
-			do_timer(1);
-			local_cpu_data->itm_next = new_itm;
-			write_sequnlock(&xtime_lock);
-		} else
-			local_cpu_data->itm_next = new_itm;
+		if (smp_processor_id() == time_keeper_id)
+			xtime_update(1);
+
+		local_cpu_data->itm_next = new_itm;
 
 		if (time_after(new_itm, ia64_get_itc()))
 			break;
@@ -222,7 +213,7 @@ skip_process_time_accounting:
 		 * comfort, we increase the safety margin by
 		 * intentionally dropping the next tick(s).  We do NOT
 		 * update itm.next because that would force us to call
-		 * do_timer() which in turn would let our clock run
+		 * xtime_update() which in turn would let our clock run
 		 * too fast (with the potentially devastating effect
 		 * of losing monotony of time).
 		 */
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index c1c5445..1f8244a 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -139,14 +139,11 @@ consider_steal_time(unsigned long new_itm)
 		run_posix_cpu_timers(p);
 		delta_itm += local_cpu_data->itm_delta * (stolen + blocked);
 
-		if (cpu == time_keeper_id) {
-			write_seqlock(&xtime_lock);
-			do_timer(stolen + blocked);
-			local_cpu_data->itm_next = delta_itm + new_itm;
-			write_sequnlock(&xtime_lock);
-		} else {
-			local_cpu_data->itm_next = delta_itm + new_itm;
-		}
+		if (cpu == time_keeper_id)
+			xtime_update(stolen + blocked);
+
+		local_cpu_data->itm_next = delta_itm + new_itm;
+
 		per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen;
 		per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked;
 	}


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

* [PATCH v2 14/20] m32r: switch from do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (12 preceding siblings ...)
  2011-01-27 14:59 ` [PATCH v2 13/20] ia64: switch " Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:09   ` [tip:timers/core] m32r: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 15/20] m68k: switch " Torben Hohn
                   ` (5 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, johnstul, Hirokazu Takata, hch, yong.zhang0,
	Thomas Gleixner

xtime_update() does proper locking.

Cc: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/m32r/kernel/time.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index bda8682..84dd040 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -107,15 +107,14 @@ u32 arch_gettimeoffset(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 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);
+	xtime_update(1);
 
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));


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

* [PATCH v2 15/20] m68k: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (13 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 14/20] m32r: switch from " Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:09   ` [tip:timers/core] m68k: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
                   ` (4 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: Sam Creasey, Peter Zijlstra, johnstul, Roman Zippel, hch,
	yong.zhang0, Geert Uytterhoeven, Greg Ungerer, Thomas Gleixner

xtime_update() properly takes the xtime_lock

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Creasey <sammy@sammy.net>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/m68k/bvme6000/config.c  |    4 ++--
 arch/m68k/kernel/time.c      |    4 ++--
 arch/m68k/mvme147/config.c   |    4 ++--
 arch/m68k/mvme16x/config.c   |    4 ++--
 arch/m68k/sun3/sun3ints.c    |    2 +-
 arch/m68knommu/kernel/time.c |    8 ++------
 6 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 9fe6fef..1edd950 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -45,8 +45,8 @@ extern int bvme6000_set_clock_mmss (unsigned long);
 extern void bvme6000_reset (void);
 void bvme6000_set_vectors (void);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via bvme6000_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/timer/timekeeping.c, called via bvme6000_process_int() */
 
 static irq_handler_t tick_handler;
 
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 06438da..18b34ee 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -37,11 +37,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 static irqreturn_t timer_interrupt(int irq, void *dummy)
 {
-	do_timer(1);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
 	profile_tick(CPU_PROFILING);
 
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 100baaa..6cb9c3a 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -46,8 +46,8 @@ extern void mvme147_reset (void);
 
 static int bcd2int (unsigned char b);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via mvme147_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/time/timekeeping.c, called via mvme147_process_int() */
 
 irq_handler_t tick_handler;
 
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 11edf61..0b28e26 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -51,8 +51,8 @@ extern void mvme16x_reset (void);
 
 int bcd2int (unsigned char b);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via mvme16x_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/time/timekeeping.c, called via mvme16x_process_int() */
 
 static irq_handler_t tick_handler;
 
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index 2d9e21b..6464ad3 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -66,7 +66,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
 #ifdef CONFIG_SUN3
 	intersil_clear();
 #endif
-        do_timer(1);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
         if (!(kstat_cpu(0).irqs[irq] % 20))
                 sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index d6ac2a4..6623909 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -36,7 +36,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
 #ifndef CONFIG_GENERIC_CLOCKEVENTS
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 {
@@ -44,11 +44,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 	if (current->pid)
 		profile_tick(CPU_PROFILING);
 
-	write_seqlock(&xtime_lock);
-
-	do_timer(1);
-
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 	update_process_times(user_mode(get_irq_regs()));
 


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

* [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (14 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 15/20] m68k: switch " Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 13:47   ` Thomas Gleixner
                     ` (2 more replies)
  2011-01-27 15:00 ` [PATCH v2 17/20] parisc: switch do_timer() to xtime_update() Torben Hohn
                   ` (3 subsequent siblings)
  19 siblings, 3 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: hch, Peter Zijlstra, johnstul, David Howells, yong.zhang0,
	Thomas Gleixner, Koichi Yasutake

xtimer_update() properly takes the xtime_lock.
mn10300_last_tsc is only accessed from this function.

Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/mn10300/kernel/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index 75da468..5b95500 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -104,8 +104,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 	unsigned tsc, elapse;
 	irqreturn_t ret;
 
-	write_seqlock(&xtime_lock);
-
 	while (tsc = get_cycles(),
 	       elapse = tsc - mn10300_last_tsc, /* time elapsed since last
 						 * tick */
@@ -114,11 +112,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 		mn10300_last_tsc += MN10300_TSC_PER_HZ;
 
 		/* advance the kernel's time tracking system */
-		do_timer(1);
+		xtime_update(1);
 	}
 
-	write_sequnlock(&xtime_lock);
-
 	ret = local_timer_interrupt();
 #ifdef CONFIG_SMP
 	send_IPI_allbutself(LOCAL_TIMER_IPI);


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

* [PATCH v2 17/20] parisc: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (15 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:10   ` [tip:timers/core] parisc: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 18/20] sparc: switch " Torben Hohn
                   ` (2 subsequent siblings)
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: hch, Peter Zijlstra, johnstul, Helge Deller,
	James E.J. Bottomley, Kyle McMartin, yong.zhang0,
	Thomas Gleixner

xtime_update() takes the xtime_lock itself.

Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/parisc/kernel/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 05511cc..72ec318 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -163,9 +163,7 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
 	}
 
 	if (cpu == 0) {
-		write_seqlock(&xtime_lock);
-		do_timer(ticks_elapsed);
-		write_sequnlock(&xtime_lock);
+		xtime_update(ticks_elapsed);
 	}
 
 	return IRQ_HANDLED;


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

* [PATCH v2 18/20] sparc: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (16 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 17/20] parisc: switch do_timer() to xtime_update() Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:10   ` [tip:timers/core] sparc: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 19/20] xtensa: switch " Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code Torben Hohn
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, johnstul, hch, yong.zhang0, Thomas Gleixner,
	David S. Miller

xtime_update() takes the xtime_lock itself.

pcic_clear_clock_irq() and clear_clock_irq do not need
to be protected by a lock.
it might make sense to move them after xtime_update() though.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Acked-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc/kernel/pcic.c    |    4 +---
 arch/sparc/kernel/time_32.c |    9 ++-------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index aeaa09a..2cdc131 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -700,10 +700,8 @@ static void pcic_clear_clock_irq(void)
 
 static irqreturn_t pcic_timer_handler (int irq, void *h)
 {
-	write_seqlock(&xtime_lock);	/* Dummy, to show that we remember */
 	pcic_clear_clock_irq();
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));
 #endif
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 9c743b1..4211bfc 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -85,7 +85,7 @@ int update_persistent_clock(struct timespec now)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 #define TICK_SIZE (tick_nsec / 1000)
@@ -96,14 +96,9 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id)
 	profile_tick(CPU_PROFILING);
 #endif
 
-	/* Protect counter clear so that do_gettimeoffset works */
-	write_seqlock(&xtime_lock);
-
 	clear_clock_irq();
 
-	do_timer(1);
-
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));


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

* [PATCH v2 19/20] xtensa: switch do_timer() to xtime_update()
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (17 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 18/20] sparc: switch " Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:11   ` [tip:timers/core] xtensa: Switch " tip-bot for Torben Hohn
  2011-01-27 15:00 ` [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code Torben Hohn
  19 siblings, 1 reply; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML
  Cc: Chris Zankel, Peter Zijlstra, johnstul, hch, yong.zhang0,
	Thomas Gleixner

xtime_update() takes the xtime_lock itself.

set_linux_timer() does not need to be protected by a lock.

Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 arch/xtensa/kernel/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 19df764..f3e5eb4 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -96,16 +96,12 @@ again:
 		update_process_times(user_mode(get_irq_regs()));
 #endif
 
-		write_seqlock(&xtime_lock);
-
-		do_timer(1); /* Linux handler in kernel/timer.c */
+		xtime_update(1); /* Linux handler in kernel/time/timekeeping */
 
 		/* Note that writing CCOMPARE clears the interrupt. */
 
 		next += CCOUNT_PER_JIFFY;
 		set_linux_timer(next);
-
-		write_sequnlock(&xtime_lock);
 	}
 
 	/* Allow platform to do something useful (Wdog). */


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

* [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code
  2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
                   ` (18 preceding siblings ...)
  2011-01-27 15:00 ` [PATCH v2 19/20] xtensa: switch " Torben Hohn
@ 2011-01-27 15:00 ` Torben Hohn
  2011-01-31 14:11   ` [tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/ tip-bot for Torben Hohn
  2011-01-31 18:21   ` tip-bot for Torben Hohn
  19 siblings, 2 replies; 51+ messages in thread
From: Torben Hohn @ 2011-01-27 15:00 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, johnstul, Thomas Gleixner, yong.zhang0, hch

this commit finishes the xtime_lock cleanup.
arch code is now using xtime_update().

and do_timer() and xtime_lock are declared in kernel/time/timer-internal.h
i did not use tick-internal.h because it would have meant that i needed
to include some more stuff in kernel/time/ntp.c

Signed-off-by: Torben Hohn <torbenh@gmx.de>
---
 include/linux/sched.h        |    1 -
 include/linux/time.h         |    2 --
 kernel/time/ntp.c            |    2 ++
 kernel/time/tick-common.c    |    1 +
 kernel/time/tick-sched.c     |    1 +
 kernel/time/timer-internal.h |    7 +++++++
 6 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 kernel/time/timer-internal.h

diff --git a/include/linux/sched.h b/include/linux/sched.h
index c0b0bb7..04726ef 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2044,7 +2044,6 @@ extern void release_uids(struct user_namespace *ns);
 
 #include <asm/current.h>
 
-extern void do_timer(unsigned long ticks);
 extern void xtime_update(unsigned long ticks);
 
 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
diff --git a/include/linux/time.h b/include/linux/time.h
index b9b2f5b..bb35e79 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
 #define timespec_valid(ts) \
 	(((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
 
-extern seqlock_t xtime_lock;
-
 extern void read_persistent_clock(struct timespec *ts);
 extern void read_boot_clock(struct timespec *ts);
 extern int update_persistent_clock(struct timespec now);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5c00242..f3b47ad 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -16,6 +16,8 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 
+#include "timer-internal.h"
+
 /*
  * NTP timekeeping variables:
  */
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 051bc80..7ff565b 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -23,6 +23,7 @@
 #include <asm/irq_regs.h>
 
 #include "tick-internal.h"
+#include "timer-internal.h"
 
 /*
  * Tick devices
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index c55ea24..fb8c52c 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -25,6 +25,7 @@
 #include <asm/irq_regs.h>
 
 #include "tick-internal.h"
+#include "timer-internal.h"
 
 /*
  * Per cpu nohz control structure
diff --git a/kernel/time/timer-internal.h b/kernel/time/timer-internal.h
new file mode 100644
index 0000000..f84a499
--- /dev/null
+++ b/kernel/time/timer-internal.h
@@ -0,0 +1,7 @@
+/*
+ * timer internal variable and functions
+ */
+
+extern void do_timer(unsigned long ticks);
+extern seqlock_t xtime_lock;
+


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

* Re: [PATCH v2 08/20] blackfin: switch from do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 08/20] blackfin: switch from " Torben Hohn
@ 2011-01-27 19:42   ` Mike Frysinger
  2011-01-31 14:07   ` [tip:timers/core] blackfin: Switch " tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: Mike Frysinger @ 2011-01-27 19:42 UTC (permalink / raw)
  To: Torben Hohn
  Cc: LKML, Peter Zijlstra, johnstul, hch, yong.zhang0, Thomas Gleixner

On Thu, Jan 27, 2011 at 09:59, Torben Hohn wrote:
> xtime_update() takes the xtime_lock itself.

looks straightforward enough ...
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

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

* Re: [PATCH v2 05/20] alpha: change do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 05/20] alpha: change do_timer() to xtime_update() Torben Hohn
@ 2011-01-31 10:23   ` Thomas Gleixner
  2011-01-31 10:32     ` Thomas Gleixner
  2011-01-31 14:05   ` [tip:timers/core] alpha: Change " tip-bot for Torben Hohn
  1 sibling, 1 reply; 51+ messages in thread
From: Thomas Gleixner @ 2011-01-31 10:23 UTC (permalink / raw)
  To: Torben Hohn
  Cc: LKML, Peter Zijlstra, johnstul, hch, yong.zhang0, Matt Turner,
	Richard Henderson

On Thu, 27 Jan 2011, Torben Hohn wrote:

> xtime_update() takes the xtime_lock itself.
> state does not to be protected with this lock.
> its only touched here and during init.

xtime_lock very well serializes the access to state on
SMP. timer_interrupt() is called on each cpu. So that wont work.

Thanks,

	tglx

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

* Re: [PATCH v2 05/20] alpha: change do_timer() to xtime_update()
  2011-01-31 10:23   ` Thomas Gleixner
@ 2011-01-31 10:32     ` Thomas Gleixner
  0 siblings, 0 replies; 51+ messages in thread
From: Thomas Gleixner @ 2011-01-31 10:32 UTC (permalink / raw)
  To: Torben Hohn
  Cc: LKML, Peter Zijlstra, johnstul, hch, yong.zhang0, Matt Turner,
	Richard Henderson

On Mon, 31 Jan 2011, Thomas Gleixner wrote:

> On Thu, 27 Jan 2011, Torben Hohn wrote:
> 
> > xtime_update() takes the xtime_lock itself.
> > state does not to be protected with this lock.
> > its only touched here and during init.
> 
> xtime_lock very well serializes the access to state on
> SMP. timer_interrupt() is called on each cpu. So that wont work.

Hmm. No. It's bound to boot_cpu_id.

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

* Re: [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c
  2011-01-27 14:59 ` [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c Torben Hohn
@ 2011-01-31 11:36   ` Thomas Gleixner
  2011-01-31 14:04   ` [tip:timers/core] time: Move " tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: Thomas Gleixner @ 2011-01-31 11:36 UTC (permalink / raw)
  To: Torben Hohn; +Cc: LKML, Peter Zijlstra, johnstul, yong.zhang0, hch

[-- Attachment #1: Type: TEXT/PLAIN, Size: 555 bytes --]

On Thu, 27 Jan 2011, Torben Hohn wrote:

> in order to make the xtime_lock local to kernel/time
> all users of this lock need to be moved there.

Did you even compile that ?

kernel/time/jiffies.c:83: warning: data definition has no type or storage class
kernel/time/jiffies.c:83: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
kernel/time/jiffies.c:83: warning: parameter names (without types) in function declaration

That misses an #include <linux/module.h>

I fixed that up. Please be more careful next time.

Thanks,

	tglx

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

* Re: [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c
  2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
@ 2011-01-31 11:38   ` Thomas Gleixner
  2011-01-31 14:04   ` [tip:timers/core] time: Provide get_xtime_and_monotonic_offset() tip-bot for Torben Hohn
  2011-02-01  9:21   ` [tip:timers/core] time: Fix legacy arch fallout tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 51+ messages in thread
From: Thomas Gleixner @ 2011-01-31 11:38 UTC (permalink / raw)
  To: Torben Hohn; +Cc: LKML, Peter Zijlstra, johnstul, yong.zhang0, hch

On Thu, 27 Jan 2011, Torben Hohn wrote:

> 2 places in hrtimer need to take the xtime_lock, but we want it
> to be private to kernel/time...
> 
> we just provide a function, which gets the values with proper
> read locking the xtime_lock.

Proper sentences start with an uppercase letter.
 
> @@ -617,10 +612,7 @@ static void retrigger_next_event(void *arg)
>  	if (!hrtimer_hres_active())
>  		return;
>  
> -	do {
> -		seq = read_seqbegin(&xtime_lock);
> -		wtm = __get_wall_to_monotonic();
> -	} while (read_seqretry(&xtime_lock, seq));
> +	get_xtime_and_monotonic_offset(NULL, &wtm);
>  	set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);

Leaves an unused variable seq. Please do NOT ignore compiler warnings.
 
>  	base = &__get_cpu_var(hrtimer_bases);
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index e4fd957..6085fa5 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -957,3 +957,24 @@ void do_timer(unsigned long ticks)
>  	jiffies_64 += ticks;
>  	update_wall_time();
>  }
> +
> +/**
> + * get_xtime_and_monotonic_offset() - get xtime and wall_to_monotonic
> + * @xts: pointer to struct timespec, filled with the current_time
> + * @tom: pointer to struct timespec, filled with the wall_to_monotonic offset
> + *
> + * this function does proper locking.
> + * and it allows passing NULL, when one is not interested in the value.
> + */
> +void get_xtime_and_monotonic_offset(struct timespec *xts, struct timespec *tom)
> +{
> +	unsigned long seq;
> +
> +	do {
> +		seq = read_seqbegin(&xtime_lock);
> +		if (xts)
> +			*xts = xtime;
> +		if (tom)
> +			*tom = wall_to_monotonic;

That's silly. We can hand in realtime_offset in
retrigger_next_event(). No need for these conditionals.

> +	} while (read_seqretry(&xtime_lock, seq));
> +}

Thanks,

	tglx
 

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

* Re: [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update()
  2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
@ 2011-01-31 13:47   ` Thomas Gleixner
  2011-02-09 15:18   ` [tip:timers/core] mn10300: Switch " tip-bot for Torben Hohn
  2011-03-18 16:35   ` [PATCH v2 16/20] mn10300: switch " David Howells
  2 siblings, 0 replies; 51+ messages in thread
From: Thomas Gleixner @ 2011-01-31 13:47 UTC (permalink / raw)
  To: Torben Hohn
  Cc: LKML, hch, Peter Zijlstra, johnstul, David Howells, yong.zhang0,
	Koichi Yasutake

On Thu, 27 Jan 2011, Torben Hohn wrote:

> xtimer_update() properly takes the xtime_lock.
> mn10300_last_tsc is only accessed from this function.

This patch can be dropped as that code is dead. I sent a cleanup patch
to the mn10300 folks.

Thanks,

	tglx

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

* [tip:timers/core] time: Move do_timer() to kernel/time/timekeeping.c
  2011-01-27 14:58 ` [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c Torben Hohn
@ 2011-01-31 14:03   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:03 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  871cf1e5f2a17702f58539a3af8b18fc8666ad4c
Gitweb:     http://git.kernel.org/tip/871cf1e5f2a17702f58539a3af8b18fc8666ad4c
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:58:55 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:41 +0100

time: Move do_timer() to kernel/time/timekeeping.c

do_timer() is primary timekeeping related. calc_global_load() is
called from do_timer() as well, but that's more for historical
reasons.

[ tglx: Fixed up the calc_global_load() reject andmassaged changelog ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127145855.23248.56933.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/time.h      |    1 -
 kernel/time/timekeeping.c |   14 +++++++++++++-
 kernel/timer.c            |   13 -------------
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 1e6d3b5..86a9c48 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -166,7 +166,6 @@ extern void monotonic_to_bootbased(struct timespec *ts);
 extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
 extern int timekeeping_valid_for_hres(void);
 extern u64 timekeeping_max_deferment(void);
-extern void update_wall_time(void);
 extern void timekeeping_leap_insert(int leapsecond);
 
 struct tms;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d27c756..c1a178c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -779,7 +779,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
  *
  * Called from the timer interrupt, must hold a write on xtime_lock.
  */
-void update_wall_time(void)
+static void update_wall_time(void)
 {
 	struct clocksource *clock;
 	cycle_t offset;
@@ -946,3 +946,15 @@ struct timespec get_monotonic_coarse(void)
 				now.tv_nsec + mono.tv_nsec);
 	return now;
 }
+
+/*
+ * The 64-bit jiffies value is not atomic - you MUST NOT read it
+ * without sampling the sequence number in xtime_lock.
+ * jiffies is defined in the linker script...
+ */
+void do_timer(unsigned long ticks)
+{
+	jiffies_64 += ticks;
+	update_wall_time();
+	calc_global_load(ticks);
+}
diff --git a/kernel/timer.c b/kernel/timer.c
index 43ca993..87f656c 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1293,19 +1293,6 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-/*
- * The 64-bit jiffies value is not atomic - you MUST NOT read it
- * without sampling the sequence number in xtime_lock.
- * jiffies is defined in the linker script...
- */
-
-void do_timer(unsigned long ticks)
-{
-	jiffies_64 += ticks;
-	update_wall_time();
-	calc_global_load(ticks);
-}
-
 #ifdef __ARCH_WANT_SYS_ALARM
 
 /*

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

* [tip:timers/core] time: Move get_jiffies_64 to kernel/time/jiffies.c
  2011-01-27 14:59 ` [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c Torben Hohn
  2011-01-31 11:36   ` Thomas Gleixner
@ 2011-01-31 14:04   ` tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  fbad1ea94159a71bc0f68b00e57ae803606af9fb
Gitweb:     http://git.kernel.org/tip/fbad1ea94159a71bc0f68b00e57ae803606af9fb
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:00 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:42 +0100

time: Move get_jiffies_64 to kernel/time/jiffies.c

Move the jiffies access functions to the jiffies clocksource code.

[ tglx: Add missing include ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127145900.23248.73352.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time.c         |   17 -----------------
 kernel/time/jiffies.c |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index 3217435..a31b512 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -674,23 +674,6 @@ unsigned long nsecs_to_jiffies(u64 n)
 #endif
 }
 
-#if (BITS_PER_LONG < 64)
-u64 get_jiffies_64(void)
-{
-	unsigned long seq;
-	u64 ret;
-
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		ret = jiffies_64;
-	} while (read_seqretry(&xtime_lock, seq));
-	return ret;
-}
-EXPORT_SYMBOL(get_jiffies_64);
-#endif
-
-EXPORT_SYMBOL(jiffies);
-
 /*
  * Add two timespec values and do a safety check for overflow.
  * It's assumed that both values are valid (>= 0)
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 5404a84..2fbc207 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -22,6 +22,7 @@
 ************************************************************************/
 #include <linux/clocksource.h>
 #include <linux/jiffies.h>
+#include <linux/module.h>
 #include <linux/init.h>
 
 /* The Jiffies based clocksource is the lowest common
@@ -64,6 +65,23 @@ struct clocksource clocksource_jiffies = {
 	.shift		= JIFFIES_SHIFT,
 };
 
+#if (BITS_PER_LONG < 64)
+u64 get_jiffies_64(void)
+{
+	unsigned long seq;
+	u64 ret;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		ret = jiffies_64;
+	} while (read_seqretry(&xtime_lock, seq));
+	return ret;
+}
+EXPORT_SYMBOL(get_jiffies_64);
+#endif
+
+EXPORT_SYMBOL(jiffies);
+
 static int __init init_jiffies_clocksource(void)
 {
 	return clocksource_register(&clocksource_jiffies);

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

* [tip:timers/core] time: Provide get_xtime_and_monotonic_offset()
  2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
  2011-01-31 11:38   ` Thomas Gleixner
@ 2011-01-31 14:04   ` tip-bot for Torben Hohn
  2011-02-01  9:21   ` [tip:timers/core] time: Fix legacy arch fallout tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  48cf76f7104f655bbd48a75c7759dce82c3e1ab6
Gitweb:     http://git.kernel.org/tip/48cf76f7104f655bbd48a75c7759dce82c3e1ab6
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:05 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:42 +0100

time: Provide get_xtime_and_monotonic_offset()

The hrtimer code accesses timekeeping variables under
xtime_lock. Provide a sensible accessor function and use it.

[ tglx: Removed the conditionals, unused variable, fixed codingstyle
  	and massaged changelog ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127145905.23248.30458.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/time.h      |    1 +
 kernel/hrtimer.c          |   13 ++-----------
 kernel/time/timekeeping.c |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/include/linux/time.h b/include/linux/time.h
index 86a9c48..4007a12 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -127,6 +127,7 @@ struct timespec current_kernel_time(void);
 struct timespec __current_kernel_time(void); /* does not take xtime_lock */
 struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
 struct timespec get_monotonic_coarse(void);
+void get_xtime_and_monotonic_offset(struct timespec *xtim, struct timespec *wtom);
 
 #define CURRENT_TIME		(current_kernel_time())
 #define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 0c8d7c0..57c4d33 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -85,13 +85,8 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
 {
 	ktime_t xtim, tomono;
 	struct timespec xts, tom;
-	unsigned long seq;
 
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		xts = __current_kernel_time();
-		tom = __get_wall_to_monotonic();
-	} while (read_seqretry(&xtime_lock, seq));
+	get_xtime_and_monotonic_offset(&xts, &tom);
 
 	xtim = timespec_to_ktime(xts);
 	tomono = timespec_to_ktime(tom);
@@ -612,15 +607,11 @@ static void retrigger_next_event(void *arg)
 {
 	struct hrtimer_cpu_base *base;
 	struct timespec realtime_offset, wtm;
-	unsigned long seq;
 
 	if (!hrtimer_hres_active())
 		return;
 
-	do {
-		seq = read_seqbegin(&xtime_lock);
-		wtm = __get_wall_to_monotonic();
-	} while (read_seqretry(&xtime_lock, seq));
+	get_xtime_and_monotonic_offset(&realtime_offset, &wtm);
 	set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);
 
 	base = &__get_cpu_var(hrtimer_bases);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index c1a178c..c50aaf6 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -958,3 +958,19 @@ void do_timer(unsigned long ticks)
 	update_wall_time();
 	calc_global_load(ticks);
 }
+
+/**
+ * get_xtime_and_monotonic_offset() - get xtime and wall_to_monotonic
+ * @xtim:	pointer to timespec to be set with xtime
+ * @wtom:	pointer to timespec to be set with wall_to_monotonic
+ */
+void get_xtime_and_monotonic_offset(struct timespec *xtim, struct timespec *wtom)
+{
+	unsigned long seq;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		*xtim = xtime;
+		*wtom = wall_to_monotonic;
+	} while (read_seqretry(&xtime_lock, seq));
+}

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

* [tip:timers/core] time: Provide xtime_update()
  2011-01-27 14:59 ` [PATCH v2 04/20] provide xtime_update() which does not require the caller to hold xtime_lock Torben Hohn
@ 2011-01-31 14:05   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:05 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  f0af911a9dec9de702645182c8d269449e24d24b
Gitweb:     http://git.kernel.org/tip/f0af911a9dec9de702645182c8d269449e24d24b
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:10 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:43 +0100

time: Provide xtime_update()

xtime_update() takes xtime_lock write locked and calls
do_timer(). Provided to replace the do_timer() calls in the
architecture code.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127145910.23248.21379.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/sched.h     |    1 +
 kernel/time/timekeeping.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d747f94..9d9a078 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2050,6 +2050,7 @@ extern void release_uids(struct user_namespace *ns);
 #include <asm/current.h>
 
 extern void do_timer(unsigned long ticks);
+extern void xtime_update(unsigned long ticks);
 
 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
 extern int wake_up_process(struct task_struct *tsk);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 8da35d1..02c13a3 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -969,3 +969,16 @@ void get_xtime_and_monotonic_offset(struct timespec *xtim, struct timespec *wtom
 		*wtom = wall_to_monotonic;
 	} while (read_seqretry(&xtime_lock, seq));
 }
+
+/**
+ * xtime_update() - advances the timekeeping infrastructure
+ * @ticks:	number of ticks, that have elapsed since the last call.
+ *
+ * Must be called with interrupts disabled.
+ */
+void xtime_update(unsigned long ticks)
+{
+	write_seqlock(&xtime_lock);
+	do_timer(ticks);
+	write_sequnlock(&xtime_lock);
+}

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

* [tip:timers/core] alpha: Change do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 05/20] alpha: change do_timer() to xtime_update() Torben Hohn
  2011-01-31 10:23   ` Thomas Gleixner
@ 2011-01-31 14:05   ` tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, torbenh, mattst88, ink, tglx, rth

Commit-ID:  1340f3e0b29b745a33f431455c3a37f48197bc81
Gitweb:     http://git.kernel.org/tip/1340f3e0b29b745a33f431455c3a37f48197bc81
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:15 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:43 +0100

alpha: Change do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

timer_interrupt() is only called on the boot cpu. See do_entInt(). So
"state" in timer_interrupt does not require protection by xtime_lock.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145915.23248.20919.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/alpha/kernel/time.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index c1f3e7c..a58e84f 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -159,7 +159,7 @@ void read_persistent_clock(struct timespec *ts)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 irqreturn_t timer_interrupt(int irq, void *dev)
 {
@@ -172,8 +172,6 @@ irqreturn_t timer_interrupt(int irq, void *dev)
 	profile_tick(CPU_PROFILING);
 #endif
 
-	write_seqlock(&xtime_lock);
-
 	/*
 	 * Calculate how many ticks have passed since the last update,
 	 * including any previous partial leftover.  Save any resulting
@@ -187,9 +185,7 @@ irqreturn_t timer_interrupt(int irq, void *dev)
 	nticks = delta >> FIX_SHIFT;
 
 	if (nticks)
-		do_timer(nticks);
-
-	write_sequnlock(&xtime_lock);
+		xtime_update(nticks);
 
 	if (test_irq_work_pending()) {
 		clear_irq_work_pending();

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

* [tip:timers/core] arm: Switch from do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 06/20] arm: switch from " Torben Hohn
@ 2011-01-31 14:06   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:06 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, linux, peterz, tglx

Commit-ID:  6906e33cc555c390cd091f6f363b783322dfedf6
Gitweb:     http://git.kernel.org/tip/6906e33cc555c390cd091f6f363b783322dfedf6
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:21 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:43 +0100

arm: Switch from do_timer() to xtime_update()

xtime_update takes the xtime_lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145920.23248.75541.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/arm/kernel/time.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 3d76bf2..1ff46ca 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -107,9 +107,7 @@ void timer_tick(void)
 {
 	profile_tick(CPU_PROFILING);
 	do_leds();
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));
 #endif

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

* [tip:timers/core] arm/mach-clps711x: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 07/20] arm/mach-clps711x: switch " Torben Hohn
@ 2011-01-31 14:06   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:06 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, linux, peterz, tglx

Commit-ID:  ec2dff2febf19ff2109c2eb3e56d5a969fe399e2
Gitweb:     http://git.kernel.org/tip/ec2dff2febf19ff2109c2eb3e56d5a969fe399e2
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:26 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:44 +0100

arm/mach-clps711x: Switch do_timer() to xtime_update()

do_timer() requires holding the xtime_lock, which this
code did not do. Use the safe version xtime_update()

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145926.23248.56369.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/arm/mach-clps711x/include/mach/time.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-clps711x/include/mach/time.h b/arch/arm/mach-clps711x/include/mach/time.h
index 8fe283c..61fef91 100644
--- a/arch/arm/mach-clps711x/include/mach/time.h
+++ b/arch/arm/mach-clps711x/include/mach/time.h
@@ -30,7 +30,7 @@ p720t_timer_interrupt(int irq, void *dev_id)
 {
 	struct pt_regs *regs = get_irq_regs();
 	do_leds();
-	do_timer(1);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(regs));
 #endif

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

* [tip:timers/core] blackfin: Switch from do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 08/20] blackfin: switch from " Torben Hohn
  2011-01-27 19:42   ` Mike Frysinger
@ 2011-01-31 14:07   ` tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:07 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, vapier, tglx

Commit-ID:  4196b892d55caaf2c98da05e80472ca482ca19fe
Gitweb:     http://git.kernel.org/tip/4196b892d55caaf2c98da05e80472ca482ca19fe
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:31 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:44 +0100

blackfin: Switch from do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145931.23248.33917.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/blackfin/kernel/time.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index c911361..8d73724 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -114,16 +114,14 @@ u32 arch_gettimeoffset(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 #ifdef CONFIG_CORE_TIMER_IRQ_L1
 __attribute__((l1_text))
 #endif
 irqreturn_t timer_interrupt(int irq, void *dummy)
 {
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 #ifdef CONFIG_IPIPE
 	update_root_process_times(get_irq_regs());

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

* [tip:timers/core] cris: arch-v10: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 09/20] cris/arch-v10: switch " Torben Hohn
@ 2011-01-31 14:07   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, jesper.nilsson, peterz, torbenh, starvik, tglx

Commit-ID:  17588b99183ece563013622afeefd37eb8e68fd3
Gitweb:     http://git.kernel.org/tip/17588b99183ece563013622afeefd37eb8e68fd3
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:36 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:44 +0100

cris: arch-v10: Switch do_timer() to xtime_update()

This code failed to take the xtime_lock, which must be held when
calling do_timer(). Use the safe version xtime_update()

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: hch@infradead.org
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: Mikael Starvik <starvik@axis.com>
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145936.23248.16192.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/cris/arch-v10/kernel/time.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 00eb36f..20c85b5 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -140,7 +140,7 @@ stop_watchdog(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 //static unsigned short myjiff; /* used by our debug routine print_timestamp */
@@ -176,7 +176,7 @@ timer_interrupt(int irq, void *dev_id)
 
 	/* call the real timer interrupt handler */
 
-	do_timer(1);
+	xtime_update(1);
 	
         cris_do_profile(regs); /* Save profiling information */
         return IRQ_HANDLED;

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

* [tip:timers/core] cris: arch-v32: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 10/20] cris/arch-v32: switch " Torben Hohn
@ 2011-01-31 14:07   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, jesper.nilsson, peterz, torbenh, starvik, tglx

Commit-ID:  36cb07bb8118cb14211ef25c58026f005877c47d
Gitweb:     http://git.kernel.org/tip/36cb07bb8118cb14211ef25c58026f005877c47d
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:41 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:44 +0100

cris: arch-v32: Switch do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: hch@infradead.org
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: Mikael Starvik <starvik@axis.com>
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145941.23248.92547.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/cris/arch-v32/kernel/time.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index a545211..bb978ed 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -183,7 +183,7 @@ void handle_watchdog_bite(struct pt_regs *regs)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick.
+ * as well as call the "xtime_update()" routine every clocktick.
  */
 extern void cris_do_profile(struct pt_regs *regs);
 
@@ -216,9 +216,7 @@ static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
 		return IRQ_HANDLED;
 
 	/* Call the real timer interrupt handler */
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
         return IRQ_HANDLED;
 }
 

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

* [tip:timers/core] frv: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 11/20] frv: switch " Torben Hohn
@ 2011-01-31 14:08   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, dhowells, torbenh, peterz, tglx

Commit-ID:  57464bd87f708e75b47312766e3fc8dc3aaf66ad
Gitweb:     http://git.kernel.org/tip/57464bd87f708e75b47312766e3fc8dc3aaf66ad
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:46 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:45 +0100

frv: Switch do_timer() to xtime_update()

__set_LEDS() does not need to be protected by xtime_lock.
its used unprotected in other places.

[ tglx: Removed stale comment ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: hch@infradead.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: David Howells <dhowells@redhat.com>
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145946.23248.57952.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/frv/kernel/time.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 0ddbbae..b457de4 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -50,21 +50,13 @@ static struct irqaction timer_irq  = {
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 static irqreturn_t timer_interrupt(int irq, void *dummy)
 {
 	profile_tick(CPU_PROFILING);
-	/*
-	 * Here we are in the timer irq handler. We just have irqs locally
-	 * disabled but we don't know if the timer_bh is running on the other
-	 * CPU. We need to avoid to SMP race with it. NOTE: we don't need
-	 * the irq version of write_lock because as just said we have irq
-	 * locally disabled. -arca
-	 */
-	write_seqlock(&xtime_lock);
 
-	do_timer(1);
+	xtime_update(1);
 
 #ifdef CONFIG_HEARTBEAT
 	static unsigned short n;
@@ -72,8 +64,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
 	__set_LEDS(n);
 #endif /* CONFIG_HEARTBEAT */
 
-	write_sequnlock(&xtime_lock);
-
 	update_process_times(user_mode(get_irq_regs()));
 
 	return IRQ_HANDLED;

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

* [tip:timers/core] h8300: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 12/20] h8300: switch " Torben Hohn
@ 2011-01-31 14:08   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:08 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx, ysato

Commit-ID:  daad8b581e7f5e21a2f79e49d57d4f6a73b26510
Gitweb:     http://git.kernel.org/tip/daad8b581e7f5e21a2f79e49d57d4f6a73b26510
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:51 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:45 +0100

h8300: Switch do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145951.23248.92727.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/h8300/kernel/time.c         |    4 +---
 arch/h8300/kernel/timer/timer8.c |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 165005a..32263a1 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -35,9 +35,7 @@ void h8300_timer_tick(void)
 {
 	if (current->pid)
 		profile_tick(CPU_PROFILING);
-	write_seqlock(&xtime_lock);
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
 }
 
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
index 3946c0f..7a1533f 100644
--- a/arch/h8300/kernel/timer/timer8.c
+++ b/arch/h8300/kernel/timer/timer8.c
@@ -61,7 +61,7 @@
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 static irqreturn_t timer_interrupt(int irq, void *dev_id)

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

* [tip:timers/core] ia64: Switch do_timer() to xtime_update()
  2011-01-27 14:59 ` [PATCH v2 13/20] ia64: switch " Torben Hohn
@ 2011-01-31 14:09   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, tony.luck, torbenh, fenghua.yu, tglx

Commit-ID:  1aabd67d2e97e6affdf5a7c65f442ac91ace3f85
Gitweb:     http://git.kernel.org/tip/1aabd67d2e97e6affdf5a7c65f442ac91ace3f85
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 15:59:56 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:45 +0100

ia64: Switch do_timer() to xtime_update()

local_cpu_data->itm_next = new_itm; does not need to be protected by
xtime_lock. xtime_update() takes the lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127145956.23248.49107.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/ia64/kernel/time.c |   19 +++++--------------
 arch/ia64/xen/time.c    |   13 +++++--------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 9702fa9..156ad80 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -190,19 +190,10 @@ timer_interrupt (int irq, void *dev_id)
 
 		new_itm += local_cpu_data->itm_delta;
 
-		if (smp_processor_id() == time_keeper_id) {
-			/*
-			 * Here we are in the timer irq handler. We have irqs locally
-			 * disabled, but we don't know if the timer_bh is running on
-			 * another CPU. We need to avoid to SMP race by acquiring the
-			 * xtime_lock.
-			 */
-			write_seqlock(&xtime_lock);
-			do_timer(1);
-			local_cpu_data->itm_next = new_itm;
-			write_sequnlock(&xtime_lock);
-		} else
-			local_cpu_data->itm_next = new_itm;
+		if (smp_processor_id() == time_keeper_id)
+			xtime_update(1);
+
+		local_cpu_data->itm_next = new_itm;
 
 		if (time_after(new_itm, ia64_get_itc()))
 			break;
@@ -222,7 +213,7 @@ skip_process_time_accounting:
 		 * comfort, we increase the safety margin by
 		 * intentionally dropping the next tick(s).  We do NOT
 		 * update itm.next because that would force us to call
-		 * do_timer() which in turn would let our clock run
+		 * xtime_update() which in turn would let our clock run
 		 * too fast (with the potentially devastating effect
 		 * of losing monotony of time).
 		 */
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index c1c5445..1f8244a 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -139,14 +139,11 @@ consider_steal_time(unsigned long new_itm)
 		run_posix_cpu_timers(p);
 		delta_itm += local_cpu_data->itm_delta * (stolen + blocked);
 
-		if (cpu == time_keeper_id) {
-			write_seqlock(&xtime_lock);
-			do_timer(stolen + blocked);
-			local_cpu_data->itm_next = delta_itm + new_itm;
-			write_sequnlock(&xtime_lock);
-		} else {
-			local_cpu_data->itm_next = delta_itm + new_itm;
-		}
+		if (cpu == time_keeper_id)
+			xtime_update(stolen + blocked);
+
+		local_cpu_data->itm_next = delta_itm + new_itm;
+
 		per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen;
 		per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked;
 	}

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

* [tip:timers/core] m32r: Switch from do_timer() to xtime_update()
  2011-01-27 15:00 ` [PATCH v2 14/20] m32r: switch from " Torben Hohn
@ 2011-01-31 14:09   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, takata, tglx

Commit-ID:  7bde2ab7cb51f14c6f6574f0f5a78445f2caed3e
Gitweb:     http://git.kernel.org/tip/7bde2ab7cb51f14c6f6574f0f5a78445f2caed3e
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:01 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:45 +0100

m32r: Switch from do_timer() to xtime_update()

xtime_update() does proper locking.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127150001.23248.68620.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/m32r/kernel/time.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index bda8682..84dd040 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -107,15 +107,14 @@ u32 arch_gettimeoffset(void)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 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);
+	xtime_update(1);
 
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));

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

* [tip:timers/core] m68k: Switch do_timer() to xtime_update()
  2011-01-27 15:00 ` [PATCH v2 15/20] m68k: switch " Torben Hohn
@ 2011-01-31 14:09   ` tip-bot for Torben Hohn
  2011-02-03 23:07     ` Greg Ungerer
  0 siblings, 1 reply; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, sammy, peterz, torbenh, geert, gerg,
	tglx, zippel

Commit-ID:  e53f276beb655c711a5d1f25f800b61aa976e34f
Gitweb:     http://git.kernel.org/tip/e53f276beb655c711a5d1f25f800b61aa976e34f
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:06 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:46 +0100

m68k: Switch do_timer() to xtime_update()

xtime_update() properly takes the xtime_lock

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Sam Creasey <sammy@sammy.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Ungerer <gerg@uclinux.org>
LKML-Reference: <20110127150006.23248.71790.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/m68k/bvme6000/config.c  |    4 ++--
 arch/m68k/kernel/time.c      |    4 ++--
 arch/m68k/mvme147/config.c   |    4 ++--
 arch/m68k/mvme16x/config.c   |    4 ++--
 arch/m68k/sun3/sun3ints.c    |    2 +-
 arch/m68knommu/kernel/time.c |    8 ++------
 6 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 9fe6fef..1edd950 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -45,8 +45,8 @@ extern int bvme6000_set_clock_mmss (unsigned long);
 extern void bvme6000_reset (void);
 void bvme6000_set_vectors (void);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via bvme6000_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/timer/timekeeping.c, called via bvme6000_process_int() */
 
 static irq_handler_t tick_handler;
 
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 06438da..18b34ee 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -37,11 +37,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 static irqreturn_t timer_interrupt(int irq, void *dummy)
 {
-	do_timer(1);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
 	profile_tick(CPU_PROFILING);
 
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 100baaa..6cb9c3a 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -46,8 +46,8 @@ extern void mvme147_reset (void);
 
 static int bcd2int (unsigned char b);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via mvme147_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/time/timekeeping.c, called via mvme147_process_int() */
 
 irq_handler_t tick_handler;
 
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 11edf61..0b28e26 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -51,8 +51,8 @@ extern void mvme16x_reset (void);
 
 int bcd2int (unsigned char b);
 
-/* Save tick handler routine pointer, will point to do_timer() in
- * kernel/sched.c, called via mvme16x_process_int() */
+/* Save tick handler routine pointer, will point to xtime_update() in
+ * kernel/time/timekeeping.c, called via mvme16x_process_int() */
 
 static irq_handler_t tick_handler;
 
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index 2d9e21b..6464ad3 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -66,7 +66,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
 #ifdef CONFIG_SUN3
 	intersil_clear();
 #endif
-        do_timer(1);
+	xtime_update(1);
 	update_process_times(user_mode(get_irq_regs()));
         if (!(kstat_cpu(0).irqs[irq] % 20))
                 sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index d6ac2a4..6623909 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -36,7 +36,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
 #ifndef CONFIG_GENERIC_CLOCKEVENTS
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 {
@@ -44,11 +44,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 	if (current->pid)
 		profile_tick(CPU_PROFILING);
 
-	write_seqlock(&xtime_lock);
-
-	do_timer(1);
-
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 	update_process_times(user_mode(get_irq_regs()));
 

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

* [tip:timers/core] parisc: Switch do_timer() to xtime_update()
  2011-01-27 15:00 ` [PATCH v2 17/20] parisc: switch do_timer() to xtime_update() Torben Hohn
@ 2011-01-31 14:10   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, kyle, torbenh, jejb, tglx, deller

Commit-ID:  bb1dfc1cf6c51ca42f7c05029a6f06df9092a0fc
Gitweb:     http://git.kernel.org/tip/bb1dfc1cf6c51ca42f7c05029a6f06df9092a0fc
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:17 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:46 +0100

parisc: Switch do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: hch@infradead.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127150017.23248.22559.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/parisc/kernel/time.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 05511cc..45b7389 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -162,11 +162,8 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
 		update_process_times(user_mode(get_irq_regs()));
 	}
 
-	if (cpu == 0) {
-		write_seqlock(&xtime_lock);
-		do_timer(ticks_elapsed);
-		write_sequnlock(&xtime_lock);
-	}
+	if (cpu == 0)
+		xtime_update(ticks_elapsed);
 
 	return IRQ_HANDLED;
 }

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

* [tip:timers/core] sparc: Switch do_timer() to xtime_update()
  2011-01-27 15:00 ` [PATCH v2 18/20] sparc: switch " Torben Hohn
@ 2011-01-31 14:10   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:10 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx, davem

Commit-ID:  4ea1b72551d052a3993ef72ce06ecf5bdd125859
Gitweb:     http://git.kernel.org/tip/4ea1b72551d052a3993ef72ce06ecf5bdd125859
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:22 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:46 +0100

sparc: Switch do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

pcic_clear_clock_irq() and clear_clock_irq do not need
to be protected by xtime_lock.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127150022.23248.80369.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/sparc/kernel/pcic.c    |    4 +---
 arch/sparc/kernel/time_32.c |    9 ++-------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index aeaa09a..2cdc131 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -700,10 +700,8 @@ static void pcic_clear_clock_irq(void)
 
 static irqreturn_t pcic_timer_handler (int irq, void *h)
 {
-	write_seqlock(&xtime_lock);	/* Dummy, to show that we remember */
 	pcic_clear_clock_irq();
-	do_timer(1);
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));
 #endif
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 9c743b1..4211bfc 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -85,7 +85,7 @@ int update_persistent_clock(struct timespec now)
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
+ * as well as call the "xtime_update()" routine every clocktick
  */
 
 #define TICK_SIZE (tick_nsec / 1000)
@@ -96,14 +96,9 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id)
 	profile_tick(CPU_PROFILING);
 #endif
 
-	/* Protect counter clear so that do_gettimeoffset works */
-	write_seqlock(&xtime_lock);
-
 	clear_clock_irq();
 
-	do_timer(1);
-
-	write_sequnlock(&xtime_lock);
+	xtime_update(1);
 
 #ifndef CONFIG_SMP
 	update_process_times(user_mode(get_irq_regs()));

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

* [tip:timers/core] xtensa: Switch do_timer() to xtime_update()
  2011-01-27 15:00 ` [PATCH v2 19/20] xtensa: switch " Torben Hohn
@ 2011-01-31 14:11   ` tip-bot for Torben Hohn
  0 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, chris, tglx

Commit-ID:  d12b0e24c56c6fb2398609f26858e5278d688840
Gitweb:     http://git.kernel.org/tip/d12b0e24c56c6fb2398609f26858e5278d688840
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:27 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:46 +0100

xtensa: Switch do_timer() to xtime_update()

xtime_update() takes the xtime_lock itself.

set_linux_timer() does not need to be protected by xtime_lock.

[ tglx: This code is broken on SMP anyway. ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Chris Zankel <chris@zankel.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: hch@infradead.org
Cc: yong.zhang0@gmail.com
LKML-Reference: <20110127150027.23248.61798.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/xtensa/kernel/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 19df764..f3e5eb4 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -96,16 +96,12 @@ again:
 		update_process_times(user_mode(get_irq_regs()));
 #endif
 
-		write_seqlock(&xtime_lock);
-
-		do_timer(1); /* Linux handler in kernel/timer.c */
+		xtime_update(1); /* Linux handler in kernel/time/timekeeping */
 
 		/* Note that writing CCOMPARE clears the interrupt. */
 
 		next += CCOUNT_PER_JIFFY;
 		set_linux_timer(next);
-
-		write_sequnlock(&xtime_lock);
 	}
 
 	/* Allow platform to do something useful (Wdog). */

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

* [tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/
  2011-01-27 15:00 ` [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code Torben Hohn
@ 2011-01-31 14:11   ` tip-bot for Torben Hohn
  2011-01-31 18:21   ` tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 14:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  a2f29b47e1b5a38418e4da96d59cb0d5b9d07a07
Gitweb:     http://git.kernel.org/tip/a2f29b47e1b5a38418e4da96d59cb0d5b9d07a07
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:32 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 14:55:47 +0100

time: Make do_timer() and xtime_lock local to kernel/time/

All callers of do_timer() are converted to xtime_update(). The only
users of xtime_lock are in kernel/time/. Make both local to
kernel/time/ and remove them from the global header files.

[ tglx: Reuse tick-internal.h instead of creating another local header
  	file. Massaged changelog ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127150032.23248.75995.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/sched.h        |    1 -
 include/linux/time.h         |    2 --
 kernel/time/clockevents.c    |    1 -
 kernel/time/ntp.c            |    2 ++
 kernel/time/tick-broadcast.c |    1 -
 kernel/time/tick-common.c    |    1 -
 kernel/time/tick-internal.h  |    4 ++++
 kernel/time/tick-oneshot.c   |    1 -
 kernel/time/tick-sched.c     |    1 -
 9 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d9a078..cdef640 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2049,7 +2049,6 @@ extern void release_uids(struct user_namespace *ns);
 
 #include <asm/current.h>
 
-extern void do_timer(unsigned long ticks);
 extern void xtime_update(unsigned long ticks);
 
 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
diff --git a/include/linux/time.h b/include/linux/time.h
index ce29c86..38c5206 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
 #define timespec_valid(ts) \
 	(((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
 
-extern seqlock_t xtime_lock;
-
 extern void read_persistent_clock(struct timespec *ts);
 extern void read_boot_clock(struct timespec *ts);
 extern int update_persistent_clock(struct timespec now);
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index d7395fd..0d74b9b 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -18,7 +18,6 @@
 #include <linux/notifier.h>
 #include <linux/smp.h>
 #include <linux/sysdev.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5c00242..ed8cfdf 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -16,6 +16,8 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 
+#include "tick-internal.h"
+
 /*
  * NTP timekeeping variables:
  */
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 48b2761..92ef9a5 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 051bc80..0e98fac 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include <asm/irq_regs.h>
 
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 290eefb..14ac0d0 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -1,6 +1,7 @@
 /*
  * tick internal variable and functions used by low/high res code
  */
+#include <linux/tick.h>
 
 #define TICK_DO_TIMER_NONE	-1
 #define TICK_DO_TIMER_BOOT	-2
@@ -132,3 +133,6 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
 {
 	return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
 }
+
+extern void do_timer(unsigned long ticks);
+extern seqlock_t xtime_lock;
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 5cbc101..2d04411 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index c55ea24..d5097c4 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -19,7 +19,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 #include <linux/module.h>
 
 #include <asm/irq_regs.h>

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

* [tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/
  2011-01-27 15:00 ` [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code Torben Hohn
  2011-01-31 14:11   ` [tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/ tip-bot for Torben Hohn
@ 2011-01-31 18:21   ` tip-bot for Torben Hohn
  1 sibling, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-01-31 18:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx

Commit-ID:  025c435f6140c99e19e3a827faf49f3880afcf1e
Gitweb:     http://git.kernel.org/tip/025c435f6140c99e19e3a827faf49f3880afcf1e
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:32 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 31 Jan 2011 17:46:50 +0100

time: Make do_timer() and xtime_lock local to kernel/time/

All callers of do_timer() are converted to xtime_update(). The only
users of xtime_lock are in kernel/time/. Make both local to
kernel/time/ and remove them from the global header files.

[ tglx: Reuse tick-internal.h instead of creating another local header
  	file. Massaged changelog ]

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127150032.23248.75995.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/sched.h        |    1 -
 include/linux/time.h         |    2 --
 kernel/time/clockevents.c    |    1 -
 kernel/time/jiffies.c        |    2 ++
 kernel/time/ntp.c            |    2 ++
 kernel/time/tick-broadcast.c |    1 -
 kernel/time/tick-common.c    |    1 -
 kernel/time/tick-internal.h  |    4 ++++
 kernel/time/tick-oneshot.c   |    1 -
 kernel/time/tick-sched.c     |    1 -
 10 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d9a078..cdef640 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2049,7 +2049,6 @@ extern void release_uids(struct user_namespace *ns);
 
 #include <asm/current.h>
 
-extern void do_timer(unsigned long ticks);
 extern void xtime_update(unsigned long ticks);
 
 extern int wake_up_state(struct task_struct *tsk, unsigned int state);
diff --git a/include/linux/time.h b/include/linux/time.h
index ce29c86..38c5206 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
 #define timespec_valid(ts) \
 	(((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
 
-extern seqlock_t xtime_lock;
-
 extern void read_persistent_clock(struct timespec *ts);
 extern void read_boot_clock(struct timespec *ts);
 extern int update_persistent_clock(struct timespec now);
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index d7395fd..0d74b9b 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -18,7 +18,6 @@
 #include <linux/notifier.h>
 #include <linux/smp.h>
 #include <linux/sysdev.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 2fbc207..b2fa506 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -25,6 +25,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
+#include "tick-internal.h"
+
 /* The Jiffies based clocksource is the lowest common
  * denominator clock source which should function on
  * all systems. It has the same coarse resolution as
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5c00242..ed8cfdf 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -16,6 +16,8 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 
+#include "tick-internal.h"
+
 /*
  * NTP timekeeping variables:
  */
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 48b2761..92ef9a5 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 051bc80..0e98fac 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include <asm/irq_regs.h>
 
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 290eefb..14ac0d0 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -1,6 +1,7 @@
 /*
  * tick internal variable and functions used by low/high res code
  */
+#include <linux/tick.h>
 
 #define TICK_DO_TIMER_NONE	-1
 #define TICK_DO_TIMER_BOOT	-2
@@ -132,3 +133,6 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
 {
 	return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
 }
+
+extern void do_timer(unsigned long ticks);
+extern seqlock_t xtime_lock;
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 5cbc101..2d04411 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -18,7 +18,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 
 #include "tick-internal.h"
 
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index c55ea24..d5097c4 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -19,7 +19,6 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
-#include <linux/tick.h>
 #include <linux/module.h>
 
 #include <asm/irq_regs.h>

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

* [tip:timers/core] time: Fix legacy arch fallout
  2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
  2011-01-31 11:38   ` Thomas Gleixner
  2011-01-31 14:04   ` [tip:timers/core] time: Provide get_xtime_and_monotonic_offset() tip-bot for Torben Hohn
@ 2011-02-01  9:21   ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Thomas Gleixner @ 2011-02-01  9:21 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, torbenh, peterz, tglx, mingo

Commit-ID:  7cf37e87dd2cfa17a64f28ea7f31eed4525f79e4
Gitweb:     http://git.kernel.org/tip/7cf37e87dd2cfa17a64f28ea7f31eed4525f79e4
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 1 Feb 2011 09:34:58 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 1 Feb 2011 09:46:47 +0100

time: Fix legacy arch fallout

The xtime/dotimer cleanup broke architectures which do not implement
clockevents. Time to send out another __do_IRQ threat.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: Torben Hohn <torbenh@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: johnstul@us.ibm.com
Cc: yong.zhang0@gmail.com
Cc: hch@infradead.org
LKML-Reference: <20110127145905.23248.30458.stgit@localhost>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/time/tick-internal.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 28c5785..f77b93d 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -4,6 +4,8 @@
 #include <linux/hrtimer.h>
 #include <linux/tick.h>
 
+#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
+
 #define TICK_DO_TIMER_NONE	-1
 #define TICK_DO_TIMER_BOOT	-2
 
@@ -135,5 +137,7 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
 	return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
 }
 
+#endif
+
 extern void do_timer(unsigned long ticks);
 extern seqlock_t xtime_lock;

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

* Re: [tip:timers/core] m68k: Switch do_timer() to xtime_update()
  2011-01-31 14:09   ` [tip:timers/core] m68k: Switch " tip-bot for Torben Hohn
@ 2011-02-03 23:07     ` Greg Ungerer
  0 siblings, 0 replies; 51+ messages in thread
From: Greg Ungerer @ 2011-02-03 23:07 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, sammy, peterz, torbenh, geert, gerg,
	zippel, tglx
  Cc: linux-tip-commits

On 01/02/11 00:09, tip-bot for Torben Hohn wrote:
> Commit-ID:  e53f276beb655c711a5d1f25f800b61aa976e34f
> Gitweb:     http://git.kernel.org/tip/e53f276beb655c711a5d1f25f800b61aa976e34f
> Author:     Torben Hohn<torbenh@gmx.de>
> AuthorDate: Thu, 27 Jan 2011 16:00:06 +0100
> Committer:  Thomas Gleixner<tglx@linutronix.de>
> CommitDate: Mon, 31 Jan 2011 14:55:46 +0100
>
> m68k: Switch do_timer() to xtime_update()
>
> xtime_update() properly takes the xtime_lock
>
> Signed-off-by: Torben Hohn<torbenh@gmx.de>
> Cc: Sam Creasey<sammy@sammy.net>
> Cc: Peter Zijlstra<peterz@infradead.org>
> Cc: johnstul@us.ibm.com
> Cc: Roman Zippel<zippel@linux-m68k.org>
> Cc: hch@infradead.org
> Cc: yong.zhang0@gmail.com
> Cc: Geert Uytterhoeven<geert@linux-m68k.org>
> Cc: Greg Ungerer<gerg@uclinux.org>

I have no problem with the m68knommu part:

Ack-by: Greg Ungerer <gerg@uclinux.org>



> LKML-Reference:<20110127150006.23248.71790.stgit@localhost>
> Signed-off-by: Thomas Gleixner<tglx@linutronix.de>
> ---
>   arch/m68k/bvme6000/config.c  |    4 ++--
>   arch/m68k/kernel/time.c      |    4 ++--
>   arch/m68k/mvme147/config.c   |    4 ++--
>   arch/m68k/mvme16x/config.c   |    4 ++--
>   arch/m68k/sun3/sun3ints.c    |    2 +-
>   arch/m68knommu/kernel/time.c |    8 ++------
>   6 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
> index 9fe6fef..1edd950 100644
> --- a/arch/m68k/bvme6000/config.c
> +++ b/arch/m68k/bvme6000/config.c
> @@ -45,8 +45,8 @@ extern int bvme6000_set_clock_mmss (unsigned long);
>   extern void bvme6000_reset (void);
>   void bvme6000_set_vectors (void);
>
> -/* Save tick handler routine pointer, will point to do_timer() in
> - * kernel/sched.c, called via bvme6000_process_int() */
> +/* Save tick handler routine pointer, will point to xtime_update() in
> + * kernel/timer/timekeeping.c, called via bvme6000_process_int() */
>
>   static irq_handler_t tick_handler;
>
> diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
> index 06438da..18b34ee 100644
> --- a/arch/m68k/kernel/time.c
> +++ b/arch/m68k/kernel/time.c
> @@ -37,11 +37,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
>
>   /*
>    * timer_interrupt() needs to keep up the real-time clock,
> - * as well as call the "do_timer()" routine every clocktick
> + * as well as call the "xtime_update()" routine every clocktick
>    */
>   static irqreturn_t timer_interrupt(int irq, void *dummy)
>   {
> -	do_timer(1);
> +	xtime_update(1);
>   	update_process_times(user_mode(get_irq_regs()));
>   	profile_tick(CPU_PROFILING);
>
> diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
> index 100baaa..6cb9c3a 100644
> --- a/arch/m68k/mvme147/config.c
> +++ b/arch/m68k/mvme147/config.c
> @@ -46,8 +46,8 @@ extern void mvme147_reset (void);
>
>   static int bcd2int (unsigned char b);
>
> -/* Save tick handler routine pointer, will point to do_timer() in
> - * kernel/sched.c, called via mvme147_process_int() */
> +/* Save tick handler routine pointer, will point to xtime_update() in
> + * kernel/time/timekeeping.c, called via mvme147_process_int() */
>
>   irq_handler_t tick_handler;
>
> diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
> index 11edf61..0b28e26 100644
> --- a/arch/m68k/mvme16x/config.c
> +++ b/arch/m68k/mvme16x/config.c
> @@ -51,8 +51,8 @@ extern void mvme16x_reset (void);
>
>   int bcd2int (unsigned char b);
>
> -/* Save tick handler routine pointer, will point to do_timer() in
> - * kernel/sched.c, called via mvme16x_process_int() */
> +/* Save tick handler routine pointer, will point to xtime_update() in
> + * kernel/time/timekeeping.c, called via mvme16x_process_int() */
>
>   static irq_handler_t tick_handler;
>
> diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
> index 2d9e21b..6464ad3 100644
> --- a/arch/m68k/sun3/sun3ints.c
> +++ b/arch/m68k/sun3/sun3ints.c
> @@ -66,7 +66,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id)
>   #ifdef CONFIG_SUN3
>   	intersil_clear();
>   #endif
> -        do_timer(1);
> +	xtime_update(1);
>   	update_process_times(user_mode(get_irq_regs()));
>           if (!(kstat_cpu(0).irqs[irq] % 20))
>                   sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
> diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
> index d6ac2a4..6623909 100644
> --- a/arch/m68knommu/kernel/time.c
> +++ b/arch/m68knommu/kernel/time.c
> @@ -36,7 +36,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
>   #ifndef CONFIG_GENERIC_CLOCKEVENTS
>   /*
>    * timer_interrupt() needs to keep up the real-time clock,
> - * as well as call the "do_timer()" routine every clocktick
> + * as well as call the "xtime_update()" routine every clocktick
>    */
>   irqreturn_t arch_timer_interrupt(int irq, void *dummy)
>   {
> @@ -44,11 +44,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
>   	if (current->pid)
>   		profile_tick(CPU_PROFILING);
>
> -	write_seqlock(&xtime_lock);
> -
> -	do_timer(1);
> -
> -	write_sequnlock(&xtime_lock);
> +	xtime_update(1);
>
>   	update_process_times(user_mode(get_irq_regs()));
>
>


-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

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

* [tip:timers/core] mn10300: Switch do_timer() to xtimer_update()
  2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
  2011-01-31 13:47   ` Thomas Gleixner
@ 2011-02-09 15:18   ` tip-bot for Torben Hohn
  2011-03-18 16:35   ` [PATCH v2 16/20] mn10300: switch " David Howells
  2 siblings, 0 replies; 51+ messages in thread
From: tip-bot for Torben Hohn @ 2011-02-09 15:18 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, dhowells, torbenh, tglx, yasutake.koichi

Commit-ID:  22b7fcdae562b6792b3f5517e89fd7e0337180ae
Gitweb:     http://git.kernel.org/tip/22b7fcdae562b6792b3f5517e89fd7e0337180ae
Author:     Torben Hohn <torbenh@gmx.de>
AuthorDate: Thu, 27 Jan 2011 16:00:12 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 9 Feb 2011 16:17:24 +0100

mn10300: Switch do_timer() to xtimer_update()

Only one CPU gets the timer interrupt so mn10300_last_tsc does not
need to be protected by xtime lock. Remove xtime lovking and use
xtime_update() which does the locking itself.

Signed-off-by: Torben Hohn <torbenh@gmx.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
LKML-Reference: <20110127150011.23248.62040.stgit@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/mn10300/kernel/time.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index 75da468..5b95500 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -104,8 +104,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 	unsigned tsc, elapse;
 	irqreturn_t ret;
 
-	write_seqlock(&xtime_lock);
-
 	while (tsc = get_cycles(),
 	       elapse = tsc - mn10300_last_tsc, /* time elapsed since last
 						 * tick */
@@ -114,11 +112,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 		mn10300_last_tsc += MN10300_TSC_PER_HZ;
 
 		/* advance the kernel's time tracking system */
-		do_timer(1);
+		xtime_update(1);
 	}
 
-	write_sequnlock(&xtime_lock);
-
 	ret = local_timer_interrupt();
 #ifdef CONFIG_SMP
 	send_IPI_allbutself(LOCAL_TIMER_IPI);

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

* Re: [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update()
  2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
  2011-01-31 13:47   ` Thomas Gleixner
  2011-02-09 15:18   ` [tip:timers/core] mn10300: Switch " tip-bot for Torben Hohn
@ 2011-03-18 16:35   ` David Howells
  2 siblings, 0 replies; 51+ messages in thread
From: David Howells @ 2011-03-18 16:35 UTC (permalink / raw)
  To: Torben Hohn, Thomas Gleixner
  Cc: dhowells, LKML, hch, Peter Zijlstra, johnstul, yong.zhang0,
	Koichi Yasutake

Thomas Gleixner <tglx@linutronix.de> wrote:

> > xtimer_update() properly takes the xtime_lock.
> > mn10300_last_tsc is only accessed from this function.
> 
> This patch can be dropped as that code is dead. I sent a cleanup patch
> to the mn10300 folks.

This patch seems to have gone in anyway and Thomas's cleanup patch no longer
applies; should I revert it and apply Thomas's cleanup patch?

David

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

end of thread, other threads:[~2011-03-18 16:36 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 14:58 [PATCH v2 00/20] localize xtime_lock usage to kernel/time/ Torben Hohn
2011-01-27 14:58 ` [PATCH v2 01/20] move do_timer() from kernel/timer.c into kernel/time/timekeeping.c Torben Hohn
2011-01-31 14:03   ` [tip:timers/core] time: Move do_timer() to kernel/time/timekeeping.c tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c Torben Hohn
2011-01-31 11:36   ` Thomas Gleixner
2011-01-31 14:04   ` [tip:timers/core] time: Move " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c Torben Hohn
2011-01-31 11:38   ` Thomas Gleixner
2011-01-31 14:04   ` [tip:timers/core] time: Provide get_xtime_and_monotonic_offset() tip-bot for Torben Hohn
2011-02-01  9:21   ` [tip:timers/core] time: Fix legacy arch fallout tip-bot for Thomas Gleixner
2011-01-27 14:59 ` [PATCH v2 04/20] provide xtime_update() which does not require the caller to hold xtime_lock Torben Hohn
2011-01-31 14:05   ` [tip:timers/core] time: Provide xtime_update() tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 05/20] alpha: change do_timer() to xtime_update() Torben Hohn
2011-01-31 10:23   ` Thomas Gleixner
2011-01-31 10:32     ` Thomas Gleixner
2011-01-31 14:05   ` [tip:timers/core] alpha: Change " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 06/20] arm: switch from " Torben Hohn
2011-01-31 14:06   ` [tip:timers/core] arm: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 07/20] arm/mach-clps711x: switch " Torben Hohn
2011-01-31 14:06   ` [tip:timers/core] arm/mach-clps711x: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 08/20] blackfin: switch from " Torben Hohn
2011-01-27 19:42   ` Mike Frysinger
2011-01-31 14:07   ` [tip:timers/core] blackfin: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 09/20] cris/arch-v10: switch " Torben Hohn
2011-01-31 14:07   ` [tip:timers/core] cris: arch-v10: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 10/20] cris/arch-v32: switch " Torben Hohn
2011-01-31 14:07   ` [tip:timers/core] cris: arch-v32: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 11/20] frv: switch " Torben Hohn
2011-01-31 14:08   ` [tip:timers/core] frv: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 12/20] h8300: switch " Torben Hohn
2011-01-31 14:08   ` [tip:timers/core] h8300: Switch " tip-bot for Torben Hohn
2011-01-27 14:59 ` [PATCH v2 13/20] ia64: switch " Torben Hohn
2011-01-31 14:09   ` [tip:timers/core] ia64: Switch " tip-bot for Torben Hohn
2011-01-27 15:00 ` [PATCH v2 14/20] m32r: switch from " Torben Hohn
2011-01-31 14:09   ` [tip:timers/core] m32r: Switch " tip-bot for Torben Hohn
2011-01-27 15:00 ` [PATCH v2 15/20] m68k: switch " Torben Hohn
2011-01-31 14:09   ` [tip:timers/core] m68k: Switch " tip-bot for Torben Hohn
2011-02-03 23:07     ` Greg Ungerer
2011-01-27 15:00 ` [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update() Torben Hohn
2011-01-31 13:47   ` Thomas Gleixner
2011-02-09 15:18   ` [tip:timers/core] mn10300: Switch " tip-bot for Torben Hohn
2011-03-18 16:35   ` [PATCH v2 16/20] mn10300: switch " David Howells
2011-01-27 15:00 ` [PATCH v2 17/20] parisc: switch do_timer() to xtime_update() Torben Hohn
2011-01-31 14:10   ` [tip:timers/core] parisc: Switch " tip-bot for Torben Hohn
2011-01-27 15:00 ` [PATCH v2 18/20] sparc: switch " Torben Hohn
2011-01-31 14:10   ` [tip:timers/core] sparc: Switch " tip-bot for Torben Hohn
2011-01-27 15:00 ` [PATCH v2 19/20] xtensa: switch " Torben Hohn
2011-01-31 14:11   ` [tip:timers/core] xtensa: Switch " tip-bot for Torben Hohn
2011-01-27 15:00 ` [PATCH v2 20/20] make do_timer() and xtime_lock private to the timer code Torben Hohn
2011-01-31 14:11   ` [tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/ tip-bot for Torben Hohn
2011-01-31 18:21   ` tip-bot for Torben Hohn

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