All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.
@ 2010-02-01 18:24 Pauli Nieminen
  2010-02-01 20:12 ` Dave Airlie
  0 siblings, 1 reply; 3+ messages in thread
From: Pauli Nieminen @ 2010-02-01 18:24 UTC (permalink / raw)
  To: dri-devel

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

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

* Re: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.
  2010-02-01 18:24 [PATCH] libdrm/radeon: Fix section size mismatch to reset the section Pauli Nieminen
@ 2010-02-01 20:12 ` Dave Airlie
  2010-02-01 20:19   ` Pauli Nieminen
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Airlie @ 2010-02-01 20:12 UTC (permalink / raw)
  To: Pauli Nieminen; +Cc: dri-devel

On Tue, Feb 2, 2010 at 4:24 AM, Pauli Nieminen <suokkos@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 <suokkos@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
--

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

* Re: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.
  2010-02-01 20:12 ` Dave Airlie
@ 2010-02-01 20:19   ` Pauli Nieminen
  0 siblings, 0 replies; 3+ messages in thread
From: Pauli Nieminen @ 2010-02-01 20:19 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2821 bytes --]

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 <airlied@gmail.com> wrote:

> On Tue, Feb 2, 2010 at 4:24 AM, Pauli Nieminen <suokkos@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 <suokkos@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
> >
>

[-- Attachment #1.2: Type: text/html, Size: 3856 bytes --]

[-- Attachment #2: 0001-libdrm-radeon-Fix-section-size-mismatch-to-reset-the.patch --]
[-- Type: text/x-diff, Size: 1102 bytes --]

From d68b32afcbe935f7db5b7efc1f4b422849732039 Mon Sep 17 00:00:00 2001
From: Pauli Nieminen <suokkos@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


[-- Attachment #3: Type: text/plain, Size: 408 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

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

end of thread, other threads:[~2010-02-01 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-01 18:24 [PATCH] libdrm/radeon: Fix section size mismatch to reset the section Pauli Nieminen
2010-02-01 20:12 ` Dave Airlie
2010-02-01 20:19   ` Pauli Nieminen

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.