Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Timer issues?



Michael L. Hitch wrote:

>   I think I've now got the vax code reworked and doing the same as your 
> modified amiga code, and if I'm doing the check correctly, I'm seeing 
> quite a few backwards values.
> 
> scsibus0: waiting 2 seconds for devices to settle...
> vax_mfpr_get_counter wrapped: prev=36659, cur=26715 diff=9944
>                            : prev=3/6659, cur=(2)2/6715

This can only happen when the get_timecount() function is called for the
second time, and the clock interrupt still wasn't serviced. I didn't expect
that. Is the clock interrupt priority so low?

I tried to reproduce it on the Amiga, by inserting your debugging output,
and indeed it also happens here (two messages while starting into
multiuser):

Aug 23 13:13:07 phoenix /netbsd: root on sd0a dumps on sd0b
Aug 23 13:13:07 phoenix /netbsd: root file system type: ffs
Aug 23 13:13:08 phoenix /netbsd: clk_getcounter wrapped: prev=26010073, 
cur=26010027 diff=46
Aug 23 13:13:08 phoenix /netbsd: : prev=3667/63, cur=(3667)3666/7089
Aug 23 13:13:09 phoenix savecore: no core dump
Aug 23 13:13:37 phoenix /netbsd: clk_getcounter wrapped: prev=46921934, 
cur=46915187 diff=6747
Aug 23 13:13:37 phoenix /netbsd: : prev=6615/1739, cur=(6614)6614/2085


> [...] The prev_hardclock was incremented in the previous call, but
> the hardclock interrupt still hasn't been processed, so it will be using
> the current value of hardclock_ticks, which won't be right.

Indeed. :|


>   I just tried adjusting the prev_hardclock value if it is greater than 
> the current hardclock_ticks, and it has signifcantly reduced the times
> the return value goes backwards.  I've only seen message once so far,
> where before I got quite a few of them.
> [...]

I tried a similar approach now. The only difference is that I used 

        if (last_hardclock_ticks > old_hardclock_ticks)
                old_hardclock_ticks = last_hardclock_ticks;
(intstead of incrementing the old_hardclock_ticks)

I got no warning messages at all with this solution. But the Amiga didn't
generate so many warnings as the Vax did before either.

We would still run into a problem when the timecounter wraps twice, while
the interrupt wasn't processed, but then somebody is blocking interrupts by
far too long. ;)


I don't like our hacks at all. But at the moment I see no other solution...

-- 
Frank Wille



Home | Main Index | Thread Index | Old Index