Skip to contentSkip to conversation

2.6.18-rt7: fix more issues with 32-bit cycles_t in latency_trace.c

PATCH In review Sergei Shtylyov 1 participant 2 messages Nov 12, 2006 – Nov 13, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6.18-rt7: fix more issues with 32-bit cycles_t in latency_trace.c

In addition to clock wrap check being falsely triggered with 32-bit cycles_t, as noticed to Kevin Hilman, there's another issue: using %Lx format to print 32-bit values warrants erroneous values on 32-bit machines like ARM and PPC32.

---
PPC32 actually has 64-bit timebase counter, so could provide for 64-bit cycles_t -- maybe it's worth to rewrite get_cycles() to read both lower and upper registers?

kernel/latency_trace.c +2 -2
Index: linux-2.6/kernel/latency_trace.c
===================================================================
@@ -1623,8 +1623,8 @@ check_critical_timing(int cpu, struct cp
 #ifndef CONFIG_CRITICAL_LATENCY_HIST
 	if (!preempt_thresh && preempt_max_latency > delta) {
 		printk("bug: updating %016Lx > %016Lx?\n",
-			preempt_max_latency, delta);
-		printk("  [%016Lx %016Lx %016Lx]\n", T0, T1, T2);
+			(u64)preempt_max_latency, (u64)delta);
+		printk("  [%016Lx %016Lx %016Lx]\n", (u64)T0, (u64)T1, (u64)T2);
 	}
 #endif
 
#1 lore raw

Hello.

Quoted 4 lines · Sergei Shtylyov

In addition to clock wrap check being falsely triggered with 32-bit cycles_t, as noticed to Kevin Hilman, there's another issue: using %Lx format to print 32-bit values warrants erroneous values on 32-bit machines like ARM and PPC32.

There's many more warnings with other options turned on, so I'll post an updated patch soon...

WBR, Sergei