[PATCH] libdrm/radeon: Fix section size mismatch to reset the section.

2010-02-01 Thread Pauli Nieminen
If there is section size mismatch reusing the section object
makes section start fail.
Reseting the object before doing error checking prevents the
possible flood of errors.

Signed-off-by: Pauli Nieminen suok...@gmail.com
---
 radeon/radeon_cs_gem.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index c2301ad..9bfcda0 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
 file, func, line);
 return -EPIPE;
 }
+cs-section_ndw = 0;
 if (cs-section_ndw != cs-section_cdw) {
 fprintf(stderr, CS section size missmatch start at (%s,%s,%d) %d vs 
%d\n,
 cs-section_file, cs-section_func, cs-section_line, 
cs-section_ndw, cs-section_cdw);
@@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
 file, func, line);
 return -EPIPE;
 }
-cs-section_ndw = 0;
 return 0;
 }
 
-- 
1.6.3.3


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.

2010-02-01 Thread Dave Airlie
On Tue, Feb 2, 2010 at 4:24 AM, Pauli Nieminen suok...@gmail.com wrote:
 If there is section size mismatch reusing the section object
 makes section start fail.
 Reseting the object before doing error checking prevents the
 possible flood of errors.


That can't be right. did you read what your patch does?

of course it'll never call the printf now.

Dave.

 Signed-off-by: Pauli Nieminen suok...@gmail.com
 ---
  radeon/radeon_cs_gem.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
 index c2301ad..9bfcda0 100644
 --- a/radeon/radeon_cs_gem.c
 +++ b/radeon/radeon_cs_gem.c
 @@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
 +    cs-section_ndw = 0;
     if (cs-section_ndw != cs-section_cdw) {
         fprintf(stderr, CS section size missmatch start at (%s,%s,%d) %d vs 
 %d\n,
                 cs-section_file, cs-section_func, cs-section_line, 
 cs-section_ndw, cs-section_cdw);
 @@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
 -    cs-section_ndw = 0;
     return 0;
  }

 --
 1.6.3.3


 --
 The Planet: dedicated and managed hosting, cloud storage, colocation
 Stay online with enterprise data centers and the best network in the business
 Choose flexible plans and management services without long-term contracts
 Personal 24x7 support from experience hosting pros just a phone call away.
 http://p.sf.net/sfu/theplanet-com
 --
 ___
 Dri-devel mailing list
 Dri-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/dri-devel


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.

2010-02-01 Thread Pauli Nieminen
Yes. That was bad mistake.

Better solution is to do the resetting of the section also in the error
path.

Attached the fixed patch.

diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index c2301ad..45a219c 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -260,7 +260,10 @@ static int cs_gem_end(struct radeon_cs_int *cs,
 cs-section_file, cs-section_func, cs-section_line,
cs-section_ndw, cs-section_cdw);
 fprintf(stderr, CS section end at (%s,%s,%d)\n,
 file, func, line);
-return -EPIPE;
+
+   /* We must reset the section even when there is error. */
+   cs-section_ndw = 0;
+   return -EPIPE;
 }
 cs-section_ndw = 0;
 return 0;


On Mon, Feb 1, 2010 at 10:12 PM, Dave Airlie airl...@gmail.com wrote:

 On Tue, Feb 2, 2010 at 4:24 AM, Pauli Nieminen suok...@gmail.com wrote:
  If there is section size mismatch reusing the section object
  makes section start fail.
  Reseting the object before doing error checking prevents the
  possible flood of errors.
 

 That can't be right. did you read what your patch does?

 of course it'll never call the printf now.

 Dave.

  Signed-off-by: Pauli Nieminen suok...@gmail.com
  ---
   radeon/radeon_cs_gem.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
 
  diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
  index c2301ad..9bfcda0 100644
  --- a/radeon/radeon_cs_gem.c
  +++ b/radeon/radeon_cs_gem.c
  @@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
  file, func, line);
  return -EPIPE;
  }
  +cs-section_ndw = 0;
  if (cs-section_ndw != cs-section_cdw) {
  fprintf(stderr, CS section size missmatch start at (%s,%s,%d) %d
 vs %d\n,
  cs-section_file, cs-section_func, cs-section_line,
 cs-section_ndw, cs-section_cdw);
  @@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
  file, func, line);
  return -EPIPE;
  }
  -cs-section_ndw = 0;
  return 0;
   }
 
  --
  1.6.3.3
 
 
 
 --
  The Planet: dedicated and managed hosting, cloud storage, colocation
  Stay online with enterprise data centers and the best network in the
 business
  Choose flexible plans and management services without long-term contracts
  Personal 24x7 support from experience hosting pros just a phone call
 away.
  http://p.sf.net/sfu/theplanet-com
  --
  ___
  Dri-devel mailing list
  Dri-devel@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/dri-devel
 

From d68b32afcbe935f7db5b7efc1f4b422849732039 Mon Sep 17 00:00:00 2001
From: Pauli Nieminen suok...@gmail.com
Date: Mon, 1 Feb 2010 20:19:33 +0200
Subject: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.

If there is section size mismatch reusing the section object
makes section start fail.
Reseting the object before doing error checking prevents the
possible flood of errors.
---
 radeon/radeon_cs_gem.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index c2301ad..45a219c 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -260,7 +260,10 @@ static int cs_gem_end(struct radeon_cs_int *cs,
 cs-section_file, cs-section_func, cs-section_line, cs-section_ndw, cs-section_cdw);
 fprintf(stderr, CS section end at (%s,%s,%d)\n,
 file, func, line);
-return -EPIPE;
+
+	/* We must reset the section even when there is error. */
+	cs-section_ndw = 0;
+	return -EPIPE;
 }
 cs-section_ndw = 0;
 return 0;
-- 
1.6.3.3

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel