summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-07-07 04:05:25 +0000
committercheloha <cheloha@openbsd.org>2020-07-07 04:05:25 +0000
commit448c5a95e201685e3db38859d774d48722d48d1a (patch)
tree03cbe3ba8a7adabd2a8952d8b31c24cb2defa867 /sys
parentcorrect recently broken comments (diff)
downloadwireguard-openbsd-448c5a95e201685e3db38859d774d48722d48d1a.tar.xz
wireguard-openbsd-448c5a95e201685e3db38859d774d48722d48d1a.zip
drm: use hi-res time to implement ktime_get(), ktime_get_real()
There seems to have been some confusion about the granularity of certain time interfaces in the Linux kernel when our DRM compatibility layer was written. To be clear: the Linux ktime_get() and ktime_get_real() interfaces are *high resolution* clocks. We should to implement them with high resolution interfaces from our own kernel. Thus, use microuptime(9) to implement ktime_get() and microtime(9) to implement ktime_get_real(). While here, ktime_get_raw_ns() should use ktime_get_raw(), not ktime_get(). Discussed with kettenis@ and jsg@. ok jsg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/include/linux/ktime.h6
-rw-r--r--sys/dev/pci/drm/include/linux/timekeeping.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/include/linux/ktime.h b/sys/dev/pci/drm/include/linux/ktime.h
index 8edf0205069..4e744bd9e66 100644
--- a/sys/dev/pci/drm/include/linux/ktime.h
+++ b/sys/dev/pci/drm/include/linux/ktime.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktime.h,v 1.3 2020/06/29 08:42:00 jsg Exp $ */
+/* $OpenBSD: ktime.h,v 1.4 2020/07/07 04:05:25 cheloha Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@@ -29,7 +29,7 @@ ktime_get(void)
{
struct timeval tv;
- getmicrouptime(&tv);
+ microuptime(&tv);
return tv;
}
@@ -63,7 +63,7 @@ ktime_to_ns(struct timeval tv)
static inline int64_t
ktime_get_raw_ns(void)
{
- return ktime_to_ns(ktime_get());
+ return ktime_to_ns(ktime_get_raw());
}
static inline struct timespec64
diff --git a/sys/dev/pci/drm/include/linux/timekeeping.h b/sys/dev/pci/drm/include/linux/timekeeping.h
index ea19385fad6..a2a6828e966 100644
--- a/sys/dev/pci/drm/include/linux/timekeeping.h
+++ b/sys/dev/pci/drm/include/linux/timekeeping.h
@@ -16,7 +16,7 @@ static inline struct timeval
ktime_get_real(void)
{
struct timeval tv;
- getmicrotime(&tv);
+ microtime(&tv);
return tv;
}