<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/timekeeping.h, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-07-03T12:44:15+00:00</updated>
<entry>
<title>timekeeping: Remove the temporary CLOCK_AUX workaround</title>
<updated>2025-07-03T12:44:15+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2025-07-03T12:39:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8959338617a85e35820e3a7fa21801cf55b068bf'/>
<id>urn:sha1:8959338617a85e35820e3a7fa21801cf55b068bf</id>
<content type='text'>
ktime_get_clock_ts64() was provided for the networking tree as a stand
alone commit based on v6.16-rc1. It contains a temporary workaround for the
CLOCK_AUX* defines, which are only available in the timekeeping tree.

As this commit is now merged into the timers/ptp branch, which contains the
real CLOCK_AUX* defines, the workaround is obsolete.

Remove it.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/20250701130923.579834908@linutronix.de
</content>
</entry>
<entry>
<title>Merge tag 'ktime-get-clock-ts64-for-ptp' into timers/ptp</title>
<updated>2025-07-03T12:35:53+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2025-07-03T12:35:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a6d9638d4da9740c189c141510584161ffd84307'/>
<id>urn:sha1:a6d9638d4da9740c189c141510584161ffd84307</id>
<content type='text'>
Pull the base implementation of ktime_get_clock_ts64() for PTP, which
contains a temporary CLOCK_AUX* workaround. That was created to allow
integration of depending changes into the networking tree. The workaround
is going to be removed in a subsequent change in the timekeeping tree.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>timekeeping: Provide ktime_get_clock_ts64()</title>
<updated>2025-07-03T12:18:06+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2025-07-01T13:26:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5b605dbee07dda8fd538af1f07cbf1baf0a49cbc'/>
<id>urn:sha1:5b605dbee07dda8fd538af1f07cbf1baf0a49cbc</id>
<content type='text'>
PTP implements an inline switch case for taking timestamps from various
POSIX clock IDs, which already consumes quite some text space. Expanding it
for auxiliary clocks really becomes too big for inlining.

Provide a out of line version. 

The function invalidates the timestamp in case the clock is invalid. The
invalidation allows to implement a validation check without the need to
propagate a return value through deep existing call chains.

Due to merge logistics this temporarily defines CLOCK_AUX[_LAST] if
undefined, so that the plain branch, which does not contain any of the core
timekeeper changes, can be pulled into the networking tree as prerequisite
for the PTP side changes. These temporary defines are removed after that
branch is merged into the tip::timers/ptp branch. That way the result in
-next or upstream in the next merge window has zero dependencies.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Vadim Fedorenko &lt;vadim.fedorenko@linux.dev&gt;
Acked-by: John Stultz &lt;jstultz@google.com&gt;
Link: https://lore.kernel.org/all/20250701132628.357686408@linutronix.de

</content>
</entry>
<entry>
<title>timekeeping: Provide time getters for auxiliary clocks</title>
<updated>2025-06-27T18:13:12+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2025-06-25T18:38:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=05bc6e6290f91d2d40086ab4ef52da21c14ec4b6'/>
<id>urn:sha1:05bc6e6290f91d2d40086ab4ef52da21c14ec4b6</id>
<content type='text'>
Provide interfaces similar to the ktime_get*() family which provide access
to the auxiliary clocks.

These interfaces have a boolean return value, which indicates whether the
accessed clock is valid or not.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: John Stultz &lt;jstultz@google.com&gt;
Link: https://lore.kernel.org/all/20250625183757.868342628@linutronix.de

</content>
</entry>
<entry>
<title>timekeeping: Remove unused ktime_get_fast_timestamps()</title>
<updated>2025-01-15T18:49:14+00:00</updated>
<author>
<name>Dr. David Alan Gilbert</name>
<email>linux@treblig.org</email>
</author>
<published>2025-01-12T16:01:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d2a46cf23788a19e5450c6f9c86ab17f596c708'/>
<id>urn:sha1:2d2a46cf23788a19e5450c6f9c86ab17f596c708</id>
<content type='text'>
ktime_get_fast_timestamps() was added in 2020 by commit e2d977c9f1ab
("timekeeping: Provide multi-timestamp accessor to NMI safe timekeeper")
but has remained unused.

Remove it.

[ tglx: Fold the inline as David suggested in the submission ]

Signed-off-by: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/20250112160132.450209-1-linux@treblig.org

</content>
</entry>
<entry>
<title>Merge branch 'timers/vfs' into timers/core</title>
<updated>2024-10-06T19:00:01+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2024-10-06T19:00:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b7f6d3a09da3a2272cbce28bdd8f8c6db772a84e'/>
<id>urn:sha1:b7f6d3a09da3a2272cbce28bdd8f8c6db772a84e</id>
<content type='text'>
Pick up the VFS specific interfaces so further timekeeping changes can be
based on them.
</content>
</entry>
<entry>
<title>timekeeping: Add percpu counter for tracking floor swap events</title>
<updated>2024-10-06T18:56:07+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2024-10-02T21:27:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96f9a366ec8abe027326d7aab84d64370019f0f1'/>
<id>urn:sha1:96f9a366ec8abe027326d7aab84d64370019f0f1</id>
<content type='text'>
The mgtime_floor value is a global variable for tracking the latest
fine-grained timestamp handed out. Because it's a global, track the
number of times that a new floor value is assigned.

Add a new percpu counter to the timekeeping code to track the number of
floor swap events that have occurred. A later patch will add a debugfs
file to display this counter alongside other stats involving multigrain
timestamps.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Tested-by: Randy Dunlap &lt;rdunlap@infradead.org&gt; # documentation bits
Link: https://lore.kernel.org/all/20241002-mgtime-v10-2-d1c4717f5284@kernel.org

</content>
</entry>
<entry>
<title>timekeeping: Add interfaces for handling timestamps with a floor value</title>
<updated>2024-10-06T18:56:07+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2024-10-02T21:27:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=70c8fd00a9bd0509bbf7bccd9baea8bbd5ddc756'/>
<id>urn:sha1:70c8fd00a9bd0509bbf7bccd9baea8bbd5ddc756</id>
<content type='text'>
Multigrain timestamps allow the kernel to use fine-grained timestamps when
an inode's attributes is being actively observed via -&gt;getattr().  With
this support, it's possible for a file to get a fine-grained timestamp, and
another modified after it to get a coarse-grained stamp that is earlier
than the fine-grained time.  If this happens then the files can appear to
have been modified in reverse order, which breaks VFS ordering guarantees
[1].

To prevent this, maintain a floor value for multigrain timestamps.
Whenever a fine-grained timestamp is handed out, record it, and when later
coarse-grained stamps are handed out, ensure they are not earlier than that
value. If the coarse-grained timestamp is earlier than the fine-grained
floor, return the floor value instead.

Add a static singleton atomic64_t into timekeeper.c that is used to keep
track of the latest fine-grained time ever handed out. This is tracked as a
monotonic ktime_t value to ensure that it isn't affected by clock
jumps. Because it is updated at different times than the rest of the
timekeeper object, the floor value is managed independently of the
timekeeper via a cmpxchg() operation, and sits on its own cacheline.

Add two new public interfaces:

- ktime_get_coarse_real_ts64_mg() fills a timespec64 with the later of the
  coarse-grained clock and the floor time

- ktime_get_real_ts64_mg() gets the fine-grained clock value, and tries
  to swap it into the floor. A timespec64 is filled with the result.

The floor value is global and updated via a single try_cmpxchg(). If
that fails then the operation raced with a concurrent update. Any
concurrent update must be later than the existing floor value, so any
racing tasks can accept any resulting floor value without retrying.

[1]: POSIX requires that files be stamped with realtime clock values, and
     makes no provision for dealing with backward clock jumps. If a backward
     realtime clock jump occurs, then files can appear to have been modified
     in reverse order.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Tested-by: Randy Dunlap &lt;rdunlap@infradead.org&gt; # documentation bits
Acked-by: John Stultz &lt;jstultz@google.com&gt;
Link: https://lore.kernel.org/all/20241002-mgtime-v10-1-d1c4717f5284@kernel.org
</content>
</entry>
<entry>
<title>timekeeping: Add the boot clock to system time snapshot</title>
<updated>2024-10-02T15:10:41+00:00</updated>
<author>
<name>Vincent Donnefort</name>
<email>vdonnefort@google.com</email>
</author>
<published>2024-09-11T09:30:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8102c4daf44ab86c2d2226a8136bec905d6e2bd1'/>
<id>urn:sha1:8102c4daf44ab86c2d2226a8136bec905d6e2bd1</id>
<content type='text'>
For tracing purpose, the boot clock is interesting as it doesn't stop on
suspend. Export it as part of the time snapshot. This will later allow
the hypervisor to add boot clock timestamps to its events.

Signed-off-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: John Stultz &lt;jstultz@google.com&gt;
Link: https://lore.kernel.org/all/20240911093029.3279154-5-vdonnefort@google.com


</content>
</entry>
<entry>
<title>timekeeping: Add function to convert realtime to base clock</title>
<updated>2024-06-03T09:18:51+00:00</updated>
<author>
<name>Lakshmi Sowjanya D</name>
<email>lakshmi.sowjanya.d@intel.com</email>
</author>
<published>2024-05-13T10:38:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=02ecee07ca30f76f2a0f1381661a688b8e501ab0'/>
<id>urn:sha1:02ecee07ca30f76f2a0f1381661a688b8e501ab0</id>
<content type='text'>
PPS (Pulse Per Second) generates a hardware pulse every second based on
CLOCK_REALTIME. This works fine when the pulse is generated in software
from a hrtimer callback function.

For hardware which generates the pulse by programming a timer it is
required to convert CLOCK_REALTIME to the underlying hardware clock.

The X86 Timed IO device is based on the Always Running Timer (ART), which
is the base clock of the TSC, which is usually the system clocksource on
X86.

The core code already has functionality to convert base clock timestamps to
system clocksource timestamps, but there is no support for converting the
other way around.

Provide the required functionality to support such devices in a generic
way to avoid code duplication in drivers:

  1) ktime_real_to_base_clock() to convert a CLOCK_REALTIME timestamp to a
     base clock timestamp

  2) timekeeping_clocksource_has_base() to allow drivers to validate that
     the system clocksource is based on a particular clocksource ID.

[ tglx: Simplify timekeeping_clocksource_has_base() and add missing READ_ONCE() ]

Co-developed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Co-developed-by: Christopher S. Hall &lt;christopher.s.hall@intel.com&gt;
Signed-off-by: Christopher S. Hall &lt;christopher.s.hall@intel.com&gt;
Signed-off-by: Lakshmi Sowjanya D &lt;lakshmi.sowjanya.d@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240513103813.5666-10-lakshmi.sowjanya.d@intel.com

</content>
</entry>
</feed>
