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>
This commit is contained in:
parent
066361a7c5
commit
a6c0c943a1
|
@ -22,7 +22,7 @@
|
||||||
* NTP timekeeping variables:
|
* NTP timekeeping variables:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE_SPINLOCK(ntp_lock);
|
DEFINE_RAW_SPINLOCK(ntp_lock);
|
||||||
|
|
||||||
|
|
||||||
/* USER_HZ period (usecs): */
|
/* USER_HZ period (usecs): */
|
||||||
|
@ -347,7 +347,7 @@ void ntp_clear(void)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&ntp_lock, flags);
|
raw_spin_lock_irqsave(&ntp_lock, flags);
|
||||||
|
|
||||||
time_adjust = 0; /* stop active adjtime() */
|
time_adjust = 0; /* stop active adjtime() */
|
||||||
time_status |= STA_UNSYNC;
|
time_status |= STA_UNSYNC;
|
||||||
|
@ -361,7 +361,7 @@ void ntp_clear(void)
|
||||||
|
|
||||||
/* Clear PPS state variables */
|
/* Clear PPS state variables */
|
||||||
pps_clear();
|
pps_clear();
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,9 +371,9 @@ u64 ntp_tick_length(void)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
s64 ret;
|
s64 ret;
|
||||||
|
|
||||||
spin_lock_irqsave(&ntp_lock, flags);
|
raw_spin_lock_irqsave(&ntp_lock, flags);
|
||||||
ret = tick_length;
|
ret = tick_length;
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ int second_overflow(unsigned long secs)
|
||||||
int leap = 0;
|
int leap = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&ntp_lock, flags);
|
raw_spin_lock_irqsave(&ntp_lock, flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Leap second processing. If in leap-insert state at the end of the
|
* Leap second processing. If in leap-insert state at the end of the
|
||||||
|
@ -478,7 +478,7 @@ int second_overflow(unsigned long secs)
|
||||||
time_adjust = 0;
|
time_adjust = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
|
|
||||||
return leap;
|
return leap;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ int do_adjtimex(struct timex *txc)
|
||||||
|
|
||||||
getnstimeofday(&ts);
|
getnstimeofday(&ts);
|
||||||
|
|
||||||
spin_lock_irq(&ntp_lock);
|
raw_spin_lock_irq(&ntp_lock);
|
||||||
|
|
||||||
if (txc->modes & ADJ_ADJTIME) {
|
if (txc->modes & ADJ_ADJTIME) {
|
||||||
long save_adjust = time_adjust;
|
long save_adjust = time_adjust;
|
||||||
|
@ -702,7 +702,7 @@ int do_adjtimex(struct timex *txc)
|
||||||
/* fill PPS status fields */
|
/* fill PPS status fields */
|
||||||
pps_fill_timex(txc);
|
pps_fill_timex(txc);
|
||||||
|
|
||||||
spin_unlock_irq(&ntp_lock);
|
raw_spin_unlock_irq(&ntp_lock);
|
||||||
|
|
||||||
txc->time.tv_sec = ts.tv_sec;
|
txc->time.tv_sec = ts.tv_sec;
|
||||||
txc->time.tv_usec = ts.tv_nsec;
|
txc->time.tv_usec = ts.tv_nsec;
|
||||||
|
@ -900,7 +900,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
|
||||||
|
|
||||||
pts_norm = pps_normalize_ts(*phase_ts);
|
pts_norm = pps_normalize_ts(*phase_ts);
|
||||||
|
|
||||||
spin_lock_irqsave(&ntp_lock, flags);
|
raw_spin_lock_irqsave(&ntp_lock, flags);
|
||||||
|
|
||||||
/* clear the error bits, they will be set again if needed */
|
/* clear the error bits, they will be set again if needed */
|
||||||
time_status &= ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR);
|
time_status &= ~(STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR);
|
||||||
|
@ -913,7 +913,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
|
||||||
* just start the frequency interval */
|
* just start the frequency interval */
|
||||||
if (unlikely(pps_fbase.tv_sec == 0)) {
|
if (unlikely(pps_fbase.tv_sec == 0)) {
|
||||||
pps_fbase = *raw_ts;
|
pps_fbase = *raw_ts;
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
|
||||||
time_status |= STA_PPSJITTER;
|
time_status |= STA_PPSJITTER;
|
||||||
/* restart the frequency calibration interval */
|
/* restart the frequency calibration interval */
|
||||||
pps_fbase = *raw_ts;
|
pps_fbase = *raw_ts;
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
pr_err("hardpps: PPSJITTER: bad pulse\n");
|
pr_err("hardpps: PPSJITTER: bad pulse\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ void hardpps(const struct timespec *phase_ts, const struct timespec *raw_ts)
|
||||||
|
|
||||||
hardpps_update_phase(pts_norm.nsec);
|
hardpps_update_phase(pts_norm.nsec);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&ntp_lock, flags);
|
raw_spin_unlock_irqrestore(&ntp_lock, flags);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(hardpps);
|
EXPORT_SYMBOL(hardpps);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue