Skip to contentSkip to conversation

drm/i915/buddy: tidy up i915_buddy_fini

PATCH In review Matthew Auld 3 participants 3 messages Aug 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/buddy: tidy up i915_buddy_fini

If we are leaking nodes don't hide it. Also stop trying to be "defensive" and instead embrace Kasan et al.

---
 drivers/gpu/drm/i915/i915_buddy.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_buddy.c +1 -6
index b679ab6fd889..5995247fdf76 100644
@@ -171,15 +171,10 @@ int i915_buddy_init(struct i915_buddy_mm *mm, u64 size, u64 chunk_size)
 
 void i915_buddy_fini(struct i915_buddy_mm *mm)
 {
-	int err = 0;
 	int i;
 
 	for (i = 0; i < mm->n_roots; ++i) {
-		if (!i915_buddy_block_is_free(mm->roots[i])) {
-			err = -EBUSY;
-			continue;
-		}
-
+		GEM_WARN_ON(!i915_buddy_block_is_free(mm->roots[i]));
 		i915_block_free(mm->roots[i]);
 	}
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Matthew Auld (2019-08-16 11:03:26)

Quoted 2 lines

If we are leaking nodes don't hide it. Also stop trying to be "defensive" and instead embrace Kasan et al.

If you want to go even further, record the stacks of each allocator.

As we are using kmalloc of each node and operate like a cache, we can do something like kmemleak_update_trace() on i915_buddy_alloc().

drivers/gpu/drm/i915/i915_buddy.c +2 -0
index b679ab6fd889..3b30e05ffe53 100644
@@ -3,6 +3,7 @@
  * Copyright © 2019 Intel Corporation
  */
 
+#include <linux/kmemleak.h>
 #include <linux/slab.h>
 
 #include "i915_buddy.h"
@@ -309,6 +310,7 @@ i915_buddy_alloc(struct i915_buddy_mm *mm, unsigned int order)
        }
 
        mark_allocated(block);
+       kmemleak_update_trace(block);
        return block;
 

should do the trick

Quoted 30 lines
---
 drivers/gpu/drm/i915/i915_buddy.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_buddy.c +1 -6
index b679ab6fd889..5995247fdf76 100644
@@ -171,15 +171,10 @@ int i915_buddy_init(struct i915_buddy_mm *mm, u64 size, u64 chunk_size)
 
 void i915_buddy_fini(struct i915_buddy_mm *mm)
 {
-       int err = 0;
        int i;
 
        for (i = 0; i < mm->n_roots; ++i) {
-               if (!i915_buddy_block_is_free(mm->roots[i])) {
-                       err = -EBUSY;
-                       continue;
-               }
-
+               GEM_WARN_ON(!i915_buddy_block_is_free(mm->roots[i]));
                i915_block_free(mm->roots[i]);
        }
 
Signature · 1 line
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✗ Fi.CI.BAT: failure for drm/i915/buddy: tidy up i915_buddy_fini (rev2)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915/buddy: tidy up i915_buddy_fini (rev2)
URL : https://patchwork.freedesktop.org/series/65299/
State : failure

== Summary ==

Applying: drm/i915/buddy: tidy up i915_buddy_fini
error: corrupt patch at line 20
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch Patch failed at 0001 drm/i915/buddy: tidy up i915_buddy_fini When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx