Skip to contentSkip to conversation

rt,mce: fix mce timer interval

PATCH In review Mike Galbraith 2 participants 2 messages May 29, 2013 – May 31, 2013 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt,mce: fix mce timer interval

Seems mce timer fire at the wrong frequency in -rt kernels since roughly forever due to 32 bit overflow. 3.8-rt is also missing a multiplier.

Add missing us -> ns conversion and 32 bit overflow prevention.

---
 arch/x86/kernel/cpu/mcheck/mce.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +3 -3
@@ -1295,7 +1295,7 @@ static enum hrtimer_restart mce_timer_fn
 	__this_cpu_write(mce_next_interval, iv);
 	/* Might have become 0 after CMCI storm subsided */
 	if (iv) {
-		hrtimer_forward_now(timer, ns_to_ktime(jiffies_to_usecs(iv)));
+		hrtimer_forward_now(timer, ns_to_ktime((u64)jiffies_to_usecs(iv) * 1000));
 		return HRTIMER_RESTART;
 	}
 	return HRTIMER_NORESTART;
@@ -1323,7 +1323,7 @@ void mce_timer_kick(unsigned long interv
 		}
 	} else {
 		hrtimer_start_range_ns(t,
-				ns_to_ktime(jiffies_to_usecs(interval) * 1000),
+				ns_to_ktime((u64)jiffies_to_usecs(interval) * 1000),
 				0, HRTIMER_MODE_REL_PINNED);
 	}
 	if (interval < iv)
@@ -1691,7 +1691,7 @@ static void mce_start_timer(unsigned int
 	if (mca_cfg.ignore_ce || !iv)
 		return;
 
-	hrtimer_start_range_ns(t, ns_to_ktime(jiffies_to_usecs(iv) * 1000),
+	hrtimer_start_range_ns(t, ns_to_ktime((u64)jiffies_to_usecs(iv) * 1000),
 			0, HRTIMER_MODE_REL_PINNED);
 }
 
#1 lore raw
Quoted 6 lines · Mike Galbraith

Seems mce timer fire at the wrong frequency in -rt kernels since roughly forever due to 32 bit overflow. 3.8-rt is also missing a multiplier.

Add missing us -> ns conversion and 32 bit overflow prevention.

Thank you. I replaced (u64) cast by adding ULL to the numeric value.

Sebastian