In message <[EMAIL PROTECTED]>, Matthew Dillon wri
tes:

>    In anycase, I think this is reasonable especially if we explicitly
>    use the fast code for those chipsets known to be good.  I would like
>    to commit it.  It can handle *ANY* sort of ripple or fast-carry breakage,
>    really any type of breakage since it looks for two identical samples
>    after masking rather then using an inequality.

My only worry here is laptops.

If my laptop is connected to the wall-power when it boots it comes
up at full CPU speed during the probe and mask determination.

Then I unplug it and the CPU speed drops by a large factor and
suddenly the mask is too tight for the CPU to get two samples.

I think we need an approach where we loosen the mask at runtime if
some significant number of iterations fail to get a count may be
needed:

#define N       25

        static unsigned mask = 0xfffffffe;

        for (;;) {
                for (i = 0; i < N; i++) {
                        c = READ_TIMER & mask;
                        d = READ_TIMER & mask;
                        if (c == d)
                                return(d);
                }
                printf("Adjusting mask to %08x\n", mask);
                mask <<= 1;
        }


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to