Skip to contentSkip to conversation

jiffies: Revert mistaken conversion of NSEC_PER_SEC to TICK_NSEC

PATCH New Frederic Weisbecker 2 participants 2 messages Mar 7, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jiffies: Revert mistaken conversion of NSEC_PER_SEC to TICK_NSEC

The following commit:

	93825f2ec736f30e034ab7c9d56b42849c5b00da
	("jiffies: Reuse TICK_NSEC instead of NSEC_PER_JIFFY")

has introduced a wrong rename due to a confusion between NSEC_PER_JIFFY and NSEC_PER_SEC. As a result, the calculation of refined jiffies got broken, triggering lockups.

Reported-and-tested-by Meelis Roos <[email protected]>
Cc Meelis Roos <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/time/jiffies.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/jiffies.c +1 -1
index 7906b3f..4977191 100644
@@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second)
 	shift_hz += cycles_per_tick/2;
 	do_div(shift_hz, cycles_per_tick);
 	/* Calculate nsec_per_tick using shift_hz */
-	nsec_per_tick = (u64)TICK_NSEC << 8;
+	nsec_per_tick = (u64)NSEC_PER_SEC << 8;
 	nsec_per_tick += (u32)shift_hz/2;
 	do_div(nsec_per_tick, (u32)shift_hz);
 
Signature · 1 line
2.7.4
#1 lore raw

[tip:timers/urgent] jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC

jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC
Commit-ID:  fa3aa7a54fe6d3abf128f13cd4bbd40eaa48fed2
Gitweb:     http://git.kernel.org/tip/fa3aa7a54fe6d3abf128f13cd4bbd40eaa48fed2
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Tue, 7 Mar 2017 10:55:34 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 7 Mar 2017 11:03:28 +0100

jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC

commit 93825f2ec736 converted NSEC_PER_SEC to TICK_NSEC because the author confused NSEC_PER_JIFFY with NSEC_PER_SEC.

As a result, the calculation of refined jiffies got broken, triggering lockups.

Fixes 93825f2ec736 ("jiffies: Reuse TICK_NSEC instead of NSEC_PER_JIFFY")
Reported-and-tested-by Meelis Roos <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 kernel/time/jiffies.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/jiffies.c +1 -1
index 7906b3f..4977191 100644
@@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second)
 	shift_hz += cycles_per_tick/2;
 	do_div(shift_hz, cycles_per_tick);
 	/* Calculate nsec_per_tick using shift_hz */
-	nsec_per_tick = (u64)TICK_NSEC << 8;
+	nsec_per_tick = (u64)NSEC_PER_SEC << 8;
 	nsec_per_tick += (u32)shift_hz/2;
 	do_div(nsec_per_tick, (u32)shift_hz);