From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jens Wiklander <jens.wiklander@linaro.org>,
valentin.manea@huawei.com, devicetree@vger.kernel.org,
javier@javigon.com, emmanuel.michel@st.com,
Herbert Xu <herbert@gondor.apana.org.au>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, jean-michel.delorme@st.com,
tpmdd-devel@lists.sourceforge.net,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 1/2] tee: generic TEE subsystem
Date: Sun, 19 Apr 2015 09:00:49 +0200 [thread overview]
Message-ID: <20150419070049.GA2391@kroah.com> (raw)
In-Reply-To: <20150418205019.GL12732@n2100.arm.linux.org.uk>
On Sat, Apr 18, 2015 at 09:50:19PM +0100, Russell King - ARM Linux wrote:
> On Sat, Apr 18, 2015 at 10:37:16PM +0200, Greg Kroah-Hartman wrote:
> > On Sat, Apr 18, 2015 at 08:02:24PM +0100, Russell King - ARM Linux wrote:
> > > On Sat, Apr 18, 2015 at 08:47:13PM +0200, Greg Kroah-Hartman wrote:
> > > > On Sat, Apr 18, 2015 at 10:04:20AM +0100, Russell King - ARM Linux wrote:
> > > > > On Sat, Apr 18, 2015 at 10:57:12AM +0200, Greg Kroah-Hartman wrote:
> > > > > > On Fri, Apr 17, 2015 at 09:50:56AM +0200, Jens Wiklander wrote:
> > > > > > > +struct tee_device {
> > > > > > > + char name[TEE_MAX_DEV_NAME_LEN];
> > > > > > > + const struct tee_desc *desc;
> > > > > > > + struct device *dev;
> > > > > >
> > > > > > No, please embed the device in your structure, don't have a pointer to
> > > > > > it.
> > > > >
> > > > > Greg, "dev" here is not a locally allocated device, but the parent device.
> > > > > It's actually the same as struct tee_device.miscdev.parent, which could be
> > > > > used instead and this member deleted.
> > > >
> > > > A miscdev doesn't need to have a "parent", it's just there to provide a
> > > > character device node to userspace, not to represent a "device that you
> > > > can do things with in the heirachy".
> > > >
> > > > If you really want that, then use a real 'struct device' as should be
> > > > done here. Have just a pointer to a misc device, that is meant to be
> > > > dynamic.
> > >
> > > Let's rewind.
> > >
> > > You are saying that "struct device *dev;" should be "struct device dev;"
> >
> > Yes.
> >
> > > I'm saying that you are mis-interpreting in your review what _that_ is.
> >
> > Probably, I really have no idea what it is anymore. What it _should_ be
> > is the thing that controls the lifecycle of the structure. Do not use a
> > miscdevice for that, it will not work, as the TPM developers found out
> > the hard way.
>
> I _really_ don't understand what you're going on about.
>
> The "struct device *dev" is a pointer to the struct device corresponding
> to the _device_ which is being probed and the tee device is being
> registered for - in the case of the submitted code, that is the
> struct device embedded in the platform device.
>
> This is a /really/ standard thing to do in drivers - saving a pointer
> to the struct device which the driver is responsible for.
Yes, but this structure says it is a "tee_device", and as such, should
be a real device, not just an internal structure that is never exposed
to userspace, right?
> So why should this pointer become a struct device itself?
Because it is a device. It should be a child of the platform device.
Unless it's just a "normal" device, then platform device shouldn't be
used here :)
> Greg, I think you have performed a disservice by poorly reviewing the
> driver, and giving _incorrect_ comments. Please can you have another
> look at both patches together and provide a better review. Thanks.
I think the comment about how the model is all messed up as it looks
like the TPM original code is correct.
> Second point _against_ embedding a struct device here - a struct device
> is exposed to userspace. Why expose this to userspace - we have other
> ways to manage the lifetime of data structures, such as krefs, which
> are not exposed to userspace. What's wrong with using a kref to
> control the lifetime of this structure?
It's a device, why wouldn't it be exposed to userspace.
If this isn't a device, then yes, it doesn't need to be. But then don't
call it a "tee_device" :)
thanks,
greg k-h
next prev parent reply other threads:[~2015-04-19 7:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 7:50 [RFC PATCH 0/2] generic TEE subsystem Jens Wiklander
2015-04-17 7:50 ` [RFC PATCH 1/2] tee: " Jens Wiklander
2015-04-17 16:30 ` [tpmdd-devel] " Jason Gunthorpe
2015-04-18 9:01 ` Russell King - ARM Linux
2015-04-18 17:29 ` Jason Gunthorpe
2015-04-18 21:57 ` Russell King - ARM Linux
2015-04-20 5:08 ` Jason Gunthorpe
2015-04-20 14:54 ` Greg Kroah-Hartman
2015-04-20 15:56 ` Jason Gunthorpe
2015-04-20 16:05 ` Greg Kroah-Hartman
2015-04-20 13:02 ` Jens Wiklander
2015-04-20 17:55 ` Jason Gunthorpe
2015-04-21 5:59 ` Jens Wiklander
2015-04-17 20:07 ` Arnd Bergmann
2015-04-18 7:20 ` Paul Bolle
2015-04-20 6:20 ` Jens Wiklander
2015-04-20 18:20 ` [tpmdd-devel] " Jason Gunthorpe
2015-04-21 10:45 ` Jens Wiklander
2015-04-18 8:55 ` Greg Kroah-Hartman
2015-04-18 8:57 ` Greg Kroah-Hartman
2015-04-18 9:04 ` Russell King - ARM Linux
2015-04-18 18:47 ` Greg Kroah-Hartman
2015-04-18 19:02 ` Russell King - ARM Linux
2015-04-18 20:37 ` Greg Kroah-Hartman
2015-04-18 20:50 ` Russell King - ARM Linux
2015-04-19 7:00 ` Greg Kroah-Hartman [this message]
2015-04-17 7:50 ` [RFC PATCH 2/2] tee: add OP-TEE driver Jens Wiklander
2015-04-18 8:57 ` Greg Kroah-Hartman
2015-04-18 9:36 ` Javier González
2015-04-18 18:49 ` Greg Kroah-Hartman
2015-04-18 19:01 ` Arnd Bergmann
2015-04-19 11:17 ` Javier González
2015-04-19 19:47 ` Arnd Bergmann
2015-04-20 7:05 ` Javier González
2015-04-20 6:42 ` Jens Wiklander
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=20150419070049.GA2391@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=emmanuel.michel@st.com \
--cc=herbert@gondor.apana.org.au \
--cc=javier@javigon.com \
--cc=jean-michel.delorme@st.com \
--cc=jens.wiklander@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=valentin.manea@huawei.com \
/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).