Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 1999 01:03:52 -0700 (PDT)
From:      riccardo@torrini.org
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/14034: gettimeofday() returns negative value
Message-ID:  <19990929080352.7449C154A3@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         14034
>Category:       kern
>Synopsis:       gettimeofday() returns negative value
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 29 01:10:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Riccardo Torrini
>Release:        3.3-STABLE (cvsuped on Sep 20, 1999)
>Organization:
ESAOTE s.p.a.
>Environment:
FreeBSD snail.fi.esaote.it 3.3-STABLE FreeBSD 3.3-STABLE #0: Wed Sep 22 08:57:26 CEST 1999     root@snail.fi.esaote.it:/usr/src/sys/compile/OCTOPUSSY  i386

The machine is an HP NetServer 4/66-LC (486/DX2-66) used as internal
router with 4 Intel EtherExpress Pro/10 on isa and internet gateway
with 56k internal usrobotics modem and it happens every some day.
I recompiled world and kernel, after cvsupping, on end of august,
begin of september, 20 and 24 of september.  No more often because
I need full 24 hours to build and install :-(


-----8<-----[ /var/run/dmesg.boot ]-----8<-----
Copyright (c) 1992-1999 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California. All rights reserved.
FreeBSD 3.3-STABLE #0: Wed Sep 22 08:57:26 CEST 1999
    root@snail.fi.esaote.it:/usr/src/sys/compile/OCTOPUSSY
Timecounter "i8254"  frequency 1193182 Hz
CPU: i486 DX2 (486-class CPU)
  Origin = "GenuineIntel"  Id = 0x435  Stepping = 5
  Features=0x3<FPU,VME>
real memory  = 92274688 (90112K bytes)
avail memory = 86380544 (84356K bytes)
Preloaded elf kernel "kernel" at 0xc0318000.
Preloaded splash_image_data "/boot/daemon.bmp" at 0xc031809c.
Preloaded elf module "splash_bmp.ko" at 0xc03180ec.
eisa0: <HWPc081 (System Board)>
Probing for devices on the EISA bus
ahc0: <Adaptec aic7770 SCSI host adapter> at 0xbc00-0xbcff irq 15
ahc0: on eisa0 slot 11
ahc0: aic7770 >= Rev E, Twin Channel, A SCSI Id=7, B SCSI Id=7, primary A, 4/255 SCBs
Probing for devices on the ISA bus:
sc0 on isa
sc0: VGA color <16 virtual consoles, flags=0x0>
atkbdc0 at 0x60-0x6f on motherboard
atkbd0 irq 1 on isa
psm0 not found
sio2 at 0x3e8-0x3ef irq 4 on isa
sio2: type 16550A
fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
fdc0: FIFO enabled, 8 bytes threshold
fd0: 1.44MB 3.5in
wdc0 at 0x1f0-0x1f7 irq 14 on isa
wdc0: unit 1 (atapi): <FX001DE/K01>, removable, intr, iordis
acd0: drive speed 689KB/sec, 128KB cache
acd0: supported read types:
acd0: Audio: play, 255 volume levels
acd0: Mechanism: ejectable tray
acd0: Medium: no/blank disc inside, unlocked
ppc0 at 0x378 irq 7 on isa
ppc0: PC87332 chipset (NIBBLE-only) in COMPATIBLE mode
ex0 at 0x2a0-0x2af irq 10 on isa
ex0: Intel EtherExpress Pro/10, address 00:aa:00:ad:61:fd, connector TPE
ex1 at 0x2b0-0x2bf irq 11 on isa
ex1: Intel EtherExpress Pro/10, address 00:aa:00:ad:64:f0, connector TPE
ex2 at 0x2c0-0x2cf irq 3 on isa
ex2: Intel EtherExpress Pro/10, address 00:aa:00:ae:5c:e7, connector TPE
ex3 at 0x2d0-0x2df irq 5 on isa
ex3: Intel EtherExpress Pro/10, address 00:aa:00:ad:63:8e, connector TPE
vga0 at 0x3b0-0x3df maddr 0xa0000 msize 131072 on isa
npx0 on motherboard
npx0: INT 16 interface
ccd0-3: Concatenated disk drivers
IP packet filtering initialized, divert enabled, rule-based forwarding enabled, logging disabled
DUMMYNET initialized (990504)
IP Filter: initialized.  Default = pass all, Logging = enabled
Waiting 15 seconds for SCSI devices to settle
da0 at ahc0 bus 0 target 0 lun 0
da0: <IBM OEM 0662S12 3 30> Fixed Direct Access SCSI-2 device 
da0: 10.000MB/s transfers (10.000MHz, offset 15), Tagged Queueing Enabled
da0: 1003MB (2055035 512 byte sectors: 64H 32S/T 1003C)
da1 at ahc0 bus 0 target 1 lun 0
da1: <IBM OEM 0662S12 1011> Fixed Direct Access SCSI-2 device 
da1: 10.000MB/s transfers (10.000MHz, offset 15), Tagged Queueing Enabled
da1: 1003MB (2055035 512 byte sectors: 64H 32S/T 1003C)
da3 at ahc0 bus 0 target 3 lun 0
da3: <SEAGATE ST31230N 0594> Fixed Direct Access SCSI-2 device 
da3: 10.000MB/s transfers (10.000MHz, offset 15), Tagged Queueing Enabled
da3: 1010MB (2069860 512 byte sectors: 64H 32S/T 1010C)
da2 at ahc0 bus 0 target 2 lun 0
da2: <HP 1.050 GB #A2 0180> Fixed Direct Access SCSI-2 device 
da2: 10.000MB/s transfers (10.000MHz, offset 15), Tagged Queueing Enabled
da2: 1001MB (2051460 512 byte sectors: 64H 32S/T 1001C)
changing root device to da0s1a


-----8<-----[ /usr/src/sys/i386/conf/OCTOPUSSY ]-----8<-----
#       $Id: GENERIC,v 1.143.2.2 1999/02/15 02:50:07 des Exp $
#       Modified by Riccardo "VIC" Torrini for OCTOPUSSY

machine         "i386"
cpu             "I386_CPU"
cpu             "I486_CPU"
ident           OCTOPUSSY
maxusers        32

options         INET                    #InterNETworking
options         IPX                     #IPX/SPX communications protocols

options         FFS                     #Berkeley Fast Filesystem
options         FFS_ROOT                #FFS usable as root device [keep this!]
options         MFS                     #Memory Filesystem
options         MFS_ROOT                #MFS usable as root device, "MFS" req'ed
options         NFS                     #Network Filesystem
options         NFS_ROOT                #NFS usable as root device, "NFS" req'ed
options         MSDOSFS                 #MSDOS Filesystem
options         "CD9660"                #ISO 9660 Filesystem
options         "CD9660_ROOT"           #CD-ROM usable as root. "CD9660" req'ed
options         PROCFS                  #Process filesystem
options         "COMPAT_43"             #Compatible with BSD 4.3 [KEEP THIS!]
options         SCSI_DELAY=15000        #Be pessimistic about Joe SCSI device
options         UCONSOLE                #Allow users to grab the console
options         FAILSAFE                #Be conservative
options         USERCONFIG              #boot -c editor
options         VISUAL_USERCONFIG       #visual boot -c editor

config          kernel  root on da0

controller      isa0
controller      eisa0
options "EISA_SLOTS=12"
controller      pci0

controller      fdc0    at isa? port "IO_FD1" bio irq 6 drq 2
disk            fd0     at fdc0 drive 0

options         "CMD640"        # work around CMD640 chip deficiency
controller      wdc0    at isa? port "IO_WD1" bio irq 14

options         ATAPI           #Enable ATAPI support for IDE bus
options         ATAPI_STATIC    #Don't do it as an LKM
device          acd0            #IDE CD-ROM

controller      ahc0
controller      scbus0

device          da0
device          cd0     #Only need one of these, the code dynamically grows

# atkbdc0 controlls both the keyboard and the PS/2 mouse
controller      atkbdc0 at isa? port IO_KBD tty
device          atkbd0  at isa? tty irq 1
device          psm0    at isa? tty irq 12

device          vga0    at isa? port ? conflicts

# splash screen/screen saver
pseudo-device   splash
options         "VM86"
options         VESA                    # needs VM86 defined too!!

# syscons is the default console driver, resembling an SCO console
device          sc0     at isa? tty

device          npx0    at isa? port IO_NPX irq 13

device          sio2    at isa? port "IO_COM3" tty irq 4

# Parallel port
device          ppc0    at isa? port? net irq 7
controller      ppbus0
device          nlpt0   at ppbus?

# Network
device ex0 at isa? port 0x2a0 net irq 10
device ex1 at isa? port 0x2b0 net irq 11
device ex2 at isa? port 0x2c0 net irq 3
device ex3 at isa? port 0x2d0 net irq 5

pseudo-device   loop
pseudo-device   ether
pseudo-device   sl      1
pseudo-device   ppp     1
pseudo-device   tun     1
pseudo-device   pty     16
pseudo-device   gzip            # Exec gzipped a.out's

pseudo-device   speaker         #Play IBM BASIC-style noises out your speaker
pseudo-device   ccd     4       #Concatenated disk driver

options         SYSVSHM
options         SYSVMSG

pseudo-device   bpfilter 4      #Berkeley packet filter

options         IPFIREWALL              #firewall
options         IPFIREWALL_FORWARD      #enable transparent proxy support
options         IPDIVERT                #divert sockets
options         IPFILTER                #kernel ipfilter support
options         IPFILTER_LOG            #ipfilter logging

options         "ICMP_BANDLIM"

options DUMMYNET
>Description:
gettimeofday() sometimes returns negative values for microseconds.
Already submitted as PR misc/13992 (routed exit after some day of
work with signal 6, core dump).
>How-To-Repeat:
-----8<-----[ gettimeofday_test.c ]-----8<-----
#include <sys/time.h>
#include <err.h>
#include <stdio.h>

void
main()
{
    struct timeval tp;

    do {
        if (gettimeofday(&tp, (struct timezone *)NULL) == -1) {
            err(1, "gettimeofday");
        }

        if (tp.tv_usec < 0) {
            errx(1, "invalid time returned: %ld:%ld",
                tp.tv_sec, tp.tv_usec);
        }
    } while (1);

}

=====[ output on my machine ]=====
After about 20minutes:
gettimeofday_test: invalid time returned: 938527821:-695331771

# sysctl kern.timecounter.method machdep.i8254_freq
kern.timecounter.method: 0
machdep.i8254_freq: 1193182
>Fix:
I have work-around with a script that poll processes and
respawn "routed -s" when it dies.  Not a real fix... :-(

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990929080352.7449C154A3>