Skip to contentSkip to conversation

last minute range validation fixes.

PATCH In review Thomas Hellstrom 2 participants 5 messages Feb 11, 2010 – Feb 12, 2010

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

cover last minute range validation fixes.

This patch series contains two pretty important bugfixes to the new validate-in-range functionality. The first bug could case a buffer object to be validated outside of the requested range, the other one could cause a buffer object to remain at its current offset even though that offset was outside of the given range.

Both these bugs have a severe impact on the vmwgfx driver when switching between fb and X server, so if the fixes can make it into 2.6.33 that'd be awsome.

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--

#1 lore raw

PATCH 1/2 drm: Fix a bug in the range manager. When searching for free space in a range, the function could return a node extending outside of the given range.

---
 drivers/gpu/drm/drm_mm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_mm.c +2 -1
index cdec329..2ac074c 100644
@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
 				wasted += alignment - tmp;
 		}
 
-		if (entry->size >= size + wasted) {
+		if (entry->size >= size + wasted &&
+		    (entry->start + wasted + size) <= end) {
 			if (!best_match)
 				return entry;
 			if (entry->size < best_size) {
Signature · 8 lines
1.6.2.5


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
#2 lore raw

PATCH 2/2 drm/ttm: Fix a bug occuring when validating a buffer object in a range.

If the buffer object was already in the requested memory type, but outside of the requested range it was never moved into the requested range.

---
 drivers/gpu/drm/ttm/ttm_bo.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +6 -0
index 1a3e909..c7320ce 100644
@@ -1020,6 +1020,12 @@ static int ttm_bo_mem_compat(struct ttm_placement *placement,
 			     struct ttm_mem_reg *mem)
 {
 	int i;
+	struct drm_mm_node *node = mem->mm_node;
+
+	if (node && placement->lpfn != 0 &&
+	    (node->start < placement->fpfn ||
+	     node->start + node->size > placement->lpfn))
+		return -1;
 
 	for (i = 0; i < placement->num_placement; i++) {
 		if ((placement->placement[i] & mem->placement &
Signature · 8 lines
1.6.2.5


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] drm: Fix a bug in the range manager. When searching for free space in a range, the function could return a node extending outside of the given range.

In reply to Thomas Hellstrom
Quoted 1 line · Thomas Hellstrom

Please make a proper short description of the change on the first line of the commit message.

Quoted 8 lines

drivers/gpu/drm/drm_mm.c | 3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_mm.c +0 -0
index cdec329..2ac074c 100644

drivers/gpu/drm/drm_mm.c struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, · line 412

Quoted 9 lines
drivers/gpu/drm/drm_mm.c +2 -1
@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
 				wasted += alignment - tmp;
 		}
 
-		if (entry->size >= size + wasted) {
+		if (entry->size >= size + wasted &&
+		    (entry->start + wasted + size) <= end) {
 			if (!best_match)
 				return entry;
 			if (entry->size < best_size) {
Signature · 12 lines
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
#4 lore raw

Re: [PATCH 1/2] drm: Fix a bug in the range manager. When searching for free space in a range, the function could return a node extending outside of the given range.

Quoted 10 lines · Michel Dänzer
Quoted 2 lines · Thomas Hellstrom

Please make a proper short description of the change on the first line of the commit message.

Done. That short description accidently ended up in the subject field.

/Thomas

Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/drm_mm.c | 3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_mm.c +0 -0
index cdec329..2ac074c 100644
@@ -405,7 +405,8 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
 				wasted += alignment - tmp;
 		}
 
Quoted 12 lines

drivers/gpu/drm/drm_mm.c struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, · line 412

Quoted 7 lines
drivers/gpu/drm/drm_mm.c +2 -1
-		if (entry->size >= size + wasted) {
+		if (entry->size >= size + wasted &&
+		    (entry->start + wasted + size) <= end) {
 			if (!best_match)
 				return entry;
 			if (entry->size < best_size) {

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel