Skip to contentSkip to conversation

Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #3]

PATCH In review David Howells 3 participants 5 messages Feb 21, 2008 – Feb 23, 2008 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #3]

From: David Howells <[email protected]>

The kernel NTP code shouldn't hand 64-bit *signed* values to do_div(). Make it instead hand 64-bit unsigned values. This gets rid of a couple of warnings.

---

 kernel/time/ntp.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
kernel/time/ntp.c +7 -5
index c88b591..d4bca92 100644
@@ -342,14 +342,16 @@ int do_adjtimex(struct timex *txc)
 		    freq_adj = shift_right(freq_adj, time_constant * 2 +
 					   (SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
 		    if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
+			u64 utemp64;
 			temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
 			if (time_offset < 0) {
-			    temp64 = -temp64;
-			    do_div(temp64, mtemp);
-			    freq_adj -= temp64;
+			    utemp64 = -temp64;
+			    do_div(utemp64, mtemp);
+			    freq_adj -= utemp64;
 			} else {
-			    do_div(temp64, mtemp);
-			    freq_adj += temp64;
+			    utemp64 = temp64;
+			    do_div(utemp64, mtemp);
+			    freq_adj += utemp64;
 			}
 		    }
 		    freq_adj += time_freq;
#1 lore raw
Quoted 4 lines · On Thu, 21 Feb 2008 16:50:35 +0000 David Howells <[email protected]> wrote:

From: David Howells <[email protected]>

The kernel NTP code shouldn't hand 64-bit *signed* values to do_div(). Make it instead hand 64-bit unsigned values. This gets rid of a couple of warnings.

On certain architectures. It would have bene nice to mention what those architectures are, and to quote the warnings. Next time, please ;)

Quoted 4 lines

---

 kernel/time/ntp.c |   12 +++++++-----

Thomas, do you consider ntp to fall under git-hrt?

#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Thu, 21 Feb 2008 16:50:35 +0000 David Howells <[email protected]> wrote:

From: David Howells <[email protected]>

The kernel NTP code shouldn't hand 64-bit *signed* values to do_div(). Make it instead hand 64-bit unsigned values. This gets rid of a couple of warnings.

On certain architectures. It would have bene nice to mention what those architectures are, and to quote the warnings. Next time, please ;)

Quoted 6 lines
Quoted 4 lines

---

 kernel/time/ntp.c |   12 +++++++-----

Thomas, do you consider ntp to fall under git-hrt?

I'll pick it up.

Thanks,

tglx

#3 lore raw
Quoted 12 lines · On Sat, 23 Feb 2008 22:01:55 +0100 (CET) Thomas Gleixner <[email protected]>…
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Thu, 21 Feb 2008 16:50:35 +0000 David Howells <[email protected]> wrote:

From: David Howells <[email protected]>

The kernel NTP code shouldn't hand 64-bit *signed* values to do_div(). Make it instead hand 64-bit unsigned values. This gets rid of a couple of warnings.

On certain architectures. It would have bene nice to mention what those architectures are, and to quote the warnings. Next time, please ;)

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

---

 kernel/time/ntp.c |   12 +++++++-----

Thomas, do you consider ntp to fall under git-hrt?

I'll pick it up.

OK. And this is still git+ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git#mm, yes?

Can we please define the scope of that tree?

Please review

fix-shadowed-variables-in-kernel-posix-cpu-timersc.patch timers-simplify-lockdep-stuff.patch hrtimers-simplify-lockdep-stuff.patch kill-double_spin_lock.patch ntp-make-the-kernel-ntp-code-hand-64-bit-unsigned-values-to-do_div.patch

from http://userweb.kernel.org/~akpm/mmotm/broken-out/. I think they're all probably git-hrt material.

Can we get that tree into linux-next too please?

#4 lore raw
Quoted 7 lines · Andrew Morton
Quoted 4 lines
Quoted 1 line

Thomas, do you consider ntp to fall under git-hrt?

I'll pick it up.

OK. And this is still git+ssh://master.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt.git#mm, yes?

Yes

Quoted 1 line

Can we please define the scope of that tree?

Primary scope is hrtimer, posixtimer, clockevents & Co.

In the last month I fed a lot of timekeeping/ntp stuff via -hrt as well. If there is no objection, I'm happy to provide the sink for those.

Quoted 10 lines

Please review

fix-shadowed-variables-in-kernel-posix-cpu-timersc.patch timers-simplify-lockdep-stuff.patch hrtimers-simplify-lockdep-stuff.patch kill-double_spin_lock.patch ntp-make-the-kernel-ntp-code-hand-64-bit-unsigned-values-to-do_div.patch

from http://userweb.kernel.org/~akpm/mmotm/broken-out/. I think they're all probably git-hrt material.

Will do tomorrow, when I'm more awake.

Quoted 1 line

Can we get that tree into linux-next too please?

Will contact Stephen.

Thanks,

tglx