Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/drm drm: Ensure DRM_*WAIT* nev...



details:   https://anonhg.NetBSD.org/src/rev/01eb6397c8ad
branches:  trunk
changeset: 1029000:01eb6397c8ad
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:41:07 2021 +0000

description:
drm: Ensure DRM_*WAIT* never counts down from MAX_SCHEDULE_TIMEOUT.

This faux timeout means `wait forever'.

diffstat:

 sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r a8ffa18667bd -r 01eb6397c8ad sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h
--- a/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h       Sun Dec 19 12:40:59 2021 +0000
+++ b/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h       Sun Dec 19 12:41:07 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_wait_netbsd.h,v 1.17 2020/07/03 16:23:02 maxv Exp $        */
+/*     $NetBSD: drm_wait_netbsd.h,v 1.18 2021/12/19 12:41:07 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
 
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
+#include <linux/sched.h>
 
 typedef kcondvar_t drm_waitqueue_t;
 
@@ -144,7 +145,9 @@
                /* XXX errno NetBSD->Linux */                                 \
                (RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->sl_lock, 1);     \
                _dswo_end = getticks();                                       \
-               if (_dswo_end - _dswo_start < _dswo_ticks)                    \
+               if (_dswo_ticks == MAX_SCHEDULE_TIMEOUT)                      \
+                       /* nothing, never time out */;                        \
+               else if (_dswo_end - _dswo_start < _dswo_ticks)               \
                        _dswo_ticks -= _dswo_end - _dswo_start;               \
                else                                                          \
                        _dswo_ticks = 0;                                      \
@@ -244,7 +247,9 @@
                (RET) = -WAIT((Q), &(INTERLOCK)->mtx_lock,              \
                    MIN(_dtwu_ticks, INT_MAX/2));                       \
                _dtwu_end = getticks();                                 \
-               if ((_dtwu_end - _dtwu_start) < _dtwu_ticks)            \
+               if (_dtwu_ticks == MAX_SCHEDULE_TIMEOUT)                \
+                       /* nothing, never time out */;                  \
+               else if ((_dtwu_end - _dtwu_start) < _dtwu_ticks)       \
                        _dtwu_ticks -= _dtwu_end - _dtwu_start;         \
                else                                                    \
                        _dtwu_ticks = 0;                                \
@@ -319,7 +324,9 @@
                (RET) = -WAIT((Q), &(INTERLOCK)->sl_lock,               \
                    MIN(_dstwu_ticks, INT_MAX/2));                      \
                _dstwu_end = getticks();                                \
-               if ((_dstwu_end - _dstwu_start) < _dstwu_ticks)         \
+               if (_dstwu_ticks == MAX_SCHEDULE_TIMEOUT)               \
+                       /* nothing, never time out */;                  \
+               else if ((_dstwu_end - _dstwu_start) < _dstwu_ticks)    \
                        _dstwu_ticks -= _dstwu_end - _dstwu_start;      \
                else                                                    \
                        _dstwu_ticks = 0;                               \



Home | Main Index | Thread Index | Old Index