diff options
author | John Stultz <john.stultz@linaro.org> | 2013-12-12 16:10:55 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-12-23 14:54:32 -0500 |
commit | 47a1b796306356f358e515149d86baf0cc6bf007 (patch) | |
tree | 0ab5132f643db4318b395f2cb13f435ba3d9e5b6 /kernel/time | |
parent | 6fdda9a9c5db367130cf32df5d6618d08b89f46a (diff) |
tick/timekeeping: Call update_wall_time outside the jiffies lock
Since the xtime lock was split into the timekeeping lock and
the jiffies lock, we no longer need to call update_wall_time()
while holding the jiffies lock.
Thus, this patch splits update_wall_time() out from do_timer().
This allows us to get away from calling clock_was_set_delayed()
in update_wall_time() and instead use the standard clock_was_set()
call that previously would deadlock, as it causes the jiffies lock
to be acquired.
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/tick-common.c | 1 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 1 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 1 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 19 |
4 files changed, 7 insertions, 15 deletions
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 64522ecdfe0e..91c5f27e82a3 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -70,6 +70,7 @@ static void tick_periodic(int cpu) | |||
70 | 70 | ||
71 | do_timer(1); | 71 | do_timer(1); |
72 | write_sequnlock(&jiffies_lock); | 72 | write_sequnlock(&jiffies_lock); |
73 | update_wall_time(); | ||
73 | } | 74 | } |
74 | 75 | ||
75 | update_process_times(user_mode(get_irq_regs())); | 76 | update_process_times(user_mode(get_irq_regs())); |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index e2bced59b6dd..8329669b51ec 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -155,3 +155,4 @@ static inline int tick_device_is_functional(struct clock_event_device *dev) | |||
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | extern void do_timer(unsigned long ticks); | 157 | extern void do_timer(unsigned long ticks); |
158 | extern void update_wall_time(void); | ||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 2afd43fca93b..c58b03d89951 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -86,6 +86,7 @@ static void tick_do_update_jiffies64(ktime_t now) | |||
86 | tick_next_period = ktime_add(last_jiffies_update, tick_period); | 86 | tick_next_period = ktime_add(last_jiffies_update, tick_period); |
87 | } | 87 | } |
88 | write_sequnlock(&jiffies_lock); | 88 | write_sequnlock(&jiffies_lock); |
89 | update_wall_time(); | ||
89 | } | 90 | } |
90 | 91 | ||
91 | /* | 92 | /* |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index d62682b6df4a..44b7e6bb081b 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -1360,7 +1360,7 @@ static inline void old_vsyscall_fixup(struct timekeeper *tk) | |||
1360 | * update_wall_time - Uses the current clocksource to increment the wall time | 1360 | * update_wall_time - Uses the current clocksource to increment the wall time |
1361 | * | 1361 | * |
1362 | */ | 1362 | */ |
1363 | static void update_wall_time(void) | 1363 | void update_wall_time(void) |
1364 | { | 1364 | { |
1365 | struct clocksource *clock; | 1365 | struct clocksource *clock; |
1366 | struct timekeeper *real_tk = &timekeeper; | 1366 | struct timekeeper *real_tk = &timekeeper; |
@@ -1441,19 +1441,8 @@ static void update_wall_time(void) | |||
1441 | write_seqcount_end(&timekeeper_seq); | 1441 | write_seqcount_end(&timekeeper_seq); |
1442 | out: | 1442 | out: |
1443 | raw_spin_unlock_irqrestore(&timekeeper_lock, flags); | 1443 | raw_spin_unlock_irqrestore(&timekeeper_lock, flags); |
1444 | if (clock_was_set) { | 1444 | if (clock_set) |
1445 | /* | 1445 | clock_was_set(); |
1446 | * XXX - I'd rather we just call clock_was_set(), but | ||
1447 | * since we're currently holding the jiffies lock, calling | ||
1448 | * clock_was_set would trigger an ipi which would then grab | ||
1449 | * the jiffies lock and we'd deadlock. :( | ||
1450 | * The right solution should probably be droping | ||
1451 | * the jiffies lock before calling update_wall_time | ||
1452 | * but that requires some rework of the tick sched | ||
1453 | * code. | ||
1454 | */ | ||
1455 | clock_was_set_delayed(); | ||
1456 | } | ||
1457 | } | 1446 | } |
1458 | 1447 | ||
1459 | /** | 1448 | /** |
@@ -1598,7 +1587,6 @@ struct timespec get_monotonic_coarse(void) | |||
1598 | void do_timer(unsigned long ticks) | 1587 | void do_timer(unsigned long ticks) |
1599 | { | 1588 | { |
1600 | jiffies_64 += ticks; | 1589 | jiffies_64 += ticks; |
1601 | update_wall_time(); | ||
1602 | calc_global_load(ticks); | 1590 | calc_global_load(ticks); |
1603 | } | 1591 | } |
1604 | 1592 | ||
@@ -1756,4 +1744,5 @@ void xtime_update(unsigned long ticks) | |||
1756 | write_seqlock(&jiffies_lock); | 1744 | write_seqlock(&jiffies_lock); |
1757 | do_timer(ticks); | 1745 | do_timer(ticks); |
1758 | write_sequnlock(&jiffies_lock); | 1746 | write_sequnlock(&jiffies_lock); |
1747 | update_wall_time(); | ||
1759 | } | 1748 | } |