Skip to contentSkip to conversation

drm/mm: kill color_search_free/get_block

PATCH In review Daniel Vetter 5 participants 9 messages Jul 1, 2013

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

PATCH 1/2 drm/mm: kill color_search_free/get_block

drm/i915 is the only user of the color allocation handling and switched to insert_node a while ago. So we can ditch this.

---
 include/drm/drm_mm.h | 31 -------------------------------
 1 file changed, 31 deletions(-)
include/drm/drm_mm.h +0 -31
index 88591ef..ab240f1 100644
@@ -177,17 +177,6 @@ static inline struct drm_mm_node *drm_mm_get_block_range(
 	return drm_mm_get_block_range_generic(parent, size, alignment, 0,
 					      start, end, 0);
 }
-static inline struct drm_mm_node *drm_mm_get_color_block_range(
-						struct drm_mm_node *parent,
-						unsigned long size,
-						unsigned alignment,
-						unsigned long color,
-						unsigned long start,
-						unsigned long end)
-{
-	return drm_mm_get_block_range_generic(parent, size, alignment, color,
-					      start, end, 0);
-}
 static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
 						struct drm_mm_node *parent,
 						unsigned long size,
@@ -255,26 +244,6 @@ static inline  struct drm_mm_node *drm_mm_search_free_in_range(
 	return drm_mm_search_free_in_range_generic(mm, size, alignment, 0,
 						   start, end, best_match);
 }
-static inline struct drm_mm_node *drm_mm_search_free_color(const struct drm_mm *mm,
-							   unsigned long size,
-							   unsigned alignment,
-							   unsigned long color,
-							   bool best_match)
-{
-	return drm_mm_search_free_generic(mm,size, alignment, color, best_match);
-}
-static inline  struct drm_mm_node *drm_mm_search_free_in_range_color(
-						const struct drm_mm *mm,
-						unsigned long size,
-						unsigned alignment,
-						unsigned long color,
-						unsigned long start,
-						unsigned long end,
-						bool best_match)
-{
-	return drm_mm_search_free_in_range_generic(mm, size, alignment, color,
-						   start, end, best_match);
-}
 extern int drm_mm_init(struct drm_mm *mm,
 		       unsigned long start,
 		       unsigned long size);
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/2 drm/i915: use drm_mm_remove_node instead of put_block

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -3
index 4200c32..30fd694 100644
@@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
 	/* Avoid an unnecessary call to unbind on rebind. */
 	obj->map_and_fenceable = true;
 
-	drm_mm_put_block(obj->gtt_space);
+	drm_mm_remove_node(obj->gtt_space);
 	obj->gtt_space = NULL;
 	obj->gtt_offset = 0;
 
@@ -3137,14 +3137,14 @@ search_free:
 	}
 	if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
 		i915_gem_object_unpin_pages(obj);
-		drm_mm_put_block(node);
+		drm_mm_remove_node(node);
 		return -EINVAL;
 	}
 
 	ret = i915_gem_gtt_prepare_object(obj);
 	if (ret) {
 		i915_gem_object_unpin_pages(obj);
-		drm_mm_put_block(node);
+		drm_mm_remove_node(node);
 		return ret;
 	}
 
Signature · 1 line
1.7.11.7
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

Quoted 11 lines · Daniel Vetter

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Quoted 7 lines

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>

You learn something new every day.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

Quoted 16 lines · Chris Wilson
Quoted 15 lines · Daniel Vetter

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Quoted 6 lines
Quoted 3 lines
Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>

You learn something new every day.

The lack of kfree in this patch might be a problem ...

/me tries again
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#4 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

In reply to Daniel Vetter

Hi

Quoted 27 lines · Daniel Vetter

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 4200c32..30fd694 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_unbind(struct drm_i915_gem_object *obj) · line 2623

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
        /* Avoid an unnecessary call to unbind on rebind. */
        obj->map_and_fenceable = true;
 
-       drm_mm_put_block(obj->gtt_space);
+       drm_mm_remove_node(obj->gtt_space);

kfree(obj->gtt_space);

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3140

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
        obj->gtt_space = NULL;
        obj->gtt_offset = 0;
 
@@ -3137,14 +3137,14 @@ search_free:
        }
        if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3147

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
                return -EINVAL;
        }
 
        ret = i915_gem_gtt_prepare_object(obj);
        if (ret) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

drm_mm_remove_node() does unlink the node but not remove it. Btw., I have these fixes in my series, too. I will push it later and write the git-link to #dri-devel.

Cheers
David

Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +0 -1
                return ret;
        }
 
--

1.7.11.7

#5 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

Quoted 53 lines · David Herrmann

Hi

Quoted 27 lines · Daniel Vetter

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 4200c32..30fd694 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_unbind(struct drm_i915_gem_object *obj) · line 2623

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
        /* Avoid an unnecessary call to unbind on rebind. */
        obj->map_and_fenceable = true;
 
-       drm_mm_put_block(obj->gtt_space);
+       drm_mm_remove_node(obj->gtt_space);

kfree(obj->gtt_space);

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3140

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
        obj->gtt_space = NULL;
        obj->gtt_offset = 0;
 
@@ -3137,14 +3137,14 @@ search_free:
        }
        if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
                return -EINVAL;
        }
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3147

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
        ret = i915_gem_gtt_prepare_object(obj);
        if (ret) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

Yeah, I fail ...

Quoted 3 lines

drm_mm_remove_node() does unlink the node but not remove it. Btw., I have these fixes in my series, too. I will push it later and write the git-link to #dri-devel.

We have patches in-flight to convert over to embedded drm_mm_nodes anyway, so I guess that part will solve itself automatically.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

Quoted 64 lines · Daniel Vetter
Quoted 53 lines · David Herrmann

Hi

Quoted 27 lines · Daniel Vetter

When converting to the preallocated drm_mm_node interfaces in

commit dc9dd7a20fde95aa81a8307cde79c2dff9f83f3d

Author: Chris Wilson <[email protected]>
Date:   Fri Dec 7 20:37:07 2012 +0000

drm/i915: Preallocate the drm_mm_node prior to manipulating the GTT drm_mm

only the allocation side was converted, but not the freeing. Fix this up.

Note that the only difference between put_block and remove_node is that the former fills up the preallocation cache. Which we don't need anyway and hence is just wasted space.

Cc Chris Wilson <[email protected]>
Cc Ben Widawsky <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 4200c32..30fd694 100644

drivers/gpu/drm/i915/i915_gem.c i915_gem_object_unbind(struct drm_i915_gem_object *obj) · line 2623

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -2620,7 +2620,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
        /* Avoid an unnecessary call to unbind on rebind. */
        obj->map_and_fenceable = true;
 
-       drm_mm_put_block(obj->gtt_space);
+       drm_mm_remove_node(obj->gtt_space);

kfree(obj->gtt_space);

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3140

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
        obj->gtt_space = NULL;
        obj->gtt_offset = 0;
 
@@ -3137,14 +3137,14 @@ search_free:
        }
        if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +0 -0
                return -EINVAL;
        }
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_gem.c search_free: · line 3147

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1 -1
        ret = i915_gem_gtt_prepare_object(obj);
        if (ret) {
                i915_gem_object_unpin_pages(obj);
-               drm_mm_put_block(node);
+               drm_mm_remove_node(node);

kfree(node);

Yeah, I fail ...

Quoted 7 lines
Quoted 3 lines

drm_mm_remove_node() does unlink the node but not remove it. Btw., I have these fixes in my series, too. I will push it later and write the git-link to #dri-devel.

We have patches in-flight to convert over to embedded drm_mm_nodes anyway, so I guess that part will solve itself automatically.
-Daniel

I'm planning to get this out ASAP. I'm a bit confused now though what I actually need to send.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#7 lore raw

Re: [PATCH 2/2] drm/i915: use drm_mm_remove_node instead of put_block

Quoted 9 lines · Ben Widawsky
Quoted 6 lines
Quoted 3 lines

drm_mm_remove_node() does unlink the node but not remove it. Btw., I have these fixes in my series, too. I will push it later and write the git-link to #dri-devel.

We have patches in-flight to convert over to embedded drm_mm_nodes anyway, so I guess that part will solve itself automatically.

I'm planning to get this out ASAP. I'm a bit confused now though what I actually need to send.

I think for now just the top-down allocator + the create_node stuff for stolen memory. I guess the conversion to embed the gtt_space drm_mm_node will take a bit longer.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch