Subject: Re: Need help with timecounters/todr
To: None <kardel@NetBSD.org>
From: Izumi Tsutsui <firstname.lastname@example.org>
Date: 02/25/2007 00:47:21
> In general I agree with the strategy but I think we
> should try to avoid a copy if tsc.c here. I include an
> old patch here that attempts to split tsc.c into a
> MD part (tsc.c) and an MI part kern_cctr.c.
Well, I completely agree with you, but I don't think
it's my part to split it into MI/MD part ;-)
(just I'd like to commit todr(9) diffs in my local tree)
Is there any reason why you have not committed this
> Maybe you can
> use that for the cycle counter part of the part
With a quick glance, kern_cctr.c has MD x86_broadcast_ipi()
call. How should it be handled? (via a function pointer?)
I'm also afraid that some ports don't have opt_multiprocessor.h.
Is it better to move cc_calibrate() function into MD files?
> Also note
> that the patch assumes that the counter is read by
> cpu_counter32() - same headfile magic as was used
> for kern_microtime.c.
Alpha port currently uses kern_microtime.c and
cpu_counter32() is defined in arch/alpha/include/cpu_counter.h.
> The patch works for x86 - it should work for alpha when
> cc_init is called at the right place - I hope - I have no
> hw to check.
I don't have SMP one, but I'll try my on DEC3000/300 and AlphaPC164.
> > Note "make regress" on regress/sys/kern/sleeping fails
> > even without this patch on alpha.
> I what way? Usually the check uncovers descrepancies between
> timeout and timekeeping code.
Here is a log on GENERIC kernel from daily snapshot:
# uname -a
NetBSD outlander 4.99.11 NetBSD 4.99.11 (GENERIC-$Revision: 1.310 $) #0: Mon Feb 19 19:48:43 UTC 2007 email@example.com:/home/builds/ab/HEAD/alpha/200702190000Z-obj/home/builds/ab/HEAD/src/sys/arch/alpha/compile/GENERIC alpha
# make regress
Testing sleep/timeout implementations
accepted scheduling delta 30 ms
testing up to 32000 ms for 5 interfaces
ALARM interrupt after 11 sec once per run
kevent timer will fire after 13200 ms
[nanosleep] sleeping 30000000 nsec ... sig 0, real time sleep 30711000 nsec, remain(returned) 0 nsec, diff to supposed sleep -711000 nsec (rounded -711000 nsec) OK
[nanosleep] sleeping 7680000000 nsec ... sig 0, real time sleep 7688819000 nsec, remain(returned) 0 nsec, diff to supposed sleep -8819000 nsec (rounded -8819000 nsec) OK
[nanosleep] sleeping 15360000000 nsec ... - errno=Interrupted system call (OK) - sig 1, real time sleep 11013983000 nsec, remain(returned) 4346684000 nsec, diff to supposed sleep -667000 nsec (rounded -667000 nsec) OK
[nanosleep] sleeping 30720000000 nsec ... sig 1, real time sleep 30754588000 nsec, remain(returned) 0 nsec, diff to supposed sleep -34588000 nsec (rounded -34588000 nsec) ERROR
[nanosleep] sleeping 23040000000 nsec ... sig 1, real time sleep 23065463000 nsec, remain(returned) 0 nsec, diff to supposed sleep -25463000 nsec (rounded -25463000 nsec) OK
TEST FAIL (1 errors, 5 alarms, 5 interfaces)
*** Error code 1
make: stopped in /usr/src/regress/sys/kern/sleeping
Caused by inaccuracy of cpu_frequency() on alpha?