aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping_internal.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-08-04 17:01:23 +0200
committerThomas Gleixner <tglx@linutronix.de>2020-08-06 10:57:30 +0200
commit19d0070a2792181f79df01277fe00b83b9f7eda7 (patch)
treee722934929bb2c9a7a9439211a20018c081a564a /kernel/time/timekeeping_internal.h
parentvdso/treewide: Add vdso_data pointer argument to __arch_get_hw_counter() (diff)
downloadlinux-dev-19d0070a2792181f79df01277fe00b83b9f7eda7.tar.xz
linux-dev-19d0070a2792181f79df01277fe00b83b9f7eda7.zip
timekeeping/vsyscall: Provide vdso_update_begin/end()
Architectures can have the requirement to add additional architecture specific data to the VDSO data page which needs to be updated independent of the timekeeper updates. To protect these updates vs. concurrent readers and a conflicting update through timekeeping, provide helper functions to make such updates safe. vdso_update_begin() takes the timekeeper_lock to protect against a potential update from timekeeper code and increments the VDSO sequence count to signal data inconsistency to concurrent readers. vdso_update_end() makes the sequence count even again to signal data consistency and drops the timekeeper lock. [ Sven: Add interrupt disable handling to the functions ] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20200804150124.41692-3-svens@linux.ibm.com
Diffstat (limited to 'kernel/time/timekeeping_internal.h')
-rw-r--r--kernel/time/timekeeping_internal.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h
index bcbb52db2256..4ca2787d1642 100644
--- a/kernel/time/timekeeping_internal.h
+++ b/kernel/time/timekeeping_internal.h
@@ -1,12 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _TIMEKEEPING_INTERNAL_H
#define _TIMEKEEPING_INTERNAL_H
-/*
- * timekeeping debug functions
- */
+
#include <linux/clocksource.h>
+#include <linux/spinlock.h>
#include <linux/time.h>
+/*
+ * timekeeping debug functions
+ */
#ifdef CONFIG_DEBUG_FS
extern void tk_debug_account_sleep_time(const struct timespec64 *t);
#else
@@ -31,4 +33,7 @@ static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
}
#endif
+/* Semi public for serialization of non timekeeper VDSO updates. */
+extern raw_spinlock_t timekeeper_lock;
+
#endif /* _TIMEKEEPING_INTERNAL_H */