RE: [BISECTION RESULT] sched: revert cpu_clock to

Luck, Tony
2008-08-04T22:00:47Z

> I'd bet resonable sums of money that we are (once again) accessing
> per-cpu variables in code before ia64 has a chance to initialize
> things so that they can actually work. :-(

I tried this simple hack to check ... per-cpu variables are
not usable until cpu_init() sets up the "ar.k3" register on
ia64. So this hack checks to see if it is set before calling
cpu_clock():

--- a/kernel/printk.c 2008-08-01 10:20:47.000000000 -0700
+++ b/kernel/printk.c 2008-08-04 14:49:18.000000000 -0700
@@ -34,6 +34,7 @@
#include <linux/syscalls.h>

#include <asm/uaccess.h>
+#include <asm/kregs.h>

/*
* Architectures can override it:
@@ -737,7 +738,10 @@
unsigned long long t;
unsigned long nanosec_rem;

- t = cpu_clock(printk_cpu);
+ if (ia64_get_kr(IA64_KR_PER_CPU_DATA))
+ t = cpu_clock(printk_cpu);
+ else
+ t = 0;
nanosec_rem = do_div(t, 1000000000);
tlen = sprintf(tbuf, "[%5lu.%06lu] ",
(unsigned long) t,

With this hack the kernel boots (with CONFIG_PRINTK_TIME=y).

This is effectively how the code used to operate before the architecture
hooks were cleaned away by:

commit b842271fbb9c8b5fd0e1c3e1895a3b67ba5bcc54
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Jan 25 21:07:59 2008 +0100

sched: remove printk_clock()

printk_clock() is obsolete - it has been replaced with cpu_clock().

-Tony