From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: mark.rutland-5wv7dgnIgG8@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>,
khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
Benoit Cousson <bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org,
Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
David Gibson
<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Subject: Re: [RFC PATCH dtc] C-based DT schema checker integrated into dtc
Date: Tue, 5 Nov 2013 12:12:30 -0700 [thread overview]
Message-ID: <20131105191230.GA20600@obsidianresearch.com> (raw)
In-Reply-To: <201311051948.11992.arnd-r2nGTMty4D4@public.gmane.org>
On Tue, Nov 05, 2013 at 07:48:11PM +0100, Arnd Bergmann wrote:
> On Tuesday 05 November 2013, Jason Gunthorpe wrote:
> > I've been brewing a patch set to fix TPM, but it is a large effort. I
> > would think other legacy subsystems that are not fully class device
> > enabled will have similar challenges?
>
> I think a common pattern is to have the subsystem data be referenced from
> the driver data using a pointer, and contain a back reference to the struct
> device, which should not be a problem.
The issue is sysfs, the TPM core attaches attributes to the driver's
struct device, which means it has to convert from struct device * to
its own private data. It is totally wrong, but that is the way
it has been for ever. :(
> Yes, that would work, but it would prevent another idea I had that I
> haven't mentioned here: If we add a pointer to the 'struct
> devm_probe' array to
Seems quiet reasonable, but having two entry points just means drivers
that need to use the 2nd can't use the pointer in struct devm_probe.
The other thing that occured to me is your method could reduce the
devm overhead. If you keep a pointer to the probe list and to the
private data structure then you can unwide all the allocations just by
running backwards along the probe list. You don't need to do any
per-resource devm allocations..
> which would fit in nicely with the rest of the design, but now I'm no longer
> sure if that would actually work with the lifetime rules of the netdev, which
> would pin the refcount on the 'struct device', which in turn could prevent
> the devres cleanup to be executed.
I looked into this question recently, while trying to fixup TPM..
I concluded that devm doesn't actually really follow the refcount on
struct device. devm cleanup is called unconditionally after remove()
is called, and remove is called unconditionally when the device_driver
is deleted, which is called unconditionally on module unload.
So anything that used to be in the remove() function can be safely
moved into devm, including netdev deallocation. This makes sense,
considering what devm is for..
This process is separate from the refcount driven release, which
happens once all krefs to the struct device are dropped (eg, sysfs
open files, open char devices, etc)
Which creates the nasty bit, a sysfs callback/etc can be run even
after the device release function has finished and after the private
data has been deleted..
At least, that is where my search ended up, would appreciate it if
anyone knows different :)
Regards,
Jason
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-11-05 19:12 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 21:51 [RFC PATCH dtc] C-based DT schema checker integrated into dtc Stephen Warren
[not found] ` <1382651488-9696-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-24 23:43 ` Grant Likely
[not found] ` <20131024234340.ADF70C403B6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-10-25 4:00 ` Kumar Gala
2013-10-25 14:44 ` Stephen Warren
[not found] ` <526A83B9.30800-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-10-25 15:21 ` Jon Loeliger
2013-10-25 17:38 ` Rob Herring
[not found] ` <E1VZjCU-0005RE-Vt-CYoMK+44s/E@public.gmane.org>
2013-10-25 23:11 ` David Gibson
[not found] ` <20131025231106.GC17659-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2013-11-03 23:15 ` Tomasz Figa
2013-11-03 23:26 ` Tomasz Figa
2013-11-04 9:28 ` Arnd Bergmann
2013-11-04 12:31 ` Tomasz Figa
2013-11-04 16:37 ` Stephen Warren
[not found] ` <5277CD33.6030003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-04 18:57 ` Olof Johansson
2013-11-04 20:43 ` Arnd Bergmann
2013-11-04 21:29 ` Jason Gunthorpe
[not found] ` <20131104212930.GB9638-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-11-04 21:43 ` Stephen Warren
[not found] ` <527814E4.9050204-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-04 22:21 ` Jason Gunthorpe
2013-11-05 12:14 ` Arnd Bergmann
2013-11-05 8:39 ` Arnd Bergmann
[not found] ` <201311050939.21071.arnd-r2nGTMty4D4@public.gmane.org>
2013-11-05 18:03 ` Jason Gunthorpe
2013-11-05 18:48 ` Arnd Bergmann
[not found] ` <201311051948.11992.arnd-r2nGTMty4D4@public.gmane.org>
2013-11-05 19:12 ` Jason Gunthorpe [this message]
2013-11-05 19:34 ` Arnd Bergmann
[not found] ` <201311052034.01114.arnd-r2nGTMty4D4@public.gmane.org>
2013-11-05 19:58 ` Jason Gunthorpe
[not found] ` <20131105195820.GB20600-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-11-05 20:17 ` Arnd Bergmann
[not found] ` <201311052117.33443.arnd-r2nGTMty4D4@public.gmane.org>
2013-11-05 20:36 ` Jason Gunthorpe
2013-11-04 21:50 ` Stephen Warren
[not found] ` <527816AE.1080508-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-05 8:22 ` Arnd Bergmann
2013-11-06 12:17 ` Thierry Reding
2013-11-04 14:28 ` David Gibson
2013-11-04 16:42 ` Stephen Warren
2013-10-28 10:17 ` David Gibson
[not found] ` <20131028101737.GC15114-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2013-10-31 21:13 ` Stephen Warren
[not found] ` <5272C80A.7070204-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-01 13:24 ` David Gibson
2013-10-25 23:29 ` David Gibson
[not found] ` <20131025232951.GD17659-1s0os16eZneny3qCrzbmXA@public.gmane.org>
2013-10-31 21:11 ` Stephen Warren
[not found] ` <5272C773.2030901-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-10 11:00 ` David Gibson
[not found] ` <20131110110043.GB21328-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2013-11-12 22:06 ` Stephen Warren
[not found] ` <5282A64B.3020706-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-11-13 0:33 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131105191230.GA20600@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org \
--cc=a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=jdl-CYoMK+44s/E@public.gmane.org \
--cc=khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).