<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/time/timekeeping.c, branch v3.2-rc2</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=v3.2-rc2</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.2-rc2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2011-07-20T22:42:55Z</updated>
<entry>
<title>time: Fix stupid KERN_WARN compile issue</title>
<updated>2011-07-20T22:42:55Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-07-20T22:42:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cbaa51524b3224813814607177a00c350ee35d12'/>
<id>urn:sha1:cbaa51524b3224813814607177a00c350ee35d12</id>
<content type='text'>
Terribly embarassing. Don't know how I committed this, but its
KERN_WARNING not KERN_WARN.

This fixes the following compile error:
kernel/time/timekeeping.c: In function ‘__timekeeping_inject_sleeptime’:
kernel/time/timekeeping.c:608: error: ‘KERN_WARN’ undeclared (first use in this function)
kernel/time/timekeeping.c:608: error: (Each undeclared identifier is reported only once
kernel/time/timekeeping.c:608: error: for each function it appears in.)
kernel/time/timekeeping.c:608: error: expected ‘)’ before string constant
make[2]: *** [kernel/time/timekeeping.o] Error 1

Reported-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>time: Avoid accumulating time drift in suspend/resume</title>
<updated>2011-06-21T23:55:37Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-06-01T05:53:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cb33217b1b2523895eb328a0b13fb3b1c4000969'/>
<id>urn:sha1:cb33217b1b2523895eb328a0b13fb3b1c4000969</id>
<content type='text'>
Because the read_persistent_clock interface is usually backed by
only a second granular interface, each time we read from the persistent
clock for suspend/resume, we introduce a half second (on average) of error.

In order to avoid this error accumulating as the system is suspended
over and over, this patch measures the time delta between the persistent
clock and the system CLOCK_REALTIME.

If the delta is less then 2 seconds from the last suspend, we compensate
by using the previous time delta (keeping it close). If it is larger
then 2 seconds, we assume the clock was set or has been changed, so we
do no correction and update the delta.

Note: If NTP is running, ths could seem to "fight" with the NTP corrected
time, where as if the system time was off by 1 second, and NTP slewed the
value in, a suspend/resume cycle could undo this correction, by trying to
restore the previous offset from the persistent clock.  However, without
this patch, since each read could cause almost a full second worth of
error, its possible to get almost 2 seconds of error just from the
suspend/resume cycle alone, so this about equal to any offset added by
the compensation.

Further on systems that suspend/resume frequently, this should keep time
closer then NTP could compensate for if the errors were allowed to
accumulate.

Credits to Arve Hjønnevåg for suggesting this solution.

CC: Arve Hjønnevåg &lt;arve@android.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>time: Catch invalid timespec sleep values in __timekeeping_inject_sleeptime</title>
<updated>2011-06-21T23:55:36Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-06-02T01:18:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cb5de2f8d0306be38f9b377b8a5c56acca7dbc3d'/>
<id>urn:sha1:cb5de2f8d0306be38f9b377b8a5c56acca7dbc3d</id>
<content type='text'>
Arve suggested making sure we catch possible negative sleep time
intervals that could be passed into timekeeping_inject_sleeptime.

CC: Arve Hjønnevåg &lt;arve@android.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>timerfd: Allow timers to be cancelled when clock was set</title>
<updated>2011-05-02T19:39:15Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2011-04-27T12:16:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=99ee5315dac6211e972fa3f23bcc9a0343ff58c4'/>
<id>urn:sha1:99ee5315dac6211e972fa3f23bcc9a0343ff58c4</id>
<content type='text'>
Some applications must be aware of clock realtime being set
backward. A simple example is a clock applet which arms a timer for
the next minute display. If clock realtime is set backward then the
applet displays a stale time for the amount of time which the clock
was set backwards. Due to that applications poll the time because we
don't have an interface.

Extend the timerfd interface by adding a flag which puts the timer
onto a different internal realtime clock. All timers on this clock are
expired whenever the clock was set.

The timerfd core records the monotonic offset when the timer is
created. When the timer is armed, then the current offset is compared
to the previous recorded offset. When it has changed, then
timerfd_settime returns -ECANCELED. When a timer is read the offset is
compared and if it changed -ECANCELED returned to user space. Periodic
timers are not rearmed in the cancelation case.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: Chris Friesen &lt;chris.friesen@genband.com&gt;
Tested-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Cc: "Kirill A. Shutemov" &lt;kirill@shutemov.name&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Davide Libenzi &lt;davidel@xmailserver.org&gt;
Reviewed-by: Alexander Shishkin &lt;virtuoso@slind.org&gt;
Link: http://lkml.kernel.org/r/%3Calpine.LFD.2.02.1104271359580.3323%40ionos%3E
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>hrtimers: Prepare for cancel on clock was set timers</title>
<updated>2011-05-02T19:37:58Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2011-05-02T14:48:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b12a03ce4880bd13786a98db6de494a3e0123129'/>
<id>urn:sha1:b12a03ce4880bd13786a98db6de494a3e0123129</id>
<content type='text'>
Make clock_was_set() unconditional and rename hres_timers_resume to
hrtimers_resume. This is a preparatory patch for hrtimers which are
cancelled when clock realtime was set.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Add timekeeping_inject_sleeptime</title>
<updated>2011-04-26T21:01:41Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-04-01T21:32:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=304529b1b6f8612ccbb4582e997051b48b94f4a4'/>
<id>urn:sha1:304529b1b6f8612ccbb4582e997051b48b94f4a4</id>
<content type='text'>
Some platforms cannot implement read_persistent_clock, as
their RTC devices are only accessible when interrupts are enabled.
This keeps them from being used by the timekeeping code on resume
to measure the time in suspend.

The RTC layer tries to work around this, by calling do_settimeofday
on resume after irqs are reenabled to set the time properly. However,
this only corrects CLOCK_REALTIME, and does not properly adjust
the sleep time value. This causes btime in /proc/stat to be incorrect
as well as making the new CLOCK_BOTTTIME inaccurate.

This patch resolves the issue by introducing a new timekeeping hook
to allow the RTC layer to inject the sleep time on resume.

The code also checks to make sure that read_persistent_clock is
nonfunctional before setting the sleep time, so that should the RTC's
HCTOSYS option be configured in on a system that does support
read_persistent_clock we will not increase the total_sleep_time twice.

CC: Arve Hjønnevåg &lt;arve@android.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>timekeeping: Use syscore_ops instead of sysdev class and sysdev</title>
<updated>2011-03-23T21:16:04Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2011-03-23T21:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e1a85b2c519551d4792180cdab4074d7e99bf2c9'/>
<id>urn:sha1:e1a85b2c519551d4792180cdab4074d7e99bf2c9</id>
<content type='text'>
The timekeeping subsystem uses a sysdev class and a sysdev for
executing timekeeping_suspend() after interrupts have been turned off
on the boot CPU (during system suspend) and for executing
timekeeping_resume() before turning on interrupts on the boot CPU
(during system resume).  However, since both of these functions
ignore their arguments, the entire mechanism may be replaced with a
struct syscore_ops object which is simpler.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Extend get_xtime_and_monotonic_offset() to also return sleep</title>
<updated>2011-02-21T20:53:07Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-02-15T02:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=314ac37150011ebb398f522db528d2dbcc611189'/>
<id>urn:sha1:314ac37150011ebb398f522db528d2dbcc611189</id>
<content type='text'>
Extend get_xtime_and_monotonic_offset to
get_xtime_and_monotonic_and_sleep_offset().

CC: Jamie Lokier &lt;jamie@shareable.org&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
CC: Alexander Shishkin &lt;virtuoso@slind.org&gt;
CC: Arve Hjønnevåg &lt;arve@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>time: Introduce get_monotonic_boottime and ktime_get_boottime</title>
<updated>2011-02-21T20:53:05Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-02-15T01:52:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=abb3a4ea2e0ea7114a4475745da2f32bd9ad5b73'/>
<id>urn:sha1:abb3a4ea2e0ea7114a4475745da2f32bd9ad5b73</id>
<content type='text'>
This adds new functions that return the monotonic time since boot
(in other words, CLOCK_MONOTONIC + suspend time).

CC: Jamie Lokier &lt;jamie@shareable.org&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
CC: Alexander Shishkin &lt;virtuoso@slind.org&gt;
CC: Arve Hjønnevåg &lt;arve@android.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>time: Introduce timekeeping_inject_offset</title>
<updated>2011-02-02T14:28:18Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2011-02-01T13:52:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c528f7c6c208f1fae6b4025957173dec045e5f21'/>
<id>urn:sha1:c528f7c6c208f1fae6b4025957173dec045e5f21</id>
<content type='text'>
This adds a kernel-internal timekeeping interface to add or subtract
a fixed amount from CLOCK_REALTIME. This makes it so kernel users or
interfaces trying to do so do not have to read the time, then add an
offset and then call settimeofday(), which adds some extra error in
comparision to just simply adding the offset in the kernel timekeeping
core.

Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Richard Cochran &lt;richard.cochran@omicron.at&gt;
LKML-Reference: &lt;20110201134419.584311693@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
</feed>
