7200 & bitkeeper/linuxcare devel?
Hi,
has anyone gotten a bitkeeper 2.4.0test1-ac7 or a linuxcare 2.3.99p9 to boot under a 7200?
I try this with absolutley no luck. The last linuxcare was a 2.3.99p6 which I got to boot. Unfortunately I missed the updates between p6 and p9. Both kernels run under a wallstreet. I use BootX 1.2.2 since I'm not able to get quik working :-(.
The only thing I see on the screen:
booting...setup_arch: entersetup_arch: bootmem
arch: exit
I played with bk sccstool to track down the relevant changes, but it seems that I have to learn a lot with this bk tool. Also, there are many changes from 2.3.99p6 until 2.4.0test1-ac7 so it's really difficult to find out.
Any hints would be great.
Thanks
Andreas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 5 lines
I played with bk sccstool to track down the relevant changes, but it seems that I have to learn a lot with this bk tool. Also, there are many changes from 2.3.99p6 until 2.4.0test1-ac7 so it's really difficult to find out.
I can't help you with the kernel part but I'm happy to try and help out with the sccstool part. I can also tell you how I "debug" stuff like this, it's somewhat time consuming but you can more or less automate it.
If you do a "bk changes" which gives you a listing of what has changed, and then identify the point where it worked, now you can basically do a binary search to find a point that works. Suppose you were at 1.100 when it worked
and 1.200 doesn't work. Let's say that 1.180 was the one that caused the
problem. So you do this:
bk clone -r1.150 busted test
cd test
build and install
this one worked
cd ..
rm -rf test
# we know that 1.100..1.150 work
bk clone -r1.175 busted test
build and install, it works
# we know that 1.100..1.175 work
bk clone -r1.182 busted test
build and install, it fails
# we know that it broke somewhere between 1.175 and 1.182
This may or may not be the right way to go about finding the problem. If you narrow it down, then get into sccstool and click left on 1.175 and right on 1.182 and then click "view changesets". Now you can walk through all the changes by hitting the spacebar repeatedly. This may give you a hint about what broke it.
Please let me know if this is helpful or useless or if you want some more info and good luck.
--
---
Larry McVoy [email protected] http://www.bitmover.com/lm
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Hi,
Quoted 3 lines · Andreas Tobler
Hi,
has anyone gotten a bitkeeper 2.4.0test1-ac7 or a linuxcare 2.3.99p9 to boot under a 7200?
I think I know why the kernel fails to boot on your machine. I had to get around this problem for my current project. I've sent a patch for it to Paul about a week ago, but, so far, nothing happened yet. Just in case, the same patch is attached here.
In your last post, you had a xmon log which said something like ".....
vector: 700 ....", and I infer that kernel died with program check exception.
Anyway, in arch/ppc/kernel/time.c, timer_interrupt() and do_gettimeofday() use "mftb" instruction which is not implemented in PPC 601, hence, the exception. The patch workarounds this, but, personally, I feel the previous implementation which just used DEC register was better than my patch or the current one when all PPCs are considered.
Takashi Oe
Hi,
Quoted 18 lines · Takashi Oe
Hi,
Quoted 3 lines · Andreas Tobler
Hi,
has anyone gotten a bitkeeper 2.4.0test1-ac7 or a linuxcare 2.3.99p9 to boot under a 7200?I think I know why the kernel fails to boot on your machine. I had to get around this problem for my current project. I've sent a patch for it to Paul about a week ago, but, so far, nothing happened yet. Just in case, the same patch is attached here.
In your last post, you had a xmon log which said something like ".....
vector: 700 ....", and I infer that kernel died with program check exception.
Quoted 5 lines
Anyway, in
arch/ppc/kernel/time.c,timer_interrupt()anddo_gettimeofday()use "mftb" instruction which is not implemented in PPC 601, hence, the exception. The patch workarounds this, but, personally, I feel the previous implementation which just used DEC register was better than my patch or the current one when all PPCs are considered.
Well, I applied this patch to the bitkeeper 2.4.0-test1-ac7, bingo, it boots again. Until the detection of my adaptec happens. Boop. Here I get a resource conflict and the machine wants to reboot since all my disk are hanging on the 2940UW. This is a known problem for all linuxers, also the ia32 and others. Have to read the posts on lk about this. Right now I build a 2.3.99p9 from linuxcare with your patch. I expect it to boot since the adaptec stuff was broken on 2.4 up.
So a big thanks to you Takashi, I can't say right now about the quality about the patch, I have to study it exactly. But so far I'm able to work further.
Andreas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
[Sorry, this is long, but I've been experimenting quite a lot on this subject recently]
Quoted 17 lines · Takashi Oe
Hi,
Quoted 3 lines · Andreas Tobler
Hi,
has anyone gotten a bitkeeper 2.4.0test1-ac7 or a linuxcare 2.3.99p9 to boot under a 7200?I think I know why the kernel fails to boot on your machine. I had to get around this problem for my current project. I've sent a patch for it to Paul about a week ago, but, so far, nothing happened yet. Just in case, the same patch is attached here.
In your last post, you had a xmon log which said something like ".....
vector: 700 ....", and I infer that kernel died with program check exception.
Quoted 5 lines
Anyway, in
arch/ppc/kernel/time.c,timer_interrupt()anddo_gettimeofday()use "mftb" instruction which is not implemented in PPC 601, hence, the exception. The patch workarounds this, but, personally, I feel the previous implementation which just used DEC register was better than my patch or the current one when all PPCs are considered.
Is it just me or is using the timebase in _this_ way completely wrong. AFAIU, the code just stores the timebase during the timer interrupt and assumes that it happens precisely at a given time of the day. i.e. it does not account for the delay in taking the interrupt which may be quite long if several interrupts are pending (the decrementer has a lower priorit than external interrupts in PPC machines).
Background: I've been chasing a problem of varying clock drift as measured by NTP. My machine is using a reference clock input from a GPS receiver and what I see is that the /etc/ntp/drift varies from ~-10 ppm to ~+10ppm and this is strongly correlated to the load on the machine.
This 20ppm variation might not seem much (actually it is), but:
a) it actually causes considerable clock errors (I have seen from -6 to +6 ms) since the NTP PLL is designed to compensate for long term drifts and takes several hours to converge (which is normal given the characteristics of normal crystals).
b) it is (literally) astronomically large for my applications. I have reference clocks with interfaces giving high precision and microsecond resolution which allow me to investigate these problems.
c) the error is not due to a change of the cpu clock frequency (or rather its crystal) with temperature or anything else... I have plotted the frequency of the time base versus a reference clock (sampling it every 10 seconds but averaging over 900s in the end) and the peak to peak variation over 3 days is below 0.3 ppm. This means that I lose something like 2 orders of magnitude in precision (and likely more since most of the remaining drifts are within the loop bandwidth of NTP).
Finally it appears it is due to subtle external interferences in the decrementer reload code. Actually waiting for the decrementer to change before incrementing it the next interval is bogus in the presence of cache misses when you consider the code:
# loop waiting for the decrementer to change
30: 7d 76 02 a6 mfdec r11
34: 7c 0b 00 00 cmpw r11,r0
38: 41 82 ff f8 beq 30 <timer_interrupt+0x30>
# now update the decrementer
3c: 3d 20 00 00 lis r9,0
3e: R_PPC_ADDR16_HA decrementer_count>
40: 80 09 00 00 lwz r0,0(r9)
42: R_PPC_ADDR16_LO decrementer_count>
44: 7c 0b 02 14 add r0,r11,r0
48: 7c 16 03 a6 mtdec r0
4c: 7f 83 e3 78 mr r3,r28The time to access decrementer_count obviously depends on whether it is found in the L1 cache, L2 cache or main memory. On a busy machine the delay of a cache miss may be large (and the likelyness of having to fetch another cache line for the mtdec instruction is ~50%). So it's not unexpected to reach a difference of 200 nS between a cache hit and cache miss (i.e. a loaded versus idle machine). Actually this jitter of ~200 nS would not be so serious if it would not accumulate over time to give offsets of several milliseconds before NTP starts to react.
The solution I have implemented is to use the timebase as a reference, using the value of the time base at a jiffy boundary as a reference for gettimeofday and friends. Update this value (which is a global variable) at every decrementer interrupt. The 601 introduces some complications due to the fact it uses different registers and that the low 32 bits only count up to 10^9 but they are fairly easy to solve.
After the patch is applied, I still see some frequency drift but they are clearly proportional to the timebase/cpu/pci/bus frequency from other measurements. It does not actually mean that the timebase is good: the 16.66 MHz timebase still changes by by a huge ~10 Hz=0.6ppm between a loaded and an idle machine but this is due to physical effects (slight change in voltage or internal EMI with the rest of the motherboard when the CPU/PCI/memory bus is busy) and also slow drifts (~0.2 ppm probably of thermal origin).
Still on the TODO list:
- chrp_calibrate_decr and pmac_calibrate_decr are so similar that they should be fused into one routine. Having neither mac nor CHRP, I did not do it.
- Check on SMP machine that the time is now correctly synchronized, I did not remove the #ifndef __SMP__ since I can't test it but it should work now.
- Find all remaining bugs, and optimize even more :-)
The patch also tries to provide a more precise measurement of the decrementer frequency, but I still don't understand why this measurement occasionally gave tremendous differences between boots: most of the boot time decrementer frequency measurements gave similar results, but I occasionally got a value differing by ~500ppm, which is _large_ by any standard (2 seconds per hour), and plays havoc with both adjtime and NTP. I have not seen this problem again since I've implemented the patch, but I don't yet have enough samples to decide whether it is solved or not (I'd rather say that it is not solved).
Finally the patch provides a faster gettimeofday (no division, a single mulhwu instruction is used) and corrects a few bugs.
What this patch could help to provide in the future is higher resolution timers (effectively giving the impression of a higher HZ) almost for free which could be interesting for realtime applications. Actually the per processor decrementer is the right thing to implement this because it allows to decouple the time management from the timers (it might require a timer queue per processor to limit cache line ping-pongs on SMP).
Ok, I've already been too verbose, so for the people who have had the courage to read all the preceding, here is the patch (for 2.2.12 between 2 bitkeeper revisions with bk cset -Rx1..x2|bk diffs -u - so don't be surprised by "directory" names), it probably does not apply cleanly (without fuzz at least) to official sources given the changes in my source tree.
If there is popular demand, I shall distill a 2.4.0test1 patch (plain 2.4.0-test1 works on my MVME boards since Monday but I would prefer to send other patches first given the growing divergence between my sources and the official ones).
Gabriel.
===== arch/ppc/kernel/apus_setup.c 1.1 vs 1.2 =====
arch/ppc/kernel/apus_setup.c +7 -7
@@ -163,7 +163,7 @@void apus_calibrate_decr (void ) { -int freq, divisor; +unsigned long freq;/* This algorithm for determining the bus speed was contributed by Ralph Schmidt. */
@@ -193,8 +193,8 @@ bus_speed =60 ; freq =15000000 ; }else if ((bus_speed >=63 ) && (bus_speed <69 )) { - bus_speed =66 ; - freq =16500000 ; + bus_speed =67 ; + freq =16666667 ; }else {printk ("APUS: Unable to determine bus speed (%d). " "Defaulting to 50MHz" , bus_speed);
@@ -228,10 +228,10 @@ freq *=60 ;/* try to make freq/1e6 an integer */ divisor =60 ; -printk ("time_init: decrementer frequency = %d/%d\n" , freq, divisor); - decrementer_count = freq /HZ / divisor; - count_period_num = divisor; - count_period_den = freq /1000000 ; +printk ("time_init: decrementer frequency = %lu.%.6lu MHz\n" , + freq/1000000 , freq%1000000 ); + tb_ticks_per_jiffy = freq /HZ ; + tb_to_us =mulhwu_scale_factor (freq,1000000 ); } void arch_gettod(int *year, int *mon, int *day, int *hour,
===== arch/ppc/kernel/chrp_time.c 1.1 vs 1.2 =====
arch/ppc/kernel/chrp_time.c +7 -9
@@ -154,8 +154,7 @@ __initfunc(void chrp_calibrate_decr(void)) {struct device_node *cpu; -int *fp, divisor; -unsigned long freq; +unsigned long freq, *fp;if (via_calibrate_decr ())return ;
@@ -167,14 +166,13 @@ freq =16666000 ;/* hardcoded default */ cpu =find_type_devices ("cpu" );if (cpu !=0 ) { - fp = (int *)get_property (cpu,"timebase-frequency" ,NULL ); + fp = (unsigned long *) +get_property (cpu,"timebase-frequency" ,NULL );if (fp !=0 ) freq = *fp; } - freq *=60 ;/* try to make freq/1e6 an integer */ - divisor =60 ; -printk ("time_init: decrementer frequency = %lu/%d\n" , freq, divisor); - decrementer_count = freq /HZ / divisor; - count_period_num = divisor; - count_period_den = freq /1000000 ; +printk ("time_init: decrementer frequency = %lu.%.6lu\n" , + freq/1000000 , freq%1000000 ); + tb_ticks_per_jiffy = freq /HZ ; + tb_to_us =mulhwu_scale_factor (freq,1000000 ); }
===== arch/ppc/kernel/mbx_setup.c 1.1 vs 1.2 =====
arch/ppc/kernel/mbx_setup.c +7 -9
@@ -144,22 +144,20 @@ __initfunc(void mbx_calibrate_decr(void)) {bd_t *binfo = (bd_t *)&res; -int freq, fp, divisor; +unsigned long freq;if ((((immap_t *)MBX_IMAP_ADDR )->im_clkrst.car_sccr &0x02000000 ) ==0 )printk ("WARNING: Wrong decrementer source clock.\n" );/* The manual says the frequency is in Hz, but it is really -* as MHz. The value 'fp' is the number of decrementer ticks +* as MHz. The value 'freq' is the number of decrementer ticks * per second. */ - fp = (binfo->bi_intfreq *1000000 ) /16 ; - freq = fp*60 ;/* try to make freq/1e6 an integer */ - divisor =60 ; -printk ("time_init: decrementer frequency = %d/%d\n" , freq, divisor); - decrementer_count = freq /HZ / divisor; - count_period_num = divisor; - count_period_den = freq /1000000 ; + freq = binfo->bi_intfreq * (1000000 /16 ); +printk ("time_init: decrementer frequency = %lu.%.6lu MHz\n" , + freq/1000000 , freq%1000000 ); + tb_ticks_per_jiffy = freq /HZ ; + tb_to_us =mulhwu_scale_factor (freq,1000000 ); }/* A place holder for time base interrupts, if they are ever enabled.
===== arch/ppc/kernel/pmac_time.c 1.1 vs 1.2 =====
arch/ppc/kernel/pmac_time.c +14 -15
@@ -125,12 +125,11 @@ ; dend =get_dec (); - decrementer_count = (dstart - dend) /6 ; - count_period_num =60 ; - count_period_den = decrementer_count *6 *HZ /100000 ; + tb_ticks_per_jiffy = (dstart - dend) /6 ; + tb_to_us =mulhwu_scale_factor (dstart - dend,60000 ); -printk (KERN_INFO "via_calibrate_decr: decrementer_count = %u (%u ticks)\n" , - decrementer_count, dstart - dend); +printk (KERN_INFO "via_calibrate_decr: tb_ticks_per_jiffy = %u (%u ticks)\n" , + tb_ticks_per_jiffy, dstart - dend);return 1 ; }
@@ -149,8 +148,10 @@break ;case PBOOK_WAKE : xtime.tv_sec =pmac_get_rtc_time () + time_diff; +set_dec (tb_ticks_per_jiffy); +/* No PBOOK has a 601 AFAIK, so use get_tbl not binary_tbl */ + tb_last_stamp=get_tbl (); xtime.tv_usec =0 ; -set_dec (decrementer_count); last_rtc_update = xtime.tv_sec;break ; }
@@ -170,7 +171,7 @@ __initfunc(void pmac_calibrate_decr(void)) {struct device_node *cpu; -int freq, *fp, divisor; +unsigned long freq, *fp;#ifdef CONFIG_PMAC_PBOOK pmu_register_sleep_notifier (&time_sleep_notifier);
@@ -186,15 +187,13 @@ cpu =find_type_devices ("cpu" );if (cpu ==0 )panic ("can't find cpu node in time_init" ); - fp = (int *)get_property (cpu,"timebase-frequency" ,NULL ); + fp = (unsigned long *)get_property (cpu,"timebase-frequency" ,NULL );if (fp ==0 )panic ("can't get cpu timebase frequency" ); - freq = *fp *60 ;/* try to make freq/1e6 an integer */ - divisor =60 ; -printk ("time_init: decrementer frequency = %d/%d\n" , - freq, divisor); - decrementer_count = freq /HZ / divisor; - count_period_num = divisor; - count_period_den = freq /1000000 ; + freq = *fp; +printk ("time_init: decrementer frequency = %lu.%.6lu MHz\n" , + freq/1000000 , freq%1000000 ); + tb_ticks_per_jiffy = freq /HZ ; + tb_to_us =mulhwu_scale_factor (freq,1000000 ); }
===== arch/ppc/kernel/prep_setup.c 1.2 vs 1.3 =====
arch/ppc/kernel/prep_setup.c +37 -39
127 lines not on this page · raw message
===== arch/ppc/kernel/time.c 1.1 vs 1.2 =====
arch/ppc/kernel/time.c +61 -32
154 lines not on this page · raw message
===== arch/ppc/kernel/time.h 1.1 vs 1.2 =====
arch/ppc/kernel/time.h +66 -5
89 lines not on this page · raw message
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/