aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-04-10 05:14:55 -0400
committerIngo Molnar <mingo@kernel.org>2013-02-19 02:43:16 -0500
commita6c0c943a15d0b3d6ac33760cb8f95c75f395895 (patch)
tree0aa3e39340a97d865a3ce9c4f79e2ac3a389ef04 /kernel
parent066361a7c58cb6c8b18c7ce0ee8527bb1ce58460 (diff)
ntp: Make ntp_lock raw
seconds_overflow() is called from hard interrupt context even on Preempt-RT. This requires the lock to be a raw_spinlock. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/ntp.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 24174b4d669b..bb1edfaafe3d 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -22,7 +22,7 @@
22 * NTP timekeeping variables: 22 * NTP timekeeping variables:
23 */ 23 */
24 24
25DEFINE_SPINLOCK(ntp_lock); 25DEFINE_RAW_SPINLOCK(ntp_lock);
26 26
27 27
28/* USER_HZ period (usecs): */ 28/* USER_HZ period (usecs): */
@@ -347,7 +347,7 @@ void ntp_clear(void)
347{ 347{
348 unsigned long flags; 348 unsigned long flags;
349 349
350 spin_lock_irqsave(&ntp_lock, flags); 350 raw_spin_lock_irqsave(&ntp_lock, flags);
351 351
352 time_adjust = 0; /* stop active adjtime() */ 352 time_adjust = 0; /* stop active adjtime() */
353 time_status |= STA_UNSYNC; 353 time_status |= STA_UNSYNC;
@@ -361,7 +361,7 @@ void ntp_clear(void)
361 361
362 /* Clear PPS state variables */ 362 /* Clear PPS state variables */
363 pps_clear(); 363 pps_clear();
364 spin_unlock_irqrestore(&ntp_lock, flags); 364 raw_spin_unlock_irqrestore(&ntp_lock, flags);
365 365
366} 366}
367 367
@@ -371,9 +371,9 @@ u64 ntp_tick_length(void)
371 unsigned long flags; 371 unsigned long flags;
372 s64 ret; 372 s64 ret;
373 373
374 spin_lock_irqsave(&ntp_lock, flags); 374 raw_spin_lock_irqsave(&ntp_lock, flags);
375 ret = tick_length; 375 ret = tick_length;
376 spin_unlock_irqrestore(&ntp_lock, flags); 376 raw_spin_unlock_irqrestore(&ntp_lock, flags);
377 return ret; 377 return ret;
378} 378}
379 379
@@ -394,7 +394,7 @@ int second_overflow(unsigned long secs)
394 int leap = 0; 394 int leap = 0;
395 unsigned long flags; 395 unsigned long flags;
396 396
397 spin_lock_irqsave(&ntp_lock, flags); 397 raw_spin_lock_irqsave(&ntp_lock, flags);
398 398
399 /* 399 /*
400 * Leap second processing. If in leap-insert state at the end of the 400 * Leap second processing. If in leap-insert state at the end of the
@@ -478,7 +478,7 @@ int second_overflow(unsigned long secs)
478 time_adjust = 0; 478 time_adjust = 0;
479 479
480out: 480out:
481 spin_unlock_irqrestore(&ntp_lock, flags); 481 raw_spin_unlock_irqrestore(&ntp_lock, flags);
482 482
483 return leap; 483 return leap;
484} 484}
@@ -660,7 +660,7 @@ int do_adjtimex(struct timex *txc)
660 660
661 getnstimeofday(&ts); 661 getnstimeofday(&ts);
662 662
663 spin_lock_irq(&ntp_lock); 663 raw_spin_lock_irq(&ntp_lock);
664 664
665 if (txc->modes & ADJ_ADJTIME) { 665 if (txc->modes & ADJ_ADJTIME) {
666 long save_adjust = time_adjust; 666 long save_adjust = time_adjust;
@@ -702,7 +702,7 @@ int do_adjtimex(struct timex *txc)
702 /* fill PPS status fields */ 702 /* fill PPS status fields */
703 pps_fill_timex(txc); 703 pps_fill_timex(txc);
704 704
705 spin_unlock_irq(&ntp_lock); 705 raw_spin_unlock_irq(&ntp_lock);
706 706
707 txc->time.tv_sec = ts.tv_sec; 707 txc->time.tv_sec = ts.tv_sec;
708 txc->time.tv_usec = ts.tv_nsec; 708 txc->time.tv_usec = ts.tv_nsec;
@@ -900,7 +900,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
900 900
901 pts_norm = pps_normalize_ts(*phase_ts); 901 pts_norm = pps_normalize_ts(*phase_ts);
902 902
903 spin_lock_irqsave(&ntp_lock, flags); 903 raw_spin_lock_irqsave(&ntp_lock, flags);
904 904
905 /* clear the error bits, they will be set again if needed */ 905 /* clear the error bits, they will be set again if needed */
906 time_status &= ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR); 906 time_status &= ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR);
@@ -913,7 +913,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
913 * just start the frequency interval */ 913 * just start the frequency interval */
914 if (unlikely(pps_fbase.tv_sec == 0)) { 914 if (unlikely(pps_fbase.tv_sec == 0)) {
915 pps_fbase = *raw_ts; 915 pps_fbase = *raw_ts;
916 spin_unlock_irqrestore(&ntp_lock, flags); 916 raw_spin_unlock_irqrestore(&ntp_lock, flags);
917 return; 917 return;
918 } 918 }
919 919
@@ -928,7 +928,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
928 time_status |= STA_PPSJITTER; 928 time_status |= STA_PPSJITTER;
929 /* restart the frequency calibration interval */ 929 /* restart the frequency calibration interval */
930 pps_fbase = *raw_ts; 930 pps_fbase = *raw_ts;
931 spin_unlock_irqrestore(&ntp_lock, flags); 931 raw_spin_unlock_irqrestore(&ntp_lock, flags);
932 pr_err("hardpps: PPSJITTER: bad pulse\n"); 932 pr_err("hardpps: PPSJITTER: bad pulse\n");
933 return; 933 return;
934 } 934 }
@@ -945,7 +945,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
945 945
946 hardpps_update_phase(pts_norm.nsec); 946 hardpps_update_phase(pts_norm.nsec);
947 947
948 spin_unlock_irqrestore(&ntp_lock, flags); 948 raw_spin_unlock_irqrestore(&ntp_lock, flags);
949} 949}
950EXPORT_SYMBOL(hardpps); 950EXPORT_SYMBOL(hardpps);
951 951