aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/time.h3
-rw-r--r--kernel/hrtimer.c9
-rw-r--r--kernel/time/timekeeping.c5
3 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index 9072df83de1f..a57e0f67b3d0 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -126,7 +126,8 @@ extern int timekeeping_suspended;
126 126
127unsigned long get_seconds(void); 127unsigned long get_seconds(void);
128struct timespec current_kernel_time(void); 128struct timespec current_kernel_time(void);
129struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ 129struct timespec __current_kernel_time(void); /* does not take xtime_lock */
130struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
130struct timespec get_monotonic_coarse(void); 131struct timespec get_monotonic_coarse(void);
131 132
132#define CURRENT_TIME (current_kernel_time()) 133#define CURRENT_TIME (current_kernel_time())
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 5c69e996bd0f..809f48c70553 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -90,7 +90,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
90 do { 90 do {
91 seq = read_seqbegin(&xtime_lock); 91 seq = read_seqbegin(&xtime_lock);
92 xts = __current_kernel_time(); 92 xts = __current_kernel_time();
93 tom = wall_to_monotonic; 93 tom = __get_wall_to_monotonic();
94 } while (read_seqretry(&xtime_lock, seq)); 94 } while (read_seqretry(&xtime_lock, seq));
95 95
96 xtim = timespec_to_ktime(xts); 96 xtim = timespec_to_ktime(xts);
@@ -612,7 +612,7 @@ static int hrtimer_reprogram(struct hrtimer *timer,
612static void retrigger_next_event(void *arg) 612static void retrigger_next_event(void *arg)
613{ 613{
614 struct hrtimer_cpu_base *base; 614 struct hrtimer_cpu_base *base;
615 struct timespec realtime_offset; 615 struct timespec realtime_offset, wtm;
616 unsigned long seq; 616 unsigned long seq;
617 617
618 if (!hrtimer_hres_active()) 618 if (!hrtimer_hres_active())
@@ -620,10 +620,9 @@ static void retrigger_next_event(void *arg)
620 620
621 do { 621 do {
622 seq = read_seqbegin(&xtime_lock); 622 seq = read_seqbegin(&xtime_lock);
623 set_normalized_timespec(&realtime_offset, 623 wtm = __get_wall_to_monotonic();
624 -wall_to_monotonic.tv_sec,
625 -wall_to_monotonic.tv_nsec);
626 } while (read_seqretry(&xtime_lock, seq)); 624 } while (read_seqretry(&xtime_lock, seq));
625 set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);
627 626
628 base = &__get_cpu_var(hrtimer_bases); 627 base = &__get_cpu_var(hrtimer_bases);
629 628
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index b15c3acafd5a..fb61c2ed3660 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -858,6 +858,11 @@ struct timespec __current_kernel_time(void)
858 return xtime; 858 return xtime;
859} 859}
860 860
861struct timespec __get_wall_to_monotonic(void)
862{
863 return wall_to_monotonic;
864}
865
861struct timespec current_kernel_time(void) 866struct timespec current_kernel_time(void)
862{ 867{
863 struct timespec now; 868 struct timespec now;