summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-08-17 13:55:57 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-08-17 13:56:13 -0400
commit0b9c58384fb92389f0fb2e955a2e950295591950 (patch)
tree44b021ed8b572309b619a8d476d87a8c5431bb6e
parent3e03049f76aadbce491c434ccd25497a5c28238b (diff)
downloadlongterm-queue-2.6.34-0b9c58384fb92389f0fb2e955a2e950295591950.tar.gz
add ntp STA_INS_DEL fix
Herton notes: ------ > commit 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d upstream. > > This should have been backported when it was commited, but I > mistook the problem as requiring the ntp_lock changes > that landed in 3.4 in order for it to occur. > > Unfortunately the same issue can happen (with only one cpu) > as follows: > do_adjtimex() > write_seqlock_irq(&xtime_lock); > process_adjtimex_modes() > process_adj_status() > ntp_start_leap_timer() > hrtimer_start() > hrtimer_reprogram() > tick_program_event() > clockevents_program_event() > ktime_get() > seq = req_seqbegin(xtime_lock); [DEADLOCK] > > This deadlock will no always occur, as it requires the > leap_timer to force a hrtimer_reprogram which only happens > if its set and there's no sooner timer to expire. [...] I remember this came through the leapsecond deadlock & hrtimer/futex issue fixes. But I noted now commit 6b1859dba01c7d512b72d77e3fd7da8354235189 ("ntp: Fix STA_INS/DEL clearing bug") was not included, and its changelog says it fixes a problem introduced with this. Wouldn't it be worth/right to also include it in 2.6.34? I didn't test etc., just detected through the changelog/description but would expect it would be affected too. I also noted it is missing from 3.2.y and 2.6.32.y stables, and perhaps should be scheduled for inclusion in their cases too. ------ JohnS also agreed this should be incorporated, and mentioned a pending -tip commit should be considered once it is mainline. Reported-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/ntp-Fix-STA_INS-DEL-clearing-bug.patch56
-rw-r--r--queue/series1
2 files changed, 57 insertions, 0 deletions
diff --git a/queue/ntp-Fix-STA_INS-DEL-clearing-bug.patch b/queue/ntp-Fix-STA_INS-DEL-clearing-bug.patch
new file mode 100644
index 0000000..739215e
--- /dev/null
+++ b/queue/ntp-Fix-STA_INS-DEL-clearing-bug.patch
@@ -0,0 +1,56 @@
+From 6b1859dba01c7d512b72d77e3fd7da8354235189 Mon Sep 17 00:00:00 2001
+From: John Stultz <johnstul@us.ibm.com>
+Date: Fri, 13 Jul 2012 01:21:50 -0400
+Subject: [PATCH] ntp: Fix STA_INS/DEL clearing bug
+
+commit 6b1859dba01c7d512b72d77e3fd7da8354235189 upstream.
+
+In commit 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d, I
+introduced a bug that kept the STA_INS or STA_DEL bit
+from being cleared from time_status via adjtimex()
+without forcing STA_PLL first.
+
+Usually once the STA_INS is set, it isn't cleared
+until the leap second is applied, so its unlikely this
+affected anyone. However during testing I noticed it
+took some effort to cancel a leap second once STA_INS
+was set.
+
+Signed-off-by: John Stultz <johnstul@us.ibm.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Cc: Richard Cochran <richardcochran@gmail.com>
+Cc: Prarit Bhargava <prarit@redhat.com>
+CC: stable@vger.kernel.org # 3.4
+Link: http://lkml.kernel.org/r/1342156917-25092-2-git-send-email-john.stultz@linaro.org
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+
+diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
+index 70b33ab..b7fbadc 100644
+--- a/kernel/time/ntp.c
++++ b/kernel/time/ntp.c
+@@ -409,7 +409,9 @@ int second_overflow(unsigned long secs)
+ time_state = TIME_DEL;
+ break;
+ case TIME_INS:
+- if (secs % 86400 == 0) {
++ if (!(time_status & STA_INS))
++ time_state = TIME_OK;
++ else if (secs % 86400 == 0) {
+ leap = -1;
+ time_state = TIME_OOP;
+ time_tai++;
+@@ -418,7 +420,9 @@ int second_overflow(unsigned long secs)
+ }
+ break;
+ case TIME_DEL:
+- if ((secs + 1) % 86400 == 0) {
++ if (!(time_status & STA_DEL))
++ time_state = TIME_OK;
++ else if ((secs + 1) % 86400 == 0) {
+ leap = 1;
+ time_tai--;
+ time_state = TIME_WAIT;
+--
+1.7.12.rc2
+
diff --git a/queue/series b/queue/series
index 3eeab94..9b07bf1 100644
--- a/queue/series
+++ b/queue/series
@@ -113,6 +113,7 @@ ACPI-AC-prevent-OOPS-on-some-boxes-due-to-missing-ch.patch
#leapsecond
ntp-Fix-leap-second-hrtimer-livelock.patch
ntp-Correct-TAI-offset-during-leap-second.patch
+ntp-Fix-STA_INS-DEL-clearing-bug.patch
timekeeping-Fix-CLOCK_MONOTONIC-inconsistency-during.patch
time-Move-common-updates-to-a-function.patch
hrtimer-Provide-clock_was_set_delayed.patch