Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:26:30 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/linux: linux_dma_resv.c

Log Message:
drm: Fix dma_resv_test_signaled_rcu and dma_resv_wait_timeout_rcu.

Make them implemented the semantics as documented like Linux does:
only test the exclusive fence if there's no shared fences.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/linux/linux_dma_resv.c

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/linux/linux_dma_resv.c
diff -u src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.14 src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.15
--- src/sys/external/bsd/drm2/linux/linux_dma_resv.c:1.14	Sun Dec 19 12:26:22 2021
+++ src/sys/external/bsd/drm2/linux/linux_dma_resv.c	Sun Dec 19 12:26:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_dma_resv.c,v 1.14 2021/12/19 12:26:22 riastradh Exp $	*/
+/*	$NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.14 2021/12/19 12:26:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/poll.h>
@@ -1044,6 +1044,8 @@ top:	KASSERT(fence == NULL);
 		if (!dma_resv_read_valid(robj, &ticket))
 			goto restart;
 	}
+	if (shared_count)
+		goto out;
 
 	/* If there is an exclusive fence, test it.  */
 	KASSERT(fence == NULL);
@@ -1131,6 +1133,8 @@ top:	KASSERT(fence == NULL);
 		if (!dma_resv_read_valid(robj, &ticket))
 			goto restart;
 	}
+	if (shared_count)
+		goto out;
 
 	/* If there is an exclusive fence, test it.  */
 	KASSERT(fence == NULL);
@@ -1144,7 +1148,7 @@ top:	KASSERT(fence == NULL);
 		fence = NULL;
 	}
 
-	/* Success!  Return the number of ticks left.  */
+out:	/* Success!  Return the number of ticks left.  */
 	rcu_read_unlock();
 	KASSERT(fence == NULL);
 	return timeout;

Reply via email to