diff options
-rw-r--r-- | drivers/rtc/class.c | 5 | ||||
-rw-r--r-- | drivers/s390/net/ctcmain.c | 6 | ||||
-rw-r--r-- | drivers/s390/net/netiucv.c | 4 | ||||
-rw-r--r-- | include/linux/time.h | 8 | ||||
-rw-r--r-- | kernel/acct.c | 2 | ||||
-rw-r--r-- | kernel/hrtimer.c | 6 | ||||
-rw-r--r-- | kernel/time.c | 16 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 38 | ||||
-rw-r--r-- | kernel/tsacct.c | 2 | ||||
-rw-r--r-- | net/rxrpc/af_rxrpc.c | 2 | ||||
-rw-r--r-- | net/rxrpc/ar-connection.c | 4 | ||||
-rw-r--r-- | net/rxrpc/ar-transport.c | 4 | ||||
-rw-r--r-- | net/rxrpc/rxkad.c | 2 |
13 files changed, 56 insertions, 43 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 8b3cd31d6a61..10ab3b71ffc6 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -46,6 +46,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
46 | { | 46 | { |
47 | struct rtc_device *rtc = to_rtc_device(dev); | 47 | struct rtc_device *rtc = to_rtc_device(dev); |
48 | struct rtc_time tm; | 48 | struct rtc_time tm; |
49 | struct timespec ts = current_kernel_time(); | ||
49 | 50 | ||
50 | if (strncmp(rtc->dev.bus_id, | 51 | if (strncmp(rtc->dev.bus_id, |
51 | CONFIG_RTC_HCTOSYS_DEVICE, | 52 | CONFIG_RTC_HCTOSYS_DEVICE, |
@@ -57,8 +58,8 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
57 | 58 | ||
58 | /* RTC precision is 1 second; adjust delta for avg 1/2 sec err */ | 59 | /* RTC precision is 1 second; adjust delta for avg 1/2 sec err */ |
59 | set_normalized_timespec(&delta, | 60 | set_normalized_timespec(&delta, |
60 | xtime.tv_sec - oldtime, | 61 | ts.tv_sec - oldtime, |
61 | xtime.tv_nsec - (NSEC_PER_SEC >> 1)); | 62 | ts.tv_nsec - (NSEC_PER_SEC >> 1)); |
62 | 63 | ||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index b20fd0681733..92e8a37b5022 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -674,7 +674,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg) | |||
674 | int first = 1; | 674 | int first = 1; |
675 | int i; | 675 | int i; |
676 | unsigned long duration; | 676 | unsigned long duration; |
677 | struct timespec done_stamp = xtime; | 677 | struct timespec done_stamp = current_kernel_time(); |
678 | 678 | ||
679 | DBF_TEXT(trace, 4, __FUNCTION__); | 679 | DBF_TEXT(trace, 4, __FUNCTION__); |
680 | 680 | ||
@@ -730,7 +730,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg) | |||
730 | spin_unlock(&ch->collect_lock); | 730 | spin_unlock(&ch->collect_lock); |
731 | ch->ccw[1].count = ch->trans_skb->len; | 731 | ch->ccw[1].count = ch->trans_skb->len; |
732 | fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); | 732 | fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); |
733 | ch->prof.send_stamp = xtime; | 733 | ch->prof.send_stamp = current_kernel_time(); |
734 | rc = ccw_device_start(ch->cdev, &ch->ccw[0], | 734 | rc = ccw_device_start(ch->cdev, &ch->ccw[0], |
735 | (unsigned long) ch, 0xff, 0); | 735 | (unsigned long) ch, 0xff, 0); |
736 | ch->prof.doios_multi++; | 736 | ch->prof.doios_multi++; |
@@ -2281,7 +2281,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
2281 | fsm_newstate(ch->fsm, CH_STATE_TX); | 2281 | fsm_newstate(ch->fsm, CH_STATE_TX); |
2282 | fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); | 2282 | fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); |
2283 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 2283 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
2284 | ch->prof.send_stamp = xtime; | 2284 | ch->prof.send_stamp = current_kernel_time(); |
2285 | rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx], | 2285 | rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx], |
2286 | (unsigned long) ch, 0xff, 0); | 2286 | (unsigned long) ch, 0xff, 0); |
2287 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); | 2287 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 3d28e1a5bf79..268889474339 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -753,7 +753,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg) | |||
753 | 753 | ||
754 | header.next = 0; | 754 | header.next = 0; |
755 | memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); | 755 | memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); |
756 | conn->prof.send_stamp = xtime; | 756 | conn->prof.send_stamp = current_kernel_time(); |
757 | txmsg.class = 0; | 757 | txmsg.class = 0; |
758 | txmsg.tag = 0; | 758 | txmsg.tag = 0; |
759 | rc = iucv_message_send(conn->path, &txmsg, 0, 0, | 759 | rc = iucv_message_send(conn->path, &txmsg, 0, 0, |
@@ -1185,7 +1185,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn, | |||
1185 | memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); | 1185 | memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); |
1186 | 1186 | ||
1187 | fsm_newstate(conn->fsm, CONN_STATE_TX); | 1187 | fsm_newstate(conn->fsm, CONN_STATE_TX); |
1188 | conn->prof.send_stamp = xtime; | 1188 | conn->prof.send_stamp = current_kernel_time(); |
1189 | 1189 | ||
1190 | msg.tag = 1; | 1190 | msg.tag = 1; |
1191 | msg.class = 0; | 1191 | msg.class = 0; |
diff --git a/include/linux/time.h b/include/linux/time.h index e6aea5146e5d..6a5f503b4f1d 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -99,15 +99,11 @@ extern int update_persistent_clock(struct timespec now); | |||
99 | extern int no_sync_cmos_clock __read_mostly; | 99 | extern int no_sync_cmos_clock __read_mostly; |
100 | void timekeeping_init(void); | 100 | void timekeeping_init(void); |
101 | 101 | ||
102 | static inline unsigned long get_seconds(void) | 102 | unsigned long get_seconds(void); |
103 | { | ||
104 | return xtime.tv_sec; | ||
105 | } | ||
106 | |||
107 | struct timespec current_kernel_time(void); | 103 | struct timespec current_kernel_time(void); |
108 | 104 | ||
109 | #define CURRENT_TIME (current_kernel_time()) | 105 | #define CURRENT_TIME (current_kernel_time()) |
110 | #define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) | 106 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) |
111 | 107 | ||
112 | extern void do_gettimeofday(struct timeval *tv); | 108 | extern void do_gettimeofday(struct timeval *tv); |
113 | extern int do_settimeofday(struct timespec *tv); | 109 | extern int do_settimeofday(struct timespec *tv); |
diff --git a/kernel/acct.c b/kernel/acct.c index 70d0d88e5554..24f0f8b2ba72 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -468,7 +468,7 @@ static void do_acct_process(struct file *file) | |||
468 | } | 468 | } |
469 | #endif | 469 | #endif |
470 | do_div(elapsed, AHZ); | 470 | do_div(elapsed, AHZ); |
471 | ac.ac_btime = xtime.tv_sec - elapsed; | 471 | ac.ac_btime = get_seconds() - elapsed; |
472 | /* we really need to bite the bullet and change layout */ | 472 | /* we really need to bite the bullet and change layout */ |
473 | ac.ac_uid = current->uid; | 473 | ac.ac_uid = current->uid; |
474 | ac.ac_gid = current->gid; | 474 | ac.ac_gid = current->gid; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index eb1ddebd2c04..c21ca6bfaa66 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -141,11 +141,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
141 | 141 | ||
142 | do { | 142 | do { |
143 | seq = read_seqbegin(&xtime_lock); | 143 | seq = read_seqbegin(&xtime_lock); |
144 | #ifdef CONFIG_NO_HZ | 144 | xts = current_kernel_time(); |
145 | getnstimeofday(&xts); | ||
146 | #else | ||
147 | xts = xtime; | ||
148 | #endif | ||
149 | tom = wall_to_monotonic; | 145 | tom = wall_to_monotonic; |
150 | } while (read_seqretry(&xtime_lock, seq)); | 146 | } while (read_seqretry(&xtime_lock, seq)); |
151 | 147 | ||
diff --git a/kernel/time.c b/kernel/time.c index 5b81da08bbdb..2289a8d68314 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -215,22 +215,6 @@ asmlinkage long sys_adjtimex(struct timex __user *txc_p) | |||
215 | return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret; | 215 | return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret; |
216 | } | 216 | } |
217 | 217 | ||
218 | inline struct timespec current_kernel_time(void) | ||
219 | { | ||
220 | struct timespec now; | ||
221 | unsigned long seq; | ||
222 | |||
223 | do { | ||
224 | seq = read_seqbegin(&xtime_lock); | ||
225 | |||
226 | now = xtime; | ||
227 | } while (read_seqretry(&xtime_lock, seq)); | ||
228 | |||
229 | return now; | ||
230 | } | ||
231 | |||
232 | EXPORT_SYMBOL(current_kernel_time); | ||
233 | |||
234 | /** | 218 | /** |
235 | * current_fs_time - Return FS time | 219 | * current_fs_time - Return FS time |
236 | * @sb: Superblock. | 220 | * @sb: Superblock. |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 88c81026e003..acc417b5a9b7 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -47,10 +47,22 @@ EXPORT_SYMBOL(xtime_lock); | |||
47 | struct timespec xtime __attribute__ ((aligned (16))); | 47 | struct timespec xtime __attribute__ ((aligned (16))); |
48 | struct timespec wall_to_monotonic __attribute__ ((aligned (16))); | 48 | struct timespec wall_to_monotonic __attribute__ ((aligned (16))); |
49 | static unsigned long total_sleep_time; /* seconds */ | 49 | static unsigned long total_sleep_time; /* seconds */ |
50 | |||
51 | EXPORT_SYMBOL(xtime); | 50 | EXPORT_SYMBOL(xtime); |
52 | 51 | ||
53 | 52 | ||
53 | #ifdef CONFIG_NO_HZ | ||
54 | static struct timespec xtime_cache __attribute__ ((aligned (16))); | ||
55 | static inline void update_xtime_cache(u64 nsec) | ||
56 | { | ||
57 | xtime_cache = xtime; | ||
58 | timespec_add_ns(&xtime_cache, nsec); | ||
59 | } | ||
60 | #else | ||
61 | #define xtime_cache xtime | ||
62 | /* We do *not* want to evaluate the argument for this case */ | ||
63 | #define update_xtime_cache(n) do { } while (0) | ||
64 | #endif | ||
65 | |||
54 | static struct clocksource *clock; /* pointer to current clocksource */ | 66 | static struct clocksource *clock; /* pointer to current clocksource */ |
55 | 67 | ||
56 | 68 | ||
@@ -478,6 +490,8 @@ void update_wall_time(void) | |||
478 | xtime.tv_nsec = (s64)clock->xtime_nsec >> clock->shift; | 490 | xtime.tv_nsec = (s64)clock->xtime_nsec >> clock->shift; |
479 | clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift; | 491 | clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift; |
480 | 492 | ||
493 | update_xtime_cache(cyc2ns(clock, offset)); | ||
494 | |||
481 | /* check to see if there is a new clocksource to use */ | 495 | /* check to see if there is a new clocksource to use */ |
482 | change_clocksource(); | 496 | change_clocksource(); |
483 | update_vsyscall(&xtime, clock); | 497 | update_vsyscall(&xtime, clock); |
@@ -509,3 +523,25 @@ void monotonic_to_bootbased(struct timespec *ts) | |||
509 | { | 523 | { |
510 | ts->tv_sec += total_sleep_time; | 524 | ts->tv_sec += total_sleep_time; |
511 | } | 525 | } |
526 | |||
527 | unsigned long get_seconds(void) | ||
528 | { | ||
529 | return xtime_cache.tv_sec; | ||
530 | } | ||
531 | EXPORT_SYMBOL(get_seconds); | ||
532 | |||
533 | |||
534 | struct timespec current_kernel_time(void) | ||
535 | { | ||
536 | struct timespec now; | ||
537 | unsigned long seq; | ||
538 | |||
539 | do { | ||
540 | seq = read_seqbegin(&xtime_lock); | ||
541 | |||
542 | now = xtime_cache; | ||
543 | } while (read_seqretry(&xtime_lock, seq)); | ||
544 | |||
545 | return now; | ||
546 | } | ||
547 | EXPORT_SYMBOL(current_kernel_time); | ||
diff --git a/kernel/tsacct.c b/kernel/tsacct.c index 658f638c402c..c122131a122f 100644 --- a/kernel/tsacct.c +++ b/kernel/tsacct.c | |||
@@ -39,7 +39,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk) | |||
39 | ac_etime = timespec_to_ns(&ts); | 39 | ac_etime = timespec_to_ns(&ts); |
40 | do_div(ac_etime, NSEC_PER_USEC); | 40 | do_div(ac_etime, NSEC_PER_USEC); |
41 | stats->ac_etime = ac_etime; | 41 | stats->ac_etime = ac_etime; |
42 | stats->ac_btime = xtime.tv_sec - ts.tv_sec; | 42 | stats->ac_btime = get_seconds() - ts.tv_sec; |
43 | if (thread_group_leader(tsk)) { | 43 | if (thread_group_leader(tsk)) { |
44 | stats->ac_exitcode = tsk->exit_code; | 44 | stats->ac_exitcode = tsk->exit_code; |
45 | if (tsk->flags & PF_FORKNOEXEC) | 45 | if (tsk->flags & PF_FORKNOEXEC) |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 16a68df4e36b..c58fa0d1be26 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -787,7 +787,7 @@ static int __init af_rxrpc_init(void) | |||
787 | 787 | ||
788 | BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof(dummy_skb->cb)); | 788 | BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof(dummy_skb->cb)); |
789 | 789 | ||
790 | rxrpc_epoch = htonl(xtime.tv_sec); | 790 | rxrpc_epoch = htonl(get_seconds()); |
791 | 791 | ||
792 | ret = -ENOMEM; | 792 | ret = -ENOMEM; |
793 | rxrpc_call_jar = kmem_cache_create( | 793 | rxrpc_call_jar = kmem_cache_create( |
diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c index 482750efc235..372b24466dc7 100644 --- a/net/rxrpc/ar-connection.c +++ b/net/rxrpc/ar-connection.c | |||
@@ -791,7 +791,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn) | |||
791 | 791 | ||
792 | ASSERTCMP(atomic_read(&conn->usage), >, 0); | 792 | ASSERTCMP(atomic_read(&conn->usage), >, 0); |
793 | 793 | ||
794 | conn->put_time = xtime.tv_sec; | 794 | conn->put_time = get_seconds(); |
795 | if (atomic_dec_and_test(&conn->usage)) { | 795 | if (atomic_dec_and_test(&conn->usage)) { |
796 | _debug("zombie"); | 796 | _debug("zombie"); |
797 | rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0); | 797 | rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0); |
@@ -835,7 +835,7 @@ void rxrpc_connection_reaper(struct work_struct *work) | |||
835 | 835 | ||
836 | _enter(""); | 836 | _enter(""); |
837 | 837 | ||
838 | now = xtime.tv_sec; | 838 | now = get_seconds(); |
839 | earliest = ULONG_MAX; | 839 | earliest = ULONG_MAX; |
840 | 840 | ||
841 | write_lock_bh(&rxrpc_connection_lock); | 841 | write_lock_bh(&rxrpc_connection_lock); |
diff --git a/net/rxrpc/ar-transport.c b/net/rxrpc/ar-transport.c index d43d78f19302..bb282a6a19f0 100644 --- a/net/rxrpc/ar-transport.c +++ b/net/rxrpc/ar-transport.c | |||
@@ -183,7 +183,7 @@ void rxrpc_put_transport(struct rxrpc_transport *trans) | |||
183 | 183 | ||
184 | ASSERTCMP(atomic_read(&trans->usage), >, 0); | 184 | ASSERTCMP(atomic_read(&trans->usage), >, 0); |
185 | 185 | ||
186 | trans->put_time = xtime.tv_sec; | 186 | trans->put_time = get_seconds(); |
187 | if (unlikely(atomic_dec_and_test(&trans->usage))) | 187 | if (unlikely(atomic_dec_and_test(&trans->usage))) |
188 | _debug("zombie"); | 188 | _debug("zombie"); |
189 | /* let the reaper determine the timeout to avoid a race with | 189 | /* let the reaper determine the timeout to avoid a race with |
@@ -219,7 +219,7 @@ static void rxrpc_transport_reaper(struct work_struct *work) | |||
219 | 219 | ||
220 | _enter(""); | 220 | _enter(""); |
221 | 221 | ||
222 | now = xtime.tv_sec; | 222 | now = get_seconds(); |
223 | earliest = ULONG_MAX; | 223 | earliest = ULONG_MAX; |
224 | 224 | ||
225 | /* extract all the transports that have been dead too long */ | 225 | /* extract all the transports that have been dead too long */ |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index 5ec705144e10..ac3cabdca78c 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -916,7 +916,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn, | |||
916 | issue = be32_to_cpu(stamp); | 916 | issue = be32_to_cpu(stamp); |
917 | } | 917 | } |
918 | p += 4; | 918 | p += 4; |
919 | now = xtime.tv_sec; | 919 | now = get_seconds(); |
920 | _debug("KIV ISSUE: %lx [%lx]", issue, now); | 920 | _debug("KIV ISSUE: %lx [%lx]", issue, now); |
921 | 921 | ||
922 | /* check the ticket is in date */ | 922 | /* check the ticket is in date */ |