]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/time/timekeeping.c
sched_clock: prevent scd->clock from moving backwards, take #2
[karo-tx-linux.git] / kernel / time / timekeeping.c
index e91c29f961c900d7739c0dc2f27b81c480cdb55c..4220a2e1faab0144bff2b3d6fd515551ca92451a 100644 (file)
@@ -46,6 +46,9 @@ struct timespec xtime __attribute__ ((aligned (16)));
 struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
 static unsigned long total_sleep_time;         /* seconds */
 
+/* flag for if timekeeping is suspended */
+int __read_mostly timekeeping_suspended;
+
 static struct timespec xtime_cache __attribute__ ((aligned (16)));
 void update_xtime_cache(u64 nsec)
 {
@@ -92,6 +95,8 @@ void getnstimeofday(struct timespec *ts)
        unsigned long seq;
        s64 nsecs;
 
+       WARN_ON(timekeeping_suspended);
+
        do {
                seq = read_seqbegin(&xtime_lock);
 
@@ -261,8 +266,6 @@ void __init timekeeping_init(void)
        write_sequnlock_irqrestore(&xtime_lock, flags);
 }
 
-/* flag for if timekeeping is suspended */
-static int timekeeping_suspended;
 /* time in seconds when suspend began */
 static unsigned long timekeeping_suspend_time;
 /* xtime offset when we went into suspend */