[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac3eb2510908110556s44db5e24rba901cc4d4a4c431@mail.gmail.com>
Date: Tue, 11 Aug 2009 14:56:28 +0200
From: Kay Sievers <kay.sievers@...y.org>
To: Roland Dreier <rdreier@...co.com>
Cc: Greg KH <gregkh@...e.de>,
Bart Van Assche <bart.vanassche@...il.com>,
OpenIB <general@...ts.openfabrics.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [ofa-general] IB kernel modules and the kobject release() method
On Mon, Aug 10, 2009 at 22:33, Roland Dreier<rdreier@...co.com> wrote:
>
> > No, it still makes sense :)
>
> So what's the fix for this?
The fix is not to embed any kobject/struct device into an object whose
lifetime is not controlled by the kobject. The kobject should just be
a pointer then, and not inlined in the same memory the object uses,
which needs the kobject. The entire kobject embedding/release logic
works only properly if the kobject can own/control the lifetime of the
enclosing object - if not, it should just not be embedded.
> If even you have trouble understanding
> kobject lifetimes
I don't think we have trouble understanding that, but we are
hopelessly lost running after people who "optimize" the use of
kobjects/struct device to save an allocation or a separate dynamic
object.
> and the requirement for a release function, is there
> hope for anyone else?
Almost all uses where kobjects/struct device are statically allocated,
an object embeds more than a single kobject, or the embedded kobject
does not control the lifetime of the enclosing object, is just a
mis-use of kobjects.
Not sure, maybe it needs a simpler API to use non-embedded kobjects,
to make it easier to reach the originating object from the kobject.
That might not be obvious how to do that in some cases.
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists