Bug 475477 - Time(2) Off-by-one after Settimeofday(2)
Summary: Time(2) Off-by-one after Settimeofday(2)
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.2
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Red Hat Kernel Manager
QA Contact: Martin Jenner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-12-09 13:06 UTC by Qian Cai
Modified: 2008-12-12 09:30 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-12-11 18:11:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproducer (1.10 KB, text/plain)
2008-12-09 13:08 UTC, Qian Cai
no flags Details

Description Qian Cai 2008-12-09 13:06:47 UTC
Description of problem:
One of LTP (Linux Testing Project) test case was doing the following something similar to the following,

gettimeofday()
settimeofday()
time()

The result that time() returned was one less that we set.

# ./time
curr_time = 1228827598
pres_time = 1228827607
Failed.

If we changed the above code to

gettimeofday()
settimeofday()
gettimeofday()

It worked fine.

# ./time
curr_time = 1228827598
pres_time = 1228827608

The following is the list of known affected machines and their timer information,
sun-v40z-01.rhts.bos.redhat.com
...
Detected 20.834 MHz APIC timer.
time.c: Using 3.579545 MHz WALL PM GTOD PIT/TSC timer.
...

x86-64-5s-m1.lab.bos.redhat.com
...
Detected 12.453 MHz APIC timer.
SMP alternatives: switching to SMP code
Booting processor 1/8 APIC 0x1
...

hp-dl785g5-01.rhts.bos.redhat.com
...
Detected 12.500 MHz APIC timer.
...

hp-dl360g4-01.rhts.bos.redhat.com
...
Detected 12.500 MHz APIC timer
...

dell-pe2900-01.rhts.bos.redhat.com

I have never seen it failed on any IA-32 machine.

Version-Release number of selected component (if applicable):
kernel-2.6.18-92.el5
kernel-2.6.18-125.el5

How reproducible:
always

Additional info:
Ntpd had been stopped.

Comment 1 Qian Cai 2008-12-09 13:08:45 UTC
Created attachment 326300 [details]
Reproducer

Comment 2 Prarit Bhargava 2008-12-11 18:11:26 UTC
CANTFIX -- set/gettimeofday & time are known not to keep consistent time against one another.  Attempting to make them consistent results in a unacceptable 2200% performance hit on the time() syscall.

See BZ 461184.

Comment 3 Qian Cai 2008-12-12 09:30:12 UTC
Prait, someone in LTP mailing list pointed out that this upstream commit fixed the test failure.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9a055117d3d9cb562f83f8d4cd88772761f4cab0

I cannot apply this patch to RHEL 5 kernel though because there is no timekeeping.c. The discussion in LTP is here,
http://article.gmane.org/gmane.linux.ltp/6730


Note You need to log in before you can comment on or make changes to this bug.