summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/include/linux
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-06-24 22:03:40 +0000
committercheloha <cheloha@openbsd.org>2020-06-24 22:03:40 +0000
commit3209772dfcc3950dd5df01bc44eebf75e637511e (patch)
tree674a3736a2e3e277e801c3c22c1430cb8a2d032f /sys/dev/pci/drm/include/linux
parentFirst stab at making signal handling work. (diff)
downloadwireguard-openbsd-3209772dfcc3950dd5df01bc44eebf75e637511e.tar.xz
wireguard-openbsd-3209772dfcc3950dd5df01bc44eebf75e637511e.zip
kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)
time_second(9) and time_uptime(9) are widely used in the kernel to quickly get the system UTC or system uptime as a time_t. However, time_t is 64-bit everywhere, so it is not generally safe to use them on 32-bit platforms: you have a split-read problem if your hardware cannot perform atomic 64-bit reads. This patch replaces time_second(9) with gettime(9), a safer successor interface, throughout the kernel. Similarly, time_uptime(9) is replaced with getuptime(9). There is a performance cost on 32-bit platforms in exchange for eliminating the split-read problem: instead of two register reads you now have a lockless read loop to pull the values from the timehands. This is really not *too* bad in the grand scheme of things, but compared to what we were doing before it is several times slower. There is no performance cost on 64-bit (__LP64__) platforms. With input from visa@, dlg@, and tedu@. Several bugs squashed by visa@. ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm/include/linux')
-rw-r--r--sys/dev/pci/drm/include/linux/timekeeping.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/include/linux/timekeeping.h b/sys/dev/pci/drm/include/linux/timekeeping.h
index c6aa77583c7..cd596d2e9ec 100644
--- a/sys/dev/pci/drm/include/linux/timekeeping.h
+++ b/sys/dev/pci/drm/include/linux/timekeeping.h
@@ -3,7 +3,7 @@
#ifndef _LINUX_TIMEKEEPING_H
#define _LINUX_TIMEKEEPING_H
-#define get_seconds() time_second
+#define get_seconds() gettime()
#define getrawmonotonic(x) nanouptime(x)
#define ktime_mono_to_real(x) (x)