<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/time/timekeeping.c, branch v2.6.36</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.36</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.36'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-08-13T19:03:24Z</updated>
<entry>
<title>time: Workaround gcc loop optimization that causes 64bit div errors</title>
<updated>2010-08-13T19:03:24Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-08-13T18:30:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c7dcf87a6881bf796faee83003163eb3de41a309'/>
<id>urn:sha1:c7dcf87a6881bf796faee83003163eb3de41a309</id>
<content type='text'>
Early 4.3 versions of gcc apparently aggressively optimize the raw
time accumulation loop, replacing it with a divide.

On 32bit systems, this causes the following link errors:
	undefined reference to `__umoddi3'
	undefined reference to `__udivdi3'

The gcc issue has been fixed in 4.4 and greater.

This patch replaces the accumulation loop with a do_div, as suggested
by Linus.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
CC: Jason Wessel &lt;jason.wessel@windriver.com&gt;
CC: Larry Finger &lt;Larry.Finger@lwfinger.net&gt;
CC: Ingo Molnar &lt;mingo@elte.hu&gt;
CC: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>timekeeping: Fix overflow in rawtime tv_nsec on 32 bit archs</title>
<updated>2010-08-12T16:53:39Z</updated>
<author>
<name>Jason Wessel</name>
<email>jason.wessel@windriver.com</email>
</author>
<published>2010-08-09T21:20:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=deda2e81961e96be4f2c09328baca4710a2fd1a0'/>
<id>urn:sha1:deda2e81961e96be4f2c09328baca4710a2fd1a0</id>
<content type='text'>
The tv_nsec is a long and when added to the shifted interval it can wrap
and become negative which later causes looping problems in the
getrawmonotonic().  The edge case occurs when the system has slept for
a short period of time of ~2 seconds.

A trace printk of the values in this patch illustrate the problem:

ftrace time stamp: log
43.716079: logarithmic_accumulation: raw: 3d0913 tv_nsec d687faa
43.718513: logarithmic_accumulation: raw: 3d0913 tv_nsec da588bd
43.722161: logarithmic_accumulation: raw: 3d0913 tv_nsec de291d0
46.349925: logarithmic_accumulation: raw: 7a122600 tv_nsec e1f9ae3
46.349930: logarithmic_accumulation: raw: 1e848980 tv_nsec 8831c0e3

The kernel starts looping at 46.349925 in the getrawmonotonic() due to
the negative value from adding the raw value to tv_nsec.

A simple solution is to accumulate into a u64, and then normalize it
to a timespec_t.

Signed-off-by: Jason Wessel &lt;jason.wessel@windriver.com&gt;
 [ Reworked variable names and simplified some of the code. - John ]
Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>timekeeping: Make xtime and wall_to_monotonic static</title>
<updated>2010-07-27T10:40:55Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-07-14T00:56:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0fb86b06298b6cd3205cac2e68a499f269282dac'/>
<id>urn:sha1:0fb86b06298b6cd3205cac2e68a499f269282dac</id>
<content type='text'>
This patch makes xtime and wall_to_monotonic static, as planned in
Documentation/feature-removal-schedule.txt. This will allow for
further cleanups to the timekeeping core.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;1279068988-21864-10-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>hrtimer: Cleanup direct access to wall_to_monotonic</title>
<updated>2010-07-27T10:40:55Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-07-14T00:56:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8ab4351a4c888016620f43bde605b3d0964af339'/>
<id>urn:sha1:8ab4351a4c888016620f43bde605b3d0964af339</id>
<content type='text'>
Provides an accessor function to replace hrtimer.c's
direct access of wall_to_monotonic.

This will allow wall_to_monotonic to be made static as
planned in Documentation/feature-removal-schedule.txt

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;1279068988-21864-9-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset</title>
<updated>2010-07-27T10:40:54Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-07-14T00:56:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7615856ebfee52b080c22d263ca4debbd0df0ac1'/>
<id>urn:sha1:7615856ebfee52b080c22d263ca4debbd0df0ac1</id>
<content type='text'>
update_vsyscall() did not provide the wall_to_monotoinc offset,
so arch specific implementations tend to reference wall_to_monotonic
directly. This limits future cleanups in the timekeeping core, so
this patch fixes the update_vsyscall interface to provide
wall_to_monotonic, allowing wall_to_monotonic to be made static
as planned in Documentation/feature-removal-schedule.txt

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Anton Blanchard &lt;anton@samba.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
LKML-Reference: &lt;1279068988-21864-7-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Kill off CONFIG_GENERIC_TIME</title>
<updated>2010-07-27T10:40:54Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-07-14T00:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=592913ecb87a9e06f98ddb55b298f1a66bf94c6b'/>
<id>urn:sha1:592913ecb87a9e06f98ddb55b298f1a66bf94c6b</id>
<content type='text'>
Now that all arches have been converted over to use generic time via
clocksources or arch_gettimeoffset(), we can remove the GENERIC_TIME
config option and simplify the generic code.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;1279068988-21864-4-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Implement timespec_add</title>
<updated>2010-07-27T10:40:53Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-07-14T00:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ce3bf7ab22527183634a76512d9854a38615e4d5'/>
<id>urn:sha1:ce3bf7ab22527183634a76512d9854a38615e4d5</id>
<content type='text'>
After accidentally misusing timespec_add_safe, I wanted to make sure
we don't accidently trip over that issue again, so I created a simple
timespec_add() function which we can use to replace the instances
of timespec_add_safe() that don't want the overflow detection.

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;1279068988-21864-3-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'linus' into timers/core</title>
<updated>2010-05-10T12:20:42Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2010-05-10T09:59:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dbb6be6d5e974c42bbecd183effaa0df69e1dd8b'/>
<id>urn:sha1:dbb6be6d5e974c42bbecd183effaa0df69e1dd8b</id>
<content type='text'>
Reason: Further posix_cpu_timer patches depend on mainline changes

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Remove xtime_cache</title>
<updated>2010-04-13T10:43:42Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-04-06T21:30:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6a867a395558a7f882d041783e4cdea6744ca2bf'/>
<id>urn:sha1:6a867a395558a7f882d041783e4cdea6744ca2bf</id>
<content type='text'>
With the earlier logarithmic time accumulation patch, xtime will now
always be within one "tick" of the current time, instead of possibly
half a second off.

This removes the need for the xtime_cache value, which always stored the
time at the last interrupt, so this patch cleans that up removing the
xtime_cache related code.

This patch also addresses an issue with an earlier version of this change,
where xtime_cache was normalizing xtime, which could in some cases be
not valid (ie: tv_nsec == NSEC_PER_SEC). This is fixed by handling
the edge case in update_wall_time().

Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Petr Titěra &lt;P.Titera@century.cz&gt;
LKML-Reference: &lt;1270589451-30773-1-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Fix accumulation bug triggered by long delay.</title>
<updated>2010-03-23T15:41:01Z</updated>
<author>
<name>John Stultz</name>
<email>johnstul@us.ibm.com</email>
</author>
<published>2010-03-18T21:47:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=830ec0458c390f29c6c99e1ff7feab9e36368d12'/>
<id>urn:sha1:830ec0458c390f29c6c99e1ff7feab9e36368d12</id>
<content type='text'>
The logarithmic accumulation done in the timekeeping has some overflow
protection that limits the max shift value. That means it will take
more then shift loops to accumulate all of the cycles. This causes
the shift decrement to underflow, which causes the loop to never exit.

The simplest fix would be simply to do a:
	if (shift)
		shift--;

However that is not optimal, as we know the cycle offset is larger
then the interval &lt;&lt; shift, the above would make shift drop to zero,
then we would be spinning for quite awhile accumulating at interval
chunks at a time.

Instead, this patch only decreases shift if the offset is smaller
then cycle_interval &lt;&lt; shift.  This makes sure we accumulate using
the largest chunks possible without overflowing tick_length, and limits
the number of iterations through the loop.

This issue was found and reported by Sonic Zhang, who also tested the fix.
Many thanks your explanation and testing!

Reported-by: Sonic Zhang &lt;sonic.adi@gmail.com&gt;
Signed-off-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Tested-by: Sonic Zhang &lt;sonic.adi@gmail.com&gt;
LKML-Reference: &lt;1268948850-5225-1-git-send-email-johnstul@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
</feed>
