• Wall-clock time running 30% too fast

    From ian.goldby@gmail.com@21:1/5 to All on Tue Nov 17 06:05:11 2015
    When I type sleep -s 60, it only sleeps for about 45 seconds, and with the date command I can observe that time advances about 30% too fast (i.e. a similar factor).

    I'd like to know where the tick-rate of the system clock is configured. (I don't mean ticks per second; I mean the speed of wall-clock time.) It looks like the ticker module is the one I want, but there doesn't seem to be a corresponding descriptor
    module. As I have only the board support pack I can't rebuild the ticker module - but it ought to be correct anyway since it was supplied as part of the board support pack.

    To give a bit more background: I've been building rom images for the Kontron VMP1 board for some time and had no problems with the clock. I've recently installed the board support pack for the VMP2, and this problem occurs with all VMP2 rom images I've
    built, whether with the Wizard or my own makefiles. The VMP2 is really just an upgraded version of the VMP1, with a 330MHz processor instead of a 250MHz processor (i.e. 30% faster).

    (Obviously, I've checked carefully that I'm using modules from the VMP2 folder hierarchy and not the VMP1 hierarchy.)

    Perhaps I've been sold a faulty board support pack? More likely I've just done something stupid though.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Allen Huffman@21:1/5 to All on Tue Nov 17 16:53:56 2015
    What version of OS-9 is this? If I recall, there is a variable in the INIT module that controls the ticks per second, and it should match the interrupt rate that the ticker is running at. d_tcksec is the name of the global variable for OS-9/68K.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Allen Huffman@21:1/5 to All on Wed Nov 18 17:03:30 2015
    Ah, OS-9000 (later renamed to OS-9 for PowerPC). The ticker should be reading the init module value to know what to program the timer interrupt, I thought. Very cool on how you figured it out!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ian.goldby@gmail.com@21:1/5 to All on Wed Nov 18 01:14:33 2015
    d_tcksec determines how many 'scheduler' tick interrupts there are every second as measured by the OS-9 system clock. My problem is that the OS-9 system clock itself is running fast. So there are indeed d_tcksec ticks in a 'system-second' but one 'system-
    second' is only 750 msecs of real time.

    I've done a bit more investigation. The problem is indeed the ticker module. On the VMP1 and VMP2 board, the ticker module is called tkdec and it uses the PowerPC decrememter register to generate an interrupt every so many decrements. The decrementer
    frequency seems to be equal to the RAM speed (100 MHz on the VMP1 and 132 MHz on the VMP2) divided by 4. The tkdec module supplied in the board support pack for the VMP2 was identical to the VMP1 module, despite the frequencies being different.

    I disassembled the module and found a constant corresponding the VMP1 decrementer frequency. I changed this to the VMP2 decrementer frequency using a hex editor, and with this patched module, the clock now runs at the correct speed on the VMP2. So I
    think it is problem solved.

    Incidently, the decrementer frequency is defined in a port-specific file called systype.h as TBCLK, and this is incorrect in the VMP2 board support pack. If I had the sources to tkdec then I could probably just have corrected systype.h and rebuilt tkdec.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)