All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] last minute range validation fixes.
@ 2010-02-11 23:17 Thomas Hellstrom
  2010-02-11 23:17 ` [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 Thomas Hellstrom
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Hellstrom @ 2010-02-11 23:17 UTC (permalink / raw)
  To: airlied; +Cc: dri-devel


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
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [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.
  2010-02-11 23:17 [PATCH 0/2] last minute range validation fixes Thomas Hellstrom
@ 2010-02-11 23:17 ` Thomas Hellstrom
  2010-02-11 23:18   ` [PATCH 2/2] drm/ttm: Fix a bug occuring when validating a buffer object in a range Thomas Hellstrom
  2010-02-12  8:12   ` [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 Michel Dänzer
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Hellstrom @ 2010-02-11 23:17 UTC (permalink / raw)
  To: airlied; +Cc: Thomas Hellstrom, dri-devel

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/drm_mm.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index cdec329..2ac074c 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -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) {
-- 
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
--

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/ttm: Fix a bug occuring when validating a buffer object in a range.
  2010-02-11 23:17 ` [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 Thomas Hellstrom
@ 2010-02-11 23:18   ` Thomas Hellstrom
  2010-02-12  8:12   ` [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 Michel Dänzer
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Hellstrom @ 2010-02-11 23:18 UTC (permalink / raw)
  To: airlied; +Cc: Thomas Hellstrom, dri-devel

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.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1a3e909..c7320ce 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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 &
-- 
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
--

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* 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.
  2010-02-11 23:17 ` [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 Thomas Hellstrom
  2010-02-11 23:18   ` [PATCH 2/2] drm/ttm: Fix a bug occuring when validating a buffer object in a range Thomas Hellstrom
@ 2010-02-12  8:12   ` Michel Dänzer
  2010-02-12  9:31     ` Thomas Hellstrom
  1 sibling, 1 reply; 5+ messages in thread
From: Michel Dänzer @ 2010-02-12  8:12 UTC (permalink / raw)
  To: Thomas Hellstrom; +Cc: airlied, dri-devel

On Fri, 2010-02-12 at 00:17 +0100, Thomas Hellstrom wrote: 
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

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


> drivers/gpu/drm/drm_mm.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index cdec329..2ac074c 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -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) {

Reviewed-by: Michel Dänzer <daenzer@vmware.com>


-- 
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
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* 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.
  2010-02-12  8:12   ` [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 Michel Dänzer
@ 2010-02-12  9:31     ` Thomas Hellstrom
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Hellstrom @ 2010-02-12  9:31 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: airlied@redhat.com, dri-devel@lists.sourceforge.net

Michel Dänzer wrote:
> On Fri, 2010-02-12 at 00:17 +0100, Thomas Hellstrom wrote: 
>   
>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>     
>
> 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

>> drivers/gpu/drm/drm_mm.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
>> index cdec329..2ac074c 100644
>> --- a/drivers/gpu/drm/drm_mm.c
>> +++ b/drivers/gpu/drm/drm_mm.c
>> @@ -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) {
>>     
>
> Reviewed-by: Michel Dänzer <daenzer@vmware.com>
>
>
>   


------------------------------------------------------------------------------
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
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-12  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11 23:17 [PATCH 0/2] last minute range validation fixes Thomas Hellstrom
2010-02-11 23:17 ` [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 Thomas Hellstrom
2010-02-11 23:18   ` [PATCH 2/2] drm/ttm: Fix a bug occuring when validating a buffer object in a range Thomas Hellstrom
2010-02-12  8:12   ` [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 Michel Dänzer
2010-02-12  9:31     ` Thomas Hellstrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.