localize xtime_lock usage to kernel/time/
Subsystems (13)
v2 cover localize xtime_lock usage to kernel/time/
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
Signature · 1 line
torben Hohn
PATCH v2 2/20 move get_jiffies_64 to kernel/time/jiffies.c
in order to make the xtime_lock local to kernel/time all users of this lock need to be moved there.
--- kernel/time.c | 17 ----------------- kernel/time/jiffies.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-)
kernel/time.c +0 -17
@@ -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)
kernel/time/jiffies.c +17 -0
@@ -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);
PATCH v2 1/20 move do_timer() from kernel/timer.c into kernel/time/timekeeping.c
In reply to Torben Hohnthis 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.
--- include/linux/time.h | 1 - kernel/time/timekeeping.c | 13 ++++++++++++- kernel/timer.c | 12 ------------ 3 files changed, 12 insertions(+), 14 deletions(-)
include/linux/time.h +0 -1
@@ -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 ;
kernel/time/timekeeping.c +12 -1
@@ -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 (); +}
kernel/timer.c +0 -12
@@ -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/*
PATCH v2 3/20 provide get_xtime_and_monotonic_offset() and use it in hrtimer.c
In reply to Torben Hohn2 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.
--- include/linux/time.h | 1 + kernel/hrtimer.c | 12 ++---------- kernel/time/timekeeping.c | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-)
include/linux/time.h +1 -0
@@ -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 })
kernel/hrtimer.c +2 -10
@@ -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);
kernel/time/timekeeping.c +21 -0
@@ -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)); +}
PATCH v2 5/20 alpha: change do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself. state does not to be protected with this lock. its only touched here and during init.
--- arch/alpha/kernel/time.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
arch/alpha/kernel/time.c +2 -6
@@ -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 ();
PATCH v2 6/20 arm: switch from do_timer() to xtime_update()
In reply to Torben Hohnxtime_update takes the xtime_lock itself.
--- arch/arm/kernel/time.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/kernel/time.c +1 -3
@@ -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
PATCH v2 7/20 arm/mach-clps711x: switch do_timer() to xtime_update()
In reply to Torben Hohndo_timer() requires holding the xtime_lock, which this code did not do.
use the safe version xtime_update()
--- arch/arm/mach-clps711x/include/mach/time.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-clps711x/include/mach/time.h +1 -1
@@ -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
PATCH v2 8/20 blackfin: switch from do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself.
--- arch/blackfin/kernel/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/blackfin/kernel/time.c +2 -4
@@ -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 ());
PATCH v2 9/20 cris/arch-v10: switch do_timer() to xtime_update()
In reply to Torben Hohnthis code failed to take the xtime_lock, which must be held when calling do_timer().
use the safe version xtime_update()
--- arch/cris/arch-v10/kernel/time.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/cris/arch-v10/kernel/time.c +2 -2
@@ -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 ;
PATCH v2 10/20 cris/arch-v32: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself.
--- arch/cris/arch-v32/kernel/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/cris/arch-v32/kernel/time.c +2 -4
@@ -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 ; }
PATCH v2 11/20 frv: switch do_timer() to xtime_update()
In reply to Torben Hohn__set_LEDS() does not need to be protected by the lock. its used unprotected in other places.
--- arch/frv/kernel/time.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
arch/frv/kernel/time.c +4 -5
@@ -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 ;
PATCH v2 12/20 h8300: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself.
--- arch/h8300/kernel/time.c | 4 +--- arch/h8300/kernel/timer/timer8.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/h8300/kernel/time.c +1 -3
@@ -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 ())); }
arch/h8300/kernel/timer/timer8.c +1 -1
@@ -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)
PATCH v2 13/20 ia64: switch do_timer() to xtime_update()
In reply to Torben Hohnlocal_cpu_data->itm_next = new_itm; does not need to be protected by this lock. and xtime_update() takes the lock itself.
--- arch/ia64/kernel/time.c | 19 +++++-------------- arch/ia64/xen/time.c | 13 +++++-------- 2 files changed, 10 insertions(+), 22 deletions(-)
arch/ia64/kernel/time.c +5 -14
@@ -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). */
arch/ia64/xen/time.c +5 -8
@@ -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; }
PATCH v2 14/20 m32r: switch from do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() does proper locking.
--- arch/m32r/kernel/time.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
arch/m32r/kernel/time.c +2 -3
@@ -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 ()));
PATCH v2 15/20 m68k: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() properly takes the xtime_lock
--- 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(-)
arch/m68k/bvme6000/config.c +2 -2
@@ -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;
arch/m68k/kernel/time.c +2 -2
@@ -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 );
arch/m68k/mvme147/config.c +2 -2
@@ -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;
arch/m68k/mvme16x/config.c +2 -2
@@ -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;
arch/m68k/sun3/sun3ints.c +1 -1
@@ -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 ]);
arch/m68knommu/kernel/time.c +2 -6
@@ -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 ()));
PATCH v2 16/20 mn10300: switch do_timer() to xtimer_update()
In reply to Torben Hohnxtimer_update() properly takes the xtime_lock. mn10300_last_tsc is only accessed from this function.
--- arch/mn10300/kernel/time.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/mn10300/kernel/time.c +1 -5
@@ -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 );
PATCH v2 18/20 sparc: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_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.
--- arch/sparc/kernel/pcic.c | 4 +--- arch/sparc/kernel/time_32.c | 9 ++------- 2 files changed, 3 insertions(+), 10 deletions(-)
arch/sparc/kernel/pcic.c +1 -3
@@ -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
arch/sparc/kernel/time_32.c +2 -7
@@ -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 ()));
PATCH v2 19/20 xtensa: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself.
set_linux_timer() does not need to be protected by a lock.
--- arch/xtensa/kernel/time.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/xtensa/kernel/time.c +1 -5
@@ -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). */
PATCH v2 20/20 make do_timer() and xtime_lock private to the timer code
In reply to Torben Hohnthis 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
--- 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
include/linux/sched.h +0 -1
@@ -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);
include/linux/time.h +0 -2
@@ -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);
kernel/time/ntp.c +2 -0
@@ -16,6 +16,8 @@#include <linux/mm.h> #include <linux/module.h> +#include "timer-internal.h" +/* * NTP timekeeping variables: */
kernel/time/tick-common.c +1 -0
@@ -23,6 +23,7 @@#include <asm/irq_regs.h> #include "tick-internal.h" +#include "timer-internal.h" /* * Tick devices
kernel/time/tick-sched.c +1 -0
@@ -25,6 +25,7 @@#include <asm/irq_regs.h> #include "tick-internal.h" +#include "timer-internal.h" /* * Per cpu nohz control structure
kernel/time/timer-internal.h new file +7 -0
@@ -0,0 +1,7 @@ +/* +* timer internal variable and functions +*/ + +extern void do_timer (unsigned long ticks); +extern seqlock_t xtime_lock; +
PATCH v2 17/20 parisc: switch do_timer() to xtime_update()
In reply to Torben Hohnxtime_update() takes the xtime_lock itself.
--- arch/parisc/kernel/time.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
arch/parisc/kernel/time.c +1 -3
@@ -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 ;
PATCH v2 4/20 provide xtime_update() which does not require the caller to hold xtime_lock
In reply to Torben Hohnlike do_timer().
this change avoids having this code sequence all over the place:
seq_writelock( &xtime_lock );do_timer();seq_writeunlock( &xtime_lock );
--- include/linux/sched.h | 1 + kernel/time/timekeeping.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
include/linux/sched.h +1 -0
@@ -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);
kernel/time/timekeeping.c +13 -0
@@ -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); +}
Re: [PATCH v2 08/20] blackfin: switch from do_timer() to xtime_update()
In reply to Torben HohnQuoted 1 line · Torben Hohn
xtime_update()takes thextime_lockitself.
looks straightforward enough ...
-mike
Re: [PATCH v2 05/20] alpha: change do_timer() to xtime_update()
In reply to Torben HohnQuoted 3 lines · Torben Hohn
xtime_update()takes thextime_lockitself.
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
Re: [PATCH v2 05/20] alpha: change do_timer() to xtime_update()
Quoted 8 lines · Thomas Gleixner
Quoted 3 lines · Torben Hohn
xtime_update()takes thextime_lockitself.
state does not to be protected with this lock.
its only touched here and during init.
xtime_lockvery 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.
Re: [PATCH v2 02/20] move get_jiffies_64 to kernel/time/jiffies.c
In reply to Torben HohnQuoted 2 lines · Torben Hohn
in order to make the
xtime_locklocal 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
Re: [PATCH v2 03/20] provide get_xtime_and_monotonic_offset() and use it in hrtimer.c
In reply to Torben HohnQuoted 5 lines · Torben Hohn
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.
kernel/hrtimer.c static void retrigger_next_event(void *arg) · line 616
Quoted 10 lines
kernel/hrtimer.c +1
-4@@ -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.
Quoted 18 lines
kernel/hrtimer.c +0
-0base = &__get_cpu_var (hrtimer_bases);kernel/time/timekeeping.c +9
-0@@ -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. +*/
kernel/time/timekeeping.c void do_timer(unsigned long ticks) · line 978
Quoted 10 lines
kernel/time/timekeeping.c +10
-0+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.
kernel/time/timekeeping.c void do_timer(unsigned long ticks) · line 980
Quoted 2 lines
kernel/time/timekeeping.c +2
-0+ }while (read_seqretry (&xtime_lock, seq)); +}
Thanks,
tglx
Re: [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update()
In reply to Torben HohnQuoted 2 lines · Torben Hohn
xtimer_update()properly takes thextime_lock.mn10300_last_tscis 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
[tip:timers/core] time: Move do_timer() to kernel/time/timekeeping.c
In reply to Torben HohnCommit-ID: 871cf1e5f2a17702f58539a3af8b18fc8666ad4c Gitweb: http://git.kernel.org/tip/871cf1e5f2a17702f58539a3af8b18fc8666ad4c Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:58:55 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127145855.23248.56933.stgit@localhost>
--- include/linux/time.h | 1 - kernel/time/timekeeping.c | 14 +++++++++++++- kernel/timer.c | 13 ------------- 3 files changed, 13 insertions(+), 15 deletions(-)
include/linux/time.h +0 -1
@@ -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 ;
kernel/time/timekeeping.c +13 -1
@@ -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); +}
kernel/timer.c +0 -13
@@ -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/*
[tip:timers/core] time: Move get_jiffies_64 to kernel/time/jiffies.c
In reply to Torben HohnCommit-ID: fbad1ea94159a71bc0f68b00e57ae803606af9fb Gitweb: http://git.kernel.org/tip/fbad1ea94159a71bc0f68b00e57ae803606af9fb Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:00 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127145900.23248.73352.stgit@localhost>
--- kernel/time.c | 17 ----------------- kernel/time/jiffies.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-)
kernel/time.c +0 -17
@@ -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)
kernel/time/jiffies.c +18 -0
@@ -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);
[tip:timers/core] time: Provide get_xtime_and_monotonic_offset()
In reply to Torben HohnCommit-ID: 48cf76f7104f655bbd48a75c7759dce82c3e1ab6 Gitweb: http://git.kernel.org/tip/48cf76f7104f655bbd48a75c7759dce82c3e1ab6 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:05 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127145905.23248.30458.stgit@localhost>
--- include/linux/time.h | 1 + kernel/hrtimer.c | 13 ++----------- kernel/time/timekeeping.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 11 deletions(-)
include/linux/time.h +1 -0
@@ -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 })
kernel/hrtimer.c +2 -11
@@ -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);
kernel/time/timekeeping.c +16 -0
@@ -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)); +}
[tip:timers/core] time: Provide xtime_update()
In reply to Torben HohnCommit-ID: f0af911a9dec9de702645182c8d269449e24d24b Gitweb: http://git.kernel.org/tip/f0af911a9dec9de702645182c8d269449e24d24b Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:10 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127145910.23248.21379.stgit@localhost>
--- include/linux/sched.h | 1 + kernel/time/timekeeping.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
include/linux/sched.h +1 -0
@@ -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);
kernel/time/timekeeping.c +13 -0
@@ -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); +}
[tip:timers/core] alpha: Change do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 1340f3e0b29b745a33f431455c3a37f48197bc81 Gitweb: http://git.kernel.org/tip/1340f3e0b29b745a33f431455c3a37f48197bc81 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:15 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127145915.23248.20919.stgit@localhost>
--- arch/alpha/kernel/time.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
arch/alpha/kernel/time.c +2 -6
@@ -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 ();
[tip:timers/core] arm: Switch from do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 6906e33cc555c390cd091f6f363b783322dfedf6 Gitweb: http://git.kernel.org/tip/6906e33cc555c390cd091f6f363b783322dfedf6 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:21 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:43 +0100
arm: Switch from do_timer() to xtime_update()
xtime_update takes the xtime_lock itself.
LKML-Reference: <20110127145920.23248.75541.stgit@localhost>
--- arch/arm/kernel/time.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/kernel/time.c +1 -3
@@ -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
[tip:timers/core] arm/mach-clps711x: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: ec2dff2febf19ff2109c2eb3e56d5a969fe399e2 Gitweb: http://git.kernel.org/tip/ec2dff2febf19ff2109c2eb3e56d5a969fe399e2 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:26 +0100 Committer: Thomas Gleixner <[email protected]> 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()
LKML-Reference: <20110127145926.23248.56369.stgit@localhost>
--- arch/arm/mach-clps711x/include/mach/time.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-clps711x/include/mach/time.h +1 -1
@@ -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
[tip:timers/core] blackfin: Switch from do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 4196b892d55caaf2c98da05e80472ca482ca19fe Gitweb: http://git.kernel.org/tip/4196b892d55caaf2c98da05e80472ca482ca19fe Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:31 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:44 +0100
blackfin: Switch from do_timer() to xtime_update()
xtime_update() takes the xtime_lock itself.
LKML-Reference: <20110127145931.23248.33917.stgit@localhost>
--- arch/blackfin/kernel/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/blackfin/kernel/time.c +2 -4
@@ -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 ());
[tip:timers/core] cris: arch-v10: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 17588b99183ece563013622afeefd37eb8e68fd3 Gitweb: http://git.kernel.org/tip/17588b99183ece563013622afeefd37eb8e68fd3 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:36 +0100 Committer: Thomas Gleixner <[email protected]> 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()
LKML-Reference: <20110127145936.23248.16192.stgit@localhost>
--- arch/cris/arch-v10/kernel/time.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/cris/arch-v10/kernel/time.c +2 -2
@@ -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 ;
[tip:timers/core] cris: arch-v32: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 36cb07bb8118cb14211ef25c58026f005877c47d Gitweb: http://git.kernel.org/tip/36cb07bb8118cb14211ef25c58026f005877c47d Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:41 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127145941.23248.92547.stgit@localhost>
--- arch/cris/arch-v32/kernel/time.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/cris/arch-v32/kernel/time.c +2 -4
@@ -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 ; }
[tip:timers/core] frv: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 57464bd87f708e75b47312766e3fc8dc3aaf66ad Gitweb: http://git.kernel.org/tip/57464bd87f708e75b47312766e3fc8dc3aaf66ad Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:46 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127145946.23248.57952.stgit@localhost>
--- arch/frv/kernel/time.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
arch/frv/kernel/time.c +2 -12
@@ -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 ;
[tip:timers/core] h8300: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: daad8b581e7f5e21a2f79e49d57d4f6a73b26510 Gitweb: http://git.kernel.org/tip/daad8b581e7f5e21a2f79e49d57d4f6a73b26510 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:51 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:45 +0100
h8300: Switch do_timer() to xtime_update()
xtime_update() takes the xtime_lock itself.
LKML-Reference: <20110127145951.23248.92727.stgit@localhost>
--- arch/h8300/kernel/time.c | 4 +--- arch/h8300/kernel/timer/timer8.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/h8300/kernel/time.c +1 -3
@@ -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 ())); }
arch/h8300/kernel/timer/timer8.c +1 -1
@@ -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)
[tip:timers/core] ia64: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 1aabd67d2e97e6affdf5a7c65f442ac91ace3f85 Gitweb: http://git.kernel.org/tip/1aabd67d2e97e6affdf5a7c65f442ac91ace3f85 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 15:59:56 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127145956.23248.49107.stgit@localhost>
--- arch/ia64/kernel/time.c | 19 +++++-------------- arch/ia64/xen/time.c | 13 +++++-------- 2 files changed, 10 insertions(+), 22 deletions(-)
arch/ia64/kernel/time.c +5 -14
@@ -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). */
arch/ia64/xen/time.c +5 -8
@@ -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; }
[tip:timers/core] m32r: Switch from do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 7bde2ab7cb51f14c6f6574f0f5a78445f2caed3e Gitweb: http://git.kernel.org/tip/7bde2ab7cb51f14c6f6574f0f5a78445f2caed3e Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:01 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:45 +0100
m32r: Switch from do_timer() to xtime_update()
xtime_update() does proper locking.
LKML-Reference: <20110127150001.23248.68620.stgit@localhost>
--- arch/m32r/kernel/time.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
arch/m32r/kernel/time.c +2 -3
@@ -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 ()));
[tip:timers/core] m68k: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: e53f276beb655c711a5d1f25f800b61aa976e34f Gitweb: http://git.kernel.org/tip/e53f276beb655c711a5d1f25f800b61aa976e34f Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:06 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:46 +0100
m68k: Switch do_timer() to xtime_update()
xtime_update() properly takes the xtime_lock
LKML-Reference: <20110127150006.23248.71790.stgit@localhost>
--- 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(-)
arch/m68k/bvme6000/config.c +2 -2
@@ -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;
arch/m68k/kernel/time.c +2 -2
@@ -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 );
arch/m68k/mvme147/config.c +2 -2
@@ -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;
arch/m68k/mvme16x/config.c +2 -2
@@ -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;
arch/m68k/sun3/sun3ints.c +1 -1
@@ -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 ]);
arch/m68knommu/kernel/time.c +2 -6
@@ -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 ()));
[tip:timers/core] parisc: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: bb1dfc1cf6c51ca42f7c05029a6f06df9092a0fc Gitweb: http://git.kernel.org/tip/bb1dfc1cf6c51ca42f7c05029a6f06df9092a0fc Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:17 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:46 +0100
parisc: Switch do_timer() to xtime_update()
xtime_update() takes the xtime_lock itself.
LKML-Reference: <20110127150017.23248.22559.stgit@localhost>
--- arch/parisc/kernel/time.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
arch/parisc/kernel/time.c +2 -5
@@ -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 ; }
[tip:timers/core] sparc: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: 4ea1b72551d052a3993ef72ce06ecf5bdd125859 Gitweb: http://git.kernel.org/tip/4ea1b72551d052a3993ef72ce06ecf5bdd125859 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:22 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127150022.23248.80369.stgit@localhost>
--- arch/sparc/kernel/pcic.c | 4 +--- arch/sparc/kernel/time_32.c | 9 ++------- 2 files changed, 3 insertions(+), 10 deletions(-)
arch/sparc/kernel/pcic.c +1 -3
@@ -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
arch/sparc/kernel/time_32.c +2 -7
@@ -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 ()));
[tip:timers/core] xtensa: Switch do_timer() to xtime_update()
In reply to Torben HohnCommit-ID: d12b0e24c56c6fb2398609f26858e5278d688840 Gitweb: http://git.kernel.org/tip/d12b0e24c56c6fb2398609f26858e5278d688840 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:27 +0100 Committer: Thomas Gleixner <[email protected]> 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. ]
LKML-Reference: <20110127150027.23248.61798.stgit@localhost>
--- arch/xtensa/kernel/time.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/xtensa/kernel/time.c +1 -5
@@ -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). */
[tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/
In reply to Torben HohnCommit-ID: a2f29b47e1b5a38418e4da96d59cb0d5b9d07a07 Gitweb: http://git.kernel.org/tip/a2f29b47e1b5a38418e4da96d59cb0d5b9d07a07 Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:32 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127150032.23248.75995.stgit@localhost>
--- 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(-)
include/linux/sched.h +0 -1
@@ -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);
include/linux/time.h +0 -2
@@ -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);
kernel/time/clockevents.c +0 -1
@@ -18,7 +18,6 @@#include <linux/notifier.h> #include <linux/smp.h> #include <linux/sysdev.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/ntp.c +2 -0
@@ -16,6 +16,8 @@#include <linux/mm.h> #include <linux/module.h> +#include "tick-internal.h" +/* * NTP timekeeping variables: */
kernel/time/tick-broadcast.c +0 -1
@@ -18,7 +18,6 @@#include <linux/percpu.h> #include <linux/profile.h> #include <linux/sched.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/tick-common.c +0 -1
@@ -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>
kernel/time/tick-internal.h +4 -0
@@ -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;
kernel/time/tick-oneshot.c +0 -1
@@ -18,7 +18,6 @@#include <linux/percpu.h> #include <linux/profile.h> #include <linux/sched.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/tick-sched.c +0 -1
@@ -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>
[tip:timers/core] time: Make do_timer() and xtime_lock local to kernel/time/
In reply to Torben HohnCommit-ID: 025c435f6140c99e19e3a827faf49f3880afcf1e Gitweb: http://git.kernel.org/tip/025c435f6140c99e19e3a827faf49f3880afcf1e Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:32 +0100 Committer: Thomas Gleixner <[email protected]> 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 ]
LKML-Reference: <20110127150032.23248.75995.stgit@localhost>
--- 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(-)
include/linux/sched.h +0 -1
@@ -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);
include/linux/time.h +0 -2
@@ -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);
kernel/time/clockevents.c +0 -1
@@ -18,7 +18,6 @@#include <linux/notifier.h> #include <linux/smp.h> #include <linux/sysdev.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/jiffies.c +2 -0
@@ -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
kernel/time/ntp.c +2 -0
@@ -16,6 +16,8 @@#include <linux/mm.h> #include <linux/module.h> +#include "tick-internal.h" +/* * NTP timekeeping variables: */
kernel/time/tick-broadcast.c +0 -1
@@ -18,7 +18,6 @@#include <linux/percpu.h> #include <linux/profile.h> #include <linux/sched.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/tick-common.c +0 -1
@@ -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>
kernel/time/tick-internal.h +4 -0
@@ -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;
kernel/time/tick-oneshot.c +0 -1
@@ -18,7 +18,6 @@#include <linux/percpu.h> #include <linux/profile.h> #include <linux/sched.h> -#include <linux/tick.h> #include "tick-internal.h"
kernel/time/tick-sched.c +0 -1
@@ -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>
[tip:timers/core] time: Fix legacy arch fallout
In reply to Torben HohnCommit-ID: 7cf37e87dd2cfa17a64f28ea7f31eed4525f79e4 Gitweb: http://git.kernel.org/tip/7cf37e87dd2cfa17a64f28ea7f31eed4525f79e4 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 1 Feb 2011 09:34:58 +0100 Committer: Ingo Molnar <[email protected]> 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.
LKML-Reference: <20110127145905.23248.30458.stgit@localhost>
--- kernel/time/tick-internal.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
kernel/time/tick-internal.h +4 -0
@@ -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;
Re: [tip:timers/core] m68k: Switch do_timer() to xtime_update()
In reply to tip-bot for Torben HohnQuoted 11 lines · tip-bot for Torben Hohn
Commit-ID: e53f276beb655c711a5d1f25f800b61aa976e34f Gitweb: http://git.kernel.org/tip/e53f276beb655c711a5d1f25f800b61aa976e34f Author: Torben Hohn<[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:06 +0100 Committer: Thomas Gleixner<[email protected]> CommitDate: Mon, 31 Jan 2011 14:55:46 +0100m68k: Switch
do_timer()toxtime_update()
xtime_update()properly takes thextime_lock
Quoted 9 lines
Signed-off-by Torben Hohn<[email protected]>Cc Sam Creasey<[email protected]>Cc Peter Zijlstra<[email protected]>Cc Roman Zippel<[email protected]>Cc Geert Uytterhoeven<[email protected]>Cc Greg Ungerer<[email protected]>
I have no problem with the m68knommu part:
Quoted 114 lines
LKML-Reference:<20110127150006.23248.71790.stgit@localhost>
Signed-off-by Thomas Gleixner<[email protected]>--- 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(-)arch/m68k/bvme6000/config.c +2
-2@@ -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;arch/m68k/kernel/time.c +2
-2@@ -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 );arch/m68k/mvme147/config.c +2
-2@@ -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;arch/m68k/mvme16x/config.c +2
-2@@ -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;arch/m68k/sun3/sun3ints.c +1
-1@@ -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 ]);arch/m68knommu/kernel/time.c +2
-6@@ -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 ()));
Signature · 5 lines
------------------------------------------------------------------------ Greg Ungerer -- Principal Engineer EMAIL: [email protected] 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
[tip:timers/core] mn10300: Switch do_timer() to xtimer_update()
In reply to Torben HohnCommit-ID: 22b7fcdae562b6792b3f5517e89fd7e0337180ae Gitweb: http://git.kernel.org/tip/22b7fcdae562b6792b3f5517e89fd7e0337180ae Author: Torben Hohn <[email protected]> AuthorDate: Thu, 27 Jan 2011 16:00:12 +0100 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <20110127150011.23248.62040.stgit@localhost>
--- arch/mn10300/kernel/time.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
arch/mn10300/kernel/time.c +1 -5
@@ -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 );
Re: [PATCH v2 16/20] mn10300: switch do_timer() to xtimer_update()
In reply to Thomas GleixnerQuoted 5 lines · Thomas Gleixner
Quoted 2 lines
xtimer_update()properly takes thextime_lock.mn10300_last_tscis 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