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/dist/drm/i915 i915: Avoid freeing anyt...



details:   https://anonhg.NetBSD.org/src/rev/018e4d9085dc
branches:  trunk
changeset: 363933:018e4d9085dc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 16 23:32:52 2022 +0000

description:
i915: Avoid freeing anything under a spin lock.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_active.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 72bd08b80742 -r 018e4d9085dc sys/external/bsd/drm2/dist/drm/i915/i915_active.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_active.c Wed Mar 16 20:31:01 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_active.c Wed Mar 16 23:32:52 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_active.c,v 1.13 2022/02/27 14:18:42 riastradh Exp $       */
+/*     $NetBSD: i915_active.c,v 1.14 2022/03/16 23:32:52 riastradh Exp $       */
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.13 2022/02/27 14:18:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.14 2022/03/16 23:32:52 riastradh Exp $");
 
 #include <linux/debugobjects.h>
 
@@ -301,7 +301,6 @@
        node = rb_tree_find_node(&ref->tree.rbr_tree, &idx);
        if (node) {
                KASSERT(node->timeline == idx);
-               kmem_cache_free(global.slab_cache, prealloc);
                goto out;
        }
 #else
@@ -324,6 +323,7 @@
 #endif
 
        node = prealloc;
+       prealloc = NULL;
        __i915_active_fence_init(&node->base, NULL, node_retire);
        node->ref = ref;
        node->timeline = idx;
@@ -341,6 +341,11 @@
        ref->cache = node;
        spin_unlock_irq(&ref->tree_lock);
 
+#ifdef __NetBSD__
+       if (prealloc)
+               kmem_cache_free(global.slab_cache, prealloc);
+#endif
+
        BUILD_BUG_ON(offsetof(typeof(*node), base));
        return &node->base;
 }



Home | Main Index | Thread Index | Old Index