diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2012-11-21 14:31:52 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2012-11-21 14:31:52 -0500 |
| commit | 9c3f9e281697d02889c3b08922f3b30be75f56c2 (patch) | |
| tree | e9f3d68e0019a47b982e2b8644f70eb66a3eff3c /kernel/time | |
| parent | b8f61116c1ce342804a0897b0a80eb4df5f19453 (diff) | |
| parent | d6ad418763888f617ac5b4849823e4cd670df1dd (diff) | |
Merge branch 'fortglx/3.8/time' of git://git.linaro.org/people/jstultz/linux into timers/core
Fix trivial conflicts in: kernel/time/tick-sched.c
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/jiffies.c | 8 | ||||
| -rw-r--r-- | kernel/time/tick-common.c | 8 | ||||
| -rw-r--r-- | kernel/time/tick-internal.h | 1 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 22 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 14 |
5 files changed, 23 insertions, 30 deletions
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index 6629bf7b528..7a925ba456f 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c | |||
| @@ -58,7 +58,7 @@ static cycle_t jiffies_read(struct clocksource *cs) | |||
| 58 | return (cycle_t) jiffies; | 58 | return (cycle_t) jiffies; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | struct clocksource clocksource_jiffies = { | 61 | static struct clocksource clocksource_jiffies = { |
| 62 | .name = "jiffies", | 62 | .name = "jiffies", |
| 63 | .rating = 1, /* lowest valid rating*/ | 63 | .rating = 1, /* lowest valid rating*/ |
| 64 | .read = jiffies_read, | 64 | .read = jiffies_read, |
| @@ -67,6 +67,8 @@ struct clocksource clocksource_jiffies = { | |||
| 67 | .shift = JIFFIES_SHIFT, | 67 | .shift = JIFFIES_SHIFT, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | __cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock); | ||
| 71 | |||
| 70 | #if (BITS_PER_LONG < 64) | 72 | #if (BITS_PER_LONG < 64) |
| 71 | u64 get_jiffies_64(void) | 73 | u64 get_jiffies_64(void) |
| 72 | { | 74 | { |
| @@ -74,9 +76,9 @@ u64 get_jiffies_64(void) | |||
| 74 | u64 ret; | 76 | u64 ret; |
| 75 | 77 | ||
| 76 | do { | 78 | do { |
| 77 | seq = read_seqbegin(&xtime_lock); | 79 | seq = read_seqbegin(&jiffies_lock); |
| 78 | ret = jiffies_64; | 80 | ret = jiffies_64; |
| 79 | } while (read_seqretry(&xtime_lock, seq)); | 81 | } while (read_seqretry(&jiffies_lock, seq)); |
| 80 | return ret; | 82 | return ret; |
| 81 | } | 83 | } |
| 82 | EXPORT_SYMBOL(get_jiffies_64); | 84 | EXPORT_SYMBOL(get_jiffies_64); |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index da6c9ecad4e..b1600a6973f 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
| @@ -63,13 +63,13 @@ int tick_is_oneshot_available(void) | |||
| 63 | static void tick_periodic(int cpu) | 63 | static void tick_periodic(int cpu) |
| 64 | { | 64 | { |
| 65 | if (tick_do_timer_cpu == cpu) { | 65 | if (tick_do_timer_cpu == cpu) { |
| 66 | write_seqlock(&xtime_lock); | 66 | write_seqlock(&jiffies_lock); |
| 67 | 67 | ||
| 68 | /* Keep track of the next tick event */ | 68 | /* Keep track of the next tick event */ |
| 69 | tick_next_period = ktime_add(tick_next_period, tick_period); | 69 | tick_next_period = ktime_add(tick_next_period, tick_period); |
| 70 | 70 | ||
| 71 | do_timer(1); | 71 | do_timer(1); |
| 72 | write_sequnlock(&xtime_lock); | 72 | write_sequnlock(&jiffies_lock); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | update_process_times(user_mode(get_irq_regs())); | 75 | update_process_times(user_mode(get_irq_regs())); |
| @@ -130,9 +130,9 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast) | |||
| 130 | ktime_t next; | 130 | ktime_t next; |
| 131 | 131 | ||
| 132 | do { | 132 | do { |
| 133 | seq = read_seqbegin(&xtime_lock); | 133 | seq = read_seqbegin(&jiffies_lock); |
| 134 | next = tick_next_period; | 134 | next = tick_next_period; |
| 135 | } while (read_seqretry(&xtime_lock, seq)); | 135 | } while (read_seqretry(&jiffies_lock, seq)); |
| 136 | 136 | ||
| 137 | clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); | 137 | clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); |
| 138 | 138 | ||
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 4e265b901fe..cf3e59ed6dc 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
| @@ -141,4 +141,3 @@ static inline int tick_device_is_functional(struct clock_event_device *dev) | |||
| 141 | #endif | 141 | #endif |
| 142 | 142 | ||
| 143 | extern void do_timer(unsigned long ticks); | 143 | extern void do_timer(unsigned long ticks); |
| 144 | extern seqlock_t xtime_lock; | ||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 77729cc3750..c96fd6a7625 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | static DEFINE_PER_CPU(struct tick_sched, tick_cpu_sched); | 31 | static DEFINE_PER_CPU(struct tick_sched, tick_cpu_sched); |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | * The time, when the last jiffy update happened. Protected by xtime_lock. | 34 | * The time, when the last jiffy update happened. Protected by jiffies_lock. |
| 35 | */ | 35 | */ |
| 36 | static ktime_t last_jiffies_update; | 36 | static ktime_t last_jiffies_update; |
| 37 | 37 | ||
| @@ -49,14 +49,14 @@ static void tick_do_update_jiffies64(ktime_t now) | |||
| 49 | ktime_t delta; | 49 | ktime_t delta; |
| 50 | 50 | ||
| 51 | /* | 51 | /* |
| 52 | * Do a quick check without holding xtime_lock: | 52 | * Do a quick check without holding jiffies_lock: |
| 53 | */ | 53 | */ |
| 54 | delta = ktime_sub(now, last_jiffies_update); | 54 | delta = ktime_sub(now, last_jiffies_update); |
| 55 | if (delta.tv64 < tick_period.tv64) | 55 | if (delta.tv64 < tick_period.tv64) |
| 56 | return; | 56 | return; |
| 57 | 57 | ||
| 58 | /* Reevalute with xtime_lock held */ | 58 | /* Reevalute with jiffies_lock held */ |
| 59 | write_seqlock(&xtime_lock); | 59 | write_seqlock(&jiffies_lock); |
| 60 | 60 | ||
| 61 | delta = ktime_sub(now, last_jiffies_update); | 61 | delta = ktime_sub(now, last_jiffies_update); |
| 62 | if (delta.tv64 >= tick_period.tv64) { | 62 | if (delta.tv64 >= tick_period.tv64) { |
| @@ -79,7 +79,7 @@ static void tick_do_update_jiffies64(ktime_t now) | |||
| 79 | /* Keep the tick_next_period variable up to date */ | 79 | /* Keep the tick_next_period variable up to date */ |
| 80 | tick_next_period = ktime_add(last_jiffies_update, tick_period); | 80 | tick_next_period = ktime_add(last_jiffies_update, tick_period); |
| 81 | } | 81 | } |
| 82 | write_sequnlock(&xtime_lock); | 82 | write_sequnlock(&jiffies_lock); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | /* | 85 | /* |
| @@ -89,12 +89,12 @@ static ktime_t tick_init_jiffy_update(void) | |||
| 89 | { | 89 | { |
| 90 | ktime_t period; | 90 | ktime_t period; |
| 91 | 91 | ||
| 92 | write_seqlock(&xtime_lock); | 92 | write_seqlock(&jiffies_lock); |
| 93 | /* Did we start the jiffies update yet ? */ | 93 | /* Did we start the jiffies update yet ? */ |
| 94 | if (last_jiffies_update.tv64 == 0) | 94 | if (last_jiffies_update.tv64 == 0) |
| 95 | last_jiffies_update = tick_next_period; | 95 | last_jiffies_update = tick_next_period; |
| 96 | period = last_jiffies_update; | 96 | period = last_jiffies_update; |
| 97 | write_sequnlock(&xtime_lock); | 97 | write_sequnlock(&jiffies_lock); |
| 98 | return period; | 98 | return period; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| @@ -109,7 +109,7 @@ static void tick_sched_do_timer(ktime_t now) | |||
| 109 | * concurrency: This happens only when the cpu in charge went | 109 | * concurrency: This happens only when the cpu in charge went |
| 110 | * into a long sleep. If two cpus happen to assign themself to | 110 | * into a long sleep. If two cpus happen to assign themself to |
| 111 | * this duty, then the jiffies update is still serialized by | 111 | * this duty, then the jiffies update is still serialized by |
| 112 | * xtime_lock. | 112 | * jiffies_lock. |
| 113 | */ | 113 | */ |
| 114 | if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) | 114 | if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) |
| 115 | tick_do_timer_cpu = cpu; | 115 | tick_do_timer_cpu = cpu; |
| @@ -325,11 +325,11 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, | |||
| 325 | 325 | ||
| 326 | /* Read jiffies and the time when jiffies were updated last */ | 326 | /* Read jiffies and the time when jiffies were updated last */ |
| 327 | do { | 327 | do { |
| 328 | seq = read_seqbegin(&xtime_lock); | 328 | seq = read_seqbegin(&jiffies_lock); |
| 329 | last_update = last_jiffies_update; | 329 | last_update = last_jiffies_update; |
| 330 | last_jiffies = jiffies; | 330 | last_jiffies = jiffies; |
| 331 | time_delta = timekeeping_max_deferment(); | 331 | time_delta = timekeeping_max_deferment(); |
| 332 | } while (read_seqretry(&xtime_lock, seq)); | 332 | } while (read_seqretry(&jiffies_lock, seq)); |
| 333 | 333 | ||
| 334 | if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || printk_needs_cpu(cpu) || | 334 | if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) || printk_needs_cpu(cpu) || |
| 335 | arch_needs_cpu(cpu)) { | 335 | arch_needs_cpu(cpu)) { |
| @@ -859,7 +859,7 @@ void tick_setup_sched_timer(void) | |||
| 859 | /* Get the next period (per cpu) */ | 859 | /* Get the next period (per cpu) */ |
| 860 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); | 860 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); |
| 861 | 861 | ||
| 862 | /* Offset the tick to avert xtime_lock contention. */ | 862 | /* Offset the tick to avert jiffies_lock contention. */ |
| 863 | if (sched_skew_tick) { | 863 | if (sched_skew_tick) { |
| 864 | u64 offset = ktime_to_ns(tick_period) >> 1; | 864 | u64 offset = ktime_to_ns(tick_period) >> 1; |
| 865 | do_div(offset, num_possible_cpus()); | 865 | do_div(offset, num_possible_cpus()); |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index e424970bb56..4c7de02eacd 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -25,12 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | static struct timekeeper timekeeper; | 26 | static struct timekeeper timekeeper; |
| 27 | 27 | ||
| 28 | /* | ||
| 29 | * This read-write spinlock protects us from races in SMP while | ||
| 30 | * playing with xtime. | ||
| 31 | */ | ||
| 32 | __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock); | ||
| 33 | |||
| 34 | /* flag for if timekeeping is suspended */ | 28 | /* flag for if timekeeping is suspended */ |
| 35 | int __read_mostly timekeeping_suspended; | 29 | int __read_mostly timekeeping_suspended; |
| 36 | 30 | ||
| @@ -1299,9 +1293,7 @@ struct timespec get_monotonic_coarse(void) | |||
| 1299 | } | 1293 | } |
| 1300 | 1294 | ||
| 1301 | /* | 1295 | /* |
| 1302 | * The 64-bit jiffies value is not atomic - you MUST NOT read it | 1296 | * Must hold jiffies_lock |
| 1303 | * without sampling the sequence number in xtime_lock. | ||
| 1304 | * jiffies is defined in the linker script... | ||
| 1305 | */ | 1297 | */ |
| 1306 | void do_timer(unsigned long ticks) | 1298 | void do_timer(unsigned long ticks) |
| 1307 | { | 1299 | { |
| @@ -1389,7 +1381,7 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset); | |||
| 1389 | */ | 1381 | */ |
| 1390 | void xtime_update(unsigned long ticks) | 1382 | void xtime_update(unsigned long ticks) |
| 1391 | { | 1383 | { |
| 1392 | write_seqlock(&xtime_lock); | 1384 | write_seqlock(&jiffies_lock); |
| 1393 | do_timer(ticks); | 1385 | do_timer(ticks); |
| 1394 | write_sequnlock(&xtime_lock); | 1386 | write_sequnlock(&jiffies_lock); |
| 1395 | } | 1387 | } |
