> Quoting Steve Wise <[EMAIL PROTECTED]>:
> Subject: Re: [PATCH 00/12] ofed_1_2 - Neighbour update support
> 
> On Fri, 2007-02-02 at 08:03 +0200, Michael S. Tsirkin wrote:
> > > We could use a global refcnt to count the number of pending destructions
> > > and use a completion object to block unload until all the destructors
> > > fire and the refcnt goes to zero.
> > 
> > It has the same race as module refcnt. So just use that.
> > 
> 
> I don't understand the race.  Can you explain please?  This should be
> able to be done without a race with a refcnt, a spinlock, a bit saying
> we're unloading, and a completion object.
> 
> But maybe I'm confused ;-)

In short, the rule is that you can't pass a pointer to your function
to another module, and the unload module safely without synchronizing with that
other module.

Simplified example:

destructor
{
        complete(&foo);
A:
        return;
}

module_cleanup:
{
        wait(foo)
        return;
}

Now, assume destructor runs up to point A, then your module unloads,
and the memory its text occupied is overwritten by something else.
An attempt to execute code from point A will now crash.
So completion is not better than just module refcount here.

That said, I think the race is unlikely and just using module
refcount should be sufficient, and it's certainly simple.

-- 
MST

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to