i'd suggest to redo it - but please keep it simple and clean. Those dozens of casts to u64 are quite ugly.
Alas, there's *nothing* I can do about it with 32-bit cycles_t. [...]
there's *always* a way to do such things more cleanly - such as the patch below. Could you try to fix it up for 32-bit cycles_t platforms? I bet the hackery will be limited to now() and maybe the conversion routines, instead of spreading all around latency_trace.c.
Index: linux/kernel/latency_trace.c[...]
===================================================================
--- linux.orig/kernel/latency_trace.c
+++ linux/kernel/latency_trace.c
@@ -1721,7 +1722,7 @@ check_critical_timing(int cpu, struct cp
T2 = get_monotonic_cycles();
/* check for buggy clocks, handling wrap for 32-bit clocks */
- if (TYPE_EQUAL(cycles_t, unsigned long)) {
+ if (TYPE_EQUAL(cycle_t, unsigned long)) {
if (time_after((unsigned long)T1, (unsigned long)T2))
printk("bug: %08lx < %08lx!\n",
(unsigned long)T2, (unsigned long)T1);