History

timekeeping: Introduce fast accessor to clock tai

Introduce fast/NMI safe accessor to clock tai for tracing. The Linux kernel tracing infrastructure has support for using different clocks to generate timestamps for trace events. Especially in TSN networks it's useful to have TAI as trace clock, because the application scheduling is done in accordance to the network time, which is based on TAI. With a tai trace_clock in place, it becomes very convenient to correlate network activity with Linux kernel application traces. Use the same implementation as ktime_get_boot_fast_ns() does by reading the monotonic time and adding the TAI offset. The same limitations as for the fast boot implementation apply. The TAI offset may change at run time e.g., by setting the time or using adjtimex() with an offset. However, these kind of offset changes are rare events. Nevertheless, the user has to be aware and deal with it in post processing. An alternative approach would be to use the same implementation as ktime_get_real_fast_ns() does. However, this requires to add an additional u64 member to the tk_read_base struct. This struct together with a seqcount is designed to fit into a single cache line on 64 bit architectures. Adding a new member would violate this constraint.

Kurt Kanzenbach committed 4 years ago

Commit 3dc6ffa1 parent ce522ba3 files · +19 −0Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/timekeeping.h+1−0
@@ -177,6 +177,7 @@ static inline u64 ktime_get_raw_ns(void) · 176 unmodified lines
177177 extern u64 ktime_get_mono_fast_ns(void);
178178 extern u64 ktime_get_raw_fast_ns(void);
179179 extern u64 ktime_get_boot_fast_ns(void);
180+extern u64 ktime_get_tai_fast_ns(void);
180181 extern u64 ktime_get_real_fast_ns(void);
181182
182183 /*