Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-13 Thread Brett Glass
Thank you! Since it's tunable at runtime I just tested it, and -- sure enough --
no negative ping times.

Ironically, it was the kernel that selected the ACPI timer, scoring it higher
than the timestamp counter as a clock source. Perhaps code should be added to 
ensure that the timer is not chosen if it rolls over in less than a second, 
since this clearly leads to imprecision and missed rollovers.

--Brett Glass

At 11:04 PM 9/12/2011, Adam Vande More wrote:
 
it's a runtime tunable so /etc/sysctl.conf

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-13 Thread Brett Glass

At 09:16 AM 9/13/2011, Dan Nelson wrote:


It doesn't roll over in less than a second; it rolls over in 16777215 /
3579545 = 4.6 seconds.  Your negative time delta problem isn't due to
rollover.


If that's indeed the case, the kernel must be doing the math wrong.

I wonder how many other systems this is affecting.

--Brett Glass

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-13 Thread Chuck Swiger
[ ...combining two emails... ]

On Sep 13, 2011, at 9:49 AM, Brett Glass wrote:
 If that's indeed the case, the kernel must be doing the math wrong.

While there have undoubtedly have been kernel bugs with timekeeping (and there 
may be more still present), it's not uncommon for hardware issues to cause one 
or more of the available time sources to be broken.

On a good day, the clock source is broken obviously enough that the kernel 
notices it during testing during boot and gives it a negative quality score.  
Other times, the clock becomes broken only after the box suspends and resumes 
from an ACPI S# state, or does frequency changes for power/thermal management, 
etc.

 Ironically, it was the kernel that selected the ACPI timer, scoring it higher
 than the timestamp counter as a clock source. Perhaps code should be added to 
 ensure that the timer is not chosen if it rolls over in less than a second, 
 since this clearly leads to imprecision and missed rollovers.

The kernel attempts to notice problems when it probes for the various clocks 
during boot (ie, dev/acpica/acpi_hpet.c, dev/acpica/acpi_timer.c, etc); for 
ACPI, see acpi_timer_probe()  acpi_timer_test().

Regards,
-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread Brett Glass

More information regarding the odd behavior I'm seeing. Turns out
that packets do not even need to leave the machine for it to
report large negative ping times, on the order of more than half
a second. (See below.) Clearly something is odd about timekeeping
in this system (SiS motherboard chipset, PII-generation Celeron
but still effectively a 686) which was not a problem when it was
running FreeBSD 4.11-RELEASE (as it was before). What's more, it
appears that the negative ping times being shown for pings of
localhost are off by about -687 ms, consistently. Any ideas?
I am wondering if perhaps some recent change to the kernel
assumed that one would always have a faster CPU than the old
Celeron this machine is running, and that there is a race
condition or an error in the kernel code.

--Brett Glass

# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=-0.148 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=-0.151 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=-686.111 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=-0.180 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.110 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=686.351 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=-686.376 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.121 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=-686.402 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=-686.105 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=686.623 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.107 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.119 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.418 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.401 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=64 time=-0.169 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=64 time=0.113 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=64 time=0.401 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=64 time=-686.117 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=64 time=0.115 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=64 time=0.111 ms

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread Chuck Swiger
On Sep 12, 2011, at 4:50 PM, Brett Glass wrote:
 What's more, it appears that the negative ping times being shown for pings of
 localhost are off by about -687 ms, consistently. Any ideas?

Your system's timekeeping appears to be busted.  Are you running ntpd with 
tinker step 0.0 or some home-grown mechanism which might be forcibly stepping 
the clock rather than skewing it, by any chance?

Anyway, the output of:

  sysctl -a kern.timecounter

...is likely to be informative.  Try switching to another clock type, 
especially ACPI-safe if it hasn't been chosen by default.  Your CPU is probably 
too old to have a power-state invariant TSC, but if you disable SpeedStep, 
powerd and similar which might change the processor frequency, TSC might work 
OK also.

Regards,
-- 
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread b. f.
 I just put FreeBSD 8.1 up on an old (but good) 500 MHz Celeron with
 half a gig of RAM. Interfaces are classic xl (3Com) and dc (DEC
 tulip). Works quite nicely except for one quirk: ping times that
 ought to be positive (no more than 200 ms worst case) are coming
 out negative! Can't figure out what might be causing this. dmesg
 output is as follows:

If you are just upgrading now, why not use 9 BETA?  I think that your
older machine will be much happier -- the new timer code in 9 has a
bunch of bugfixes, allows for a wider choice of alternative timers, in
case some are broken, and places lighter loads on the system, by
allowing some (formerly periodic) timer use to be deferred.  And then
there is the host of other improvements...

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread Brett Glass
At 06:15 PM 9/12/2011, Chuck Swiger wrote:
 
Your system's timekeeping appears to be busted.  Are you running ntpd with 
tinker step 0.0 or some home-grown mechanism which might be forcibly 
stepping the clock rather than skewing it, by any chance?

Nothing like that.

Anyway, the output of:

  sysctl -a kern.timecounter

...is likely to be informative.  

Here it is:

kern.timecounter.tick: 1
kern.timecounter.choice: TSC(800) ACPI-safe(850) i8254(0) dummy(-100)
kern.timecounter.hardware: ACPI-safe
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.i8254.mask: 4294967295
kern.timecounter.tc.i8254.counter: 5754
kern.timecounter.tc.i8254.frequency: 1193182
kern.timecounter.tc.i8254.quality: 0
kern.timecounter.tc.ACPI-safe.mask: 16777215
kern.timecounter.tc.ACPI-safe.counter: 7967112
kern.timecounter.tc.ACPI-safe.frequency: 3579545
kern.timecounter.tc.ACPI-safe.quality: 850
kern.timecounter.tc.TSC.mask: 4294967295
kern.timecounter.tc.TSC.counter: 4058536290
kern.timecounter.tc.TSC.frequency: 501141177
kern.timecounter.tc.TSC.quality: 800
kern.timecounter.invariant_tsc: 0

This is very instructive. I didn't know that FreeBSD used the Pentium internal 
timestamp counter for anything but profiling.

I am noticing here that the mask (which I assume is the maximum value just 
before a rollover) for the ACPI-safe timer is very small. Maybe it's rolling 
over very frequently and/or the system is missing some of the rollovers. This 
would cause it to calculate negative times, of course.

Try switching to another clock type, especially ACPI-safe if it hasn't been 
chosen by default.  

No docs on how to do this. Is this done by, for example, setting 

kern.timecounter.hardware=TSC

in loader.conf?

Your CPU is probably too old to have a power-state invariant TSC, but if you 
disable SpeedStep, powerd and similar which might change the processor 
frequency, TSC might work OK also.

I've already turned off all power saving mechanisms listed in the BIOs setup, 
including clock speed modulation. So, the TSC ought to be pretty stable. At 
least it's worth a shot. 

--Brett Glass

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread Brett Glass

At 06:54 PM 9/12/2011, b. f. wrote:


If you are just upgrading now, why not use 9 BETA?


Production machine.

Also, whenever we create a new production box, we normally pick the
release (not beta; we need to be able to do binary upgrades and
this is only supported from one release to another) with the EOL
that's the farthest out.

We'll retire the hardware before we will run non-release code on a
production box.

--Brett Glass

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Negative ping times with FreeBSD 8.1-RELEASE on older Celeron system

2011-09-12 Thread Adam Vande More
On Mon, Sep 12, 2011 at 10:30 PM, Brett Glass br...@lariat.net wrote:

 At 06:15 PM 9/12/2011, Chuck Swiger wrote:

   sysctl -a kern.timecounter

 No docs on how to do this. Is this done by, for example, setting

 kern.timecounter.hardware=TSC

 in loader.conf?


it's a runtime tunable so /etc/sysctl.conf

and the sysctl -a kern.timecounter doesn't need a -a

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org