Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:41:07 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h

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

This faux timeout means `wait forever'.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
    src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.17 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.18
--- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.17	Fri Jul  3 16:23:02 2020
+++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h	Sun Dec 19 12:41:07 2021
@@ -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 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 		/* 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 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 		(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 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 		(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;				\

Reply via email to