Bug 475477 - Time(2) Off-by-one after Settimeofday(2)
Time(2) Off-by-one after Settimeofday(2)
Status: CLOSED CANTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.2
x86_64 Linux
low Severity medium
: rc
: ---
Assigned To: Red Hat Kernel Manager
Martin Jenner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-09 08:06 EST by CAI Qian
Modified: 2008-12-12 04:30 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-12-11 13:11:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description CAI Qian 2008-12-09 08:06:47 EST
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 CAI Qian 2008-12-09 08:08:45 EST
Created attachment 326300 [details]
Reproducer
Comment 2 Prarit Bhargava 2008-12-11 13:11:26 EST
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 CAI Qian 2008-12-12 04:30:12 EST
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.