<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/kernel/time/timekeeping.c, branch jd/bump-compilers</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/kernel/time/timekeeping.c?h=jd%2Fbump-compilers</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/kernel/time/timekeeping.c?h=jd%2Fbump-compilers'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2024-08-05T14:14:14Z</updated>
<entry>
<title>timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()</title>
<updated>2024-08-05T14:14:14Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2024-08-03T15:07:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=5916be8a53de6401871bdd953f6c60237b47d6d3'/>
<id>urn:sha1:5916be8a53de6401871bdd953f6c60237b47d6d3</id>
<content type='text'>
The addition of the bases argument to clock_was_set() fixed up all call
sites correctly except for do_adjtimex(). This uses CLOCK_REALTIME
instead of CLOCK_SET_WALL as argument. CLOCK_REALTIME is 0.

As a result the effect of that clock_was_set() notification is incomplete
and might result in timers expiring late because the hrtimer code does
not re-evaluate the affected clock bases.

Use CLOCK_SET_WALL instead of CLOCK_REALTIME to tell the hrtimers code
which clock bases need to be re-evaluated.

Fixes: 17a1b8826b45 ("hrtimer: Add bases argument to clock_was_set()")
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/877ccx7igo.ffs@tglx

</content>
</entry>
<entry>
<title>timekeeping: Add missing kernel-doc function comments</title>
<updated>2024-06-23T17:57:30Z</updated>
<author>
<name>Yang Li</name>
<email>yang.lee@linux.alibaba.com</email>
</author>
<published>2024-06-07T09:06:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e1b6a78b58aa859c66a32cfaeb121df87631d4ed'/>
<id>urn:sha1:e1b6a78b58aa859c66a32cfaeb121df87631d4ed</id>
<content type='text'>
Fixup the incomplete kernel-doc style comments for do_adjtimex() and
hardpps() by documenting the function parameters.

Reported-by: Abaci Robot &lt;abaci@linux.alibaba.com&gt;
Signed-off-by: Yang Li &lt;yang.lee@linux.alibaba.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240607090656.104883-1-yang.lee@linux.alibaba.com
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9301
</content>
</entry>
<entry>
<title>timekeeping: Add function to convert realtime to base clock</title>
<updated>2024-06-03T09:18:51Z</updated>
<author>
<name>Lakshmi Sowjanya D</name>
<email>lakshmi.sowjanya.d@intel.com</email>
</author>
<published>2024-05-13T10:38:10Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/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>
<entry>
<title>timekeeping: Provide infrastructure for converting to/from a base clock</title>
<updated>2024-06-03T09:18:50Z</updated>
<author>
<name>Lakshmi Sowjanya D</name>
<email>lakshmi.sowjanya.d@intel.com</email>
</author>
<published>2024-05-13T10:38:02Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=6b2e29977518ec13ef3022f234ff8f3014c243da'/>
<id>urn:sha1:6b2e29977518ec13ef3022f234ff8f3014c243da</id>
<content type='text'>
Hardware time stamps like provided by PTP clock implementations are based
on a clock which feeds both the PCIe device and the system clock. For
further processing the underlying hardwarre clock timestamp must be
converted to the system clock.

Right now this requires drivers to invoke an architecture specific
conversion function, e.g. to convert the ART (Always Running Timer)
timestamp to a TSC timestamp.

As the system clock is aware of the underlying base clock, this can be
moved to the core code by providing a base clock property for the system
clock which contains the conversion factors and assigning a clocksource ID
to the base clock.

Add the required data structures and the conversion infrastructure in the
core code to prepare for converting X86 and the related PTP drivers over.

[ tglx: Added a missing READ_ONCE(). Massaged change log ]

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-2-lakshmi.sowjanya.d@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Let timekeeping_cycles_to_ns() handle both under and overflow</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=135225a363ae67bc90bde7a2cbbe1ea0f152ba22'/>
<id>urn:sha1:135225a363ae67bc90bde7a2cbbe1ea0f152ba22</id>
<content type='text'>
For the case !CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE, forego overflow
protection in the range (mask &lt;&lt; 1) &lt; delta &lt;= mask, and interpret it
always as an inconsistency between CPU clock values. That allows
slightly neater code, and it is on a slow path so has no effect on
performance.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-19-adrian.hunter@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Make delta calculation overflow safe</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=fcf190c369149c3b04539797cedf28741eb14164'/>
<id>urn:sha1:fcf190c369149c3b04539797cedf28741eb14164</id>
<content type='text'>
Kernel timekeeping is designed to keep the change in cycles (since the last
timer interrupt) below max_cycles, which prevents multiplication overflow
when converting cycles to nanoseconds. However, if timer interrupts stop,
the calculation will eventually overflow.

Add protection against that. In timekeeping_cycles_to_ns() calculation,
check against max_cycles, falling back to a slower higher precision
calculation. In timekeeping_forward_now(), process delta in chunks of at
most max_cycles.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-18-adrian.hunter@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Prepare timekeeping_cycles_to_ns() for overflow safety</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e809a80aa0bcf802f99407c23fd6be6fd4eb250a'/>
<id>urn:sha1:e809a80aa0bcf802f99407c23fd6be6fd4eb250a</id>
<content type='text'>
Open code clocksource_delta() in timekeeping_cycles_to_ns() so that
overflow safety can be added efficiently.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-17-adrian.hunter@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Fold in timekeeping_delta_to_ns()</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=3094c6db1cba0bbca6ea19c777762c26fee747d7'/>
<id>urn:sha1:3094c6db1cba0bbca6ea19c777762c26fee747d7</id>
<content type='text'>
timekeeping_delta_to_ns() is now called only from
timekeeping_cycles_to_ns(), and it is not useful otherwise.

Simplify the code by folding it into timekeeping_cycles_to_ns().

No functional change.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-16-adrian.hunter@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Consolidate timekeeping helpers</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e84f43e34faf85816587f80594541ec978449d6e'/>
<id>urn:sha1:e84f43e34faf85816587f80594541ec978449d6e</id>
<content type='text'>
Consolidate timekeeping helpers, making use of timekeeping_cycles_to_ns()
in preference to directly using timekeeping_delta_to_ns().

No functional change.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-15-adrian.hunter@intel.com

</content>
</entry>
<entry>
<title>timekeeping: Refactor timekeeping helpers</title>
<updated>2024-04-08T13:03:08Z</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@intel.com</email>
</author>
<published>2024-03-25T06:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e8e9d21a5df655a62ab4611fd437fb7510d2f85c'/>
<id>urn:sha1:e8e9d21a5df655a62ab4611fd437fb7510d2f85c</id>
<content type='text'>
Simplify the usage of timekeeping sanity checking, in preparation for
consolidating timekeeping helpers. This works towards eliminating
timekeeping_delta_to_ns() in favour of timekeeping_cycles_to_ns().

No functional change.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Adrian Hunter &lt;adrian.hunter@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20240325064023.2997-14-adrian.hunter@intel.com

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