Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:03:48 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/i915: i915_request.c

Log Message:
i915: Defer i915_sw_fence_fini to `kmem' (pool) cache destructor.

We actually need to destroy the spin lock here, whereas in Linux this
is only used for tracking when sw fences are _technically_ in use or
not -- where `not in use' includes RCU grace periods -- and it's OK
to `destroy' a fence while the grace periods are still running.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
    src/sys/external/bsd/drm2/dist/drm/i915/i915_request.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/dist/drm/i915/i915_request.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c:1.9	Sun Dec 19 12:00:48 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_request.c	Sun Dec 19 12:03:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_request.c,v 1.9 2021/12/19 12:00:48 riastradh Exp $	*/
+/*	$NetBSD: i915_request.c,v 1.10 2021/12/19 12:03:48 riastradh Exp $	*/
 
 /*
  * Copyright © 2008-2015 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.9 2021/12/19 12:00:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.10 2021/12/19 12:03:48 riastradh Exp $");
 
 #include <linux/dma-fence-array.h>
 #include <linux/irq_work.h>
@@ -118,8 +118,10 @@ static void i915_fence_release(struct dm
 	 * freed when the slab cache itself is freed, and so we would get
 	 * caught trying to reuse dead objects.
 	 */
+#ifndef __NetBSD__
 	i915_sw_fence_fini(&rq->submit);
 	i915_sw_fence_fini(&rq->semaphore);
+#endif
 
 	kmem_cache_free(global.slab_requests, rq);
 }
@@ -613,6 +615,10 @@ static void __i915_request_dtor(void *ar
 	struct i915_request *rq = arg;
 
 	dma_fence_destroy(&rq->fence);
+#ifdef __NetBSD__
+	i915_sw_fence_fini(&rq->submit);
+	i915_sw_fence_fini(&rq->semaphore);
+#endif
 	spin_lock_destroy(&rq->lock);
 }
 

Reply via email to