Skip to contentSkip to conversation

timekeeping: Make sure to notify hrtimers when TAI offset changes

PATCH New John Stultz 2 participants 2 messages Apr 10, 2013 – Apr 11, 2013 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timekeeping: Make sure to notify hrtimers when TAI offset changes

Hey Thomas, here's a bugfix I just caught with my 3.10 queue. Mind adding this to tip/timers/core?

thanks
-john

Now that we have CLOCK_TAI timers, make sure we notify hrtimer code when TAI offset is changed.

Cc Thomas Gleixner <[email protected]>
---
 kernel/time/timekeeping.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/time/timekeeping.c +7 -3
index c4d2a87..675f720 100644
@@ -607,6 +607,7 @@ void timekeeping_set_tai_offset(s32 tai_offset)
 	__timekeeping_set_tai_offset(tk, tai_offset);
 	write_seqcount_end(&timekeeper_seq);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
+	clock_was_set();
 }
 
 /**
@@ -1639,7 +1640,7 @@ int do_adjtimex(struct timex *txc)
 	struct timekeeper *tk = &timekeeper;
 	unsigned long flags;
 	struct timespec ts;
-	s32 tai;
+	s32 orig_tai, tai;
 	int ret;
 
 	/* Validate the data before disabling interrupts */
@@ -1663,10 +1664,13 @@ int do_adjtimex(struct timex *txc)
 	raw_spin_lock_irqsave(&timekeeper_lock, flags);
 	write_seqcount_begin(&timekeeper_seq);
 
-	tai = tk->tai_offset;
+	orig_tai = tai = tk->tai_offset;
 	ret = __do_adjtimex(txc, &ts, &tai);
 
-	__timekeeping_set_tai_offset(tk, tai);
+	if (tai != orig_tai) {
+		__timekeeping_set_tai_offset(tk, tai);
+		clock_was_set_delayed();
+	}
 	write_seqcount_end(&timekeeper_seq);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
 
Signature · 1 line
1.7.10.4
#1 lore raw
timekeeping: Make sure to notify hrtimers when TAI offset changes
Commit-ID:  4e8f8b34b92b6514cc070aeb94d317cadd5071d7
Gitweb:     http://git.kernel.org/tip/4e8f8b34b92b6514cc070aeb94d317cadd5071d7
Author:     John Stultz <[email protected]>
AuthorDate: Wed, 10 Apr 2013 12:41:49 -0700
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 11 Apr 2013 10:19:44 +0200

timekeeping: Make sure to notify hrtimers when TAI offset changes

Now that we have CLOCK_TAI timers, make sure we notify hrtimer code when TAI offset is changed.

---
 kernel/time/timekeeping.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/time/timekeeping.c +7 -3
index c4d2a87..675f720 100644
@@ -607,6 +607,7 @@ void timekeeping_set_tai_offset(s32 tai_offset)
 	__timekeeping_set_tai_offset(tk, tai_offset);
 	write_seqcount_end(&timekeeper_seq);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
+	clock_was_set();
 }
 
 /**
@@ -1639,7 +1640,7 @@ int do_adjtimex(struct timex *txc)
 	struct timekeeper *tk = &timekeeper;
 	unsigned long flags;
 	struct timespec ts;
-	s32 tai;
+	s32 orig_tai, tai;
 	int ret;
 
 	/* Validate the data before disabling interrupts */
@@ -1663,10 +1664,13 @@ int do_adjtimex(struct timex *txc)
 	raw_spin_lock_irqsave(&timekeeper_lock, flags);
 	write_seqcount_begin(&timekeeper_seq);
 
-	tai = tk->tai_offset;
+	orig_tai = tai = tk->tai_offset;
 	ret = __do_adjtimex(txc, &ts, &tai);
 
-	__timekeeping_set_tai_offset(tk, tai);
+	if (tai != orig_tai) {
+		__timekeeping_set_tai_offset(tk, tai);
+		clock_was_set_delayed();
+	}
 	write_seqcount_end(&timekeeper_seq);
 	raw_spin_unlock_irqrestore(&timekeeper_lock, flags);