[Mesa-dev] [PATCH] clover: Don't call pipe_loader_release() when deleting a device

Bruno Jimenez brunojimen at gmail.com
Tue Feb 18 15:10:32 PST 2014


On Tue, 2014-02-18 at 17:50 +0100, Francisco Jerez wrote:
> Tom Stellard <tom at stellard.net> writes:
> 
> > From: Tom Stellard <thomas.stellard at amd.com>
> >
> > After pipe_loader_release() is called, if any of the pipe_* objects
> > try to call into the gallium API the application will segfault.
> >
> > The only time devices are deleted is when the global _clover_platform
> > object is deleted by the static destructor.  However,  since application
> > objects that are deleted by the static destructor *after*
> > _clover_platform might try to make a CL API calls from their destructor,
> > it is never safe to call pipe_loader_release().
> 
> Please have a look at the clover-internal-ref-counting branch [1] of my
> mesa tree, it should fix a number of memory management-related bugs,
> possibly the one you've encountered too, without the negative side
> effects of dropping the call to pipe_loader_release().
> 
> Thanks.

Hi,

I have tested your branch to see if it solved a problem I was having
with OpenCL (opencv_test_ocl throws a segfault although it passes all
the tests) and, as well as with Tom's patch, it doesn't happen any more.
So your branch fixes that bug.

Thanks!
Bruno

> 
> [1] http://cgit.freedesktop.org/~currojerez/mesa/log/?h=clover-internal-ref-counting
> 
> > ---
> >  src/gallium/state_trackers/clover/core/device.cpp | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> > index 76a49d0..2290366 100644
> > --- a/src/gallium/state_trackers/clover/core/device.cpp
> > +++ b/src/gallium/state_trackers/clover/core/device.cpp
> > @@ -48,8 +48,6 @@ device::device(clover::platform &platform, pipe_loader_device *ldev) :
> >  device::~device() {
> >     if (pipe)
> >        pipe->destroy(pipe);
> > -   if (ldev)
> > -      pipe_loader_release(&ldev, 1);
> >  }
> >  
> >  bool
> > -- 
> > 1.8.1.4
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list