Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-08 Thread Jarkko Sakkinen
On Fri, Oct 07, 2016 at 02:24:59PM +, Winkler, Tomas wrote: > So here I'm to say I'm sorry for misleading this, after all the > doubts I got back to debugging and traces. One thing for a reason > moving the device_del, had really made the problem go away, but the > real problem was

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-06 Thread Jarkko Sakkinen
On Thu, Oct 06, 2016 at 10:22:45AM -0600, Jason Gunthorpe wrote: > On Thu, Oct 06, 2016 at 02:23:57PM +0300, Jarkko Sakkinen wrote: > > > I think that they should be fenced then for the sake of consistency. > > I do not see why sysfs code is privileged not to do fencing while other > > peers have

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-06 Thread Jarkko Sakkinen
On Wed, Oct 05, 2016 at 10:27:41AM -0600, Jason Gunthorpe wrote: > On Wed, Oct 05, 2016 at 01:02:34PM +0300, Jarkko Sakkinen wrote: > > > I'll repeat my question: what worse can happen than returning -EPIPE? I > > though the whole rw lock scheme was introduced just for this purpose. > > I

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-05 Thread Jason Gunthorpe
On Wed, Oct 05, 2016 at 08:09:17PM +, Winkler, Tomas wrote: > It could, but that patch was not merged yet, and I believe even if > the issue is exposed only with runtime_pm currently, we have a bug > in design even w/o runtime pm. Please don't make changes without any justification :( > >

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-05 Thread Winkler, Tomas
> > On Wed, Oct 05, 2016 at 07:48:59AM +, Winkler, Tomas wrote: > > > > down_write(>ops_sem); > > > > chip->ops = NULL; > > > > up_write(>ops_sem); > > > > > > No, that is wrong as well, another thread can issue a TPM command > > > between the device_del and the ops = NULL. Presumably that

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-05 Thread Jarkko Sakkinen
On Wed, Oct 05, 2016 at 07:48:59AM +, Winkler, Tomas wrote: > > > > > > > On Tue, Oct 04, 2016 at 08:19:46AM +0300, Jarkko Sakkinen wrote: > > > > > > > > > > Make the driver uncallable first. The worst race that can happen > > > > > > is that open("/dev/tpm0", ...) returns -EPIPE. I do not

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-05 Thread Winkler, Tomas
> > > > > On Tue, Oct 04, 2016 at 08:19:46AM +0300, Jarkko Sakkinen wrote: > > > > > > > > Make the driver uncallable first. The worst race that can happen > > > > > is that open("/dev/tpm0", ...) returns -EPIPE. I do not consider > > > > > this fatal at all. > > > > > > > > No responses for this

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-04 Thread Jason Gunthorpe
On Tue, Oct 04, 2016 at 09:55:36PM +, Winkler, Tomas wrote: > > > On Tue, Oct 04, 2016 at 08:19:46AM +0300, Jarkko Sakkinen wrote: > > > > > > Make the driver uncallable first. The worst race that can happen is > > > > that open("/dev/tpm0", ...) returns -EPIPE. I do not consider this > > >

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-04 Thread Winkler, Tomas
> On Tue, Oct 04, 2016 at 08:19:46AM +0300, Jarkko Sakkinen wrote: > > > > Make the driver uncallable first. The worst race that can happen is > > > that open("/dev/tpm0", ...) returns -EPIPE. I do not consider this > > > fatal at all. > > > > No responses for this reasonable proposal so I'll

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-04 Thread Jason Gunthorpe
On Tue, Oct 04, 2016 at 08:19:46AM +0300, Jarkko Sakkinen wrote: > > Make the driver uncallable first. The worst race that can happen is that > > open("/dev/tpm0", ...) returns -EPIPE. I do not consider this fatal at > > all. > > No responses for this reasonable proposal so I'll show what I

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jarkko Sakkinen
On Mon, Oct 03, 2016 at 03:48:36PM +0300, Jarkko Sakkinen wrote: > On Mon, Oct 03, 2016 at 07:05:48AM +, Winkler, Tomas wrote: > > > > > On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > > > > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > > > > On Sun,

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Winkler, Tomas
> > On Mon, Oct 03, 2016 at 03:42:25PM +0300, Jarkko Sakkinen wrote: > > > > I've looked to the registration code and it indeed has few more > > > issues > > ? > > > > Maybe TPM_CHIP_FLAG_REGISTERED can be used for sealing the access to > > > the device during deregistration, current usage is

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jason Gunthorpe
On Mon, Oct 03, 2016 at 05:16:18PM +, Winkler, Tomas wrote: > > > Please be more specific regarding flows you think will be wrong with > > > this patch, you must agree that the current code is broken even w/o > > > runtime pm. > > > > No, I don't agree. Accessing dev->name is OK after the

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Winkler, Tomas
> On Mon, Oct 03, 2016 at 07:05:48AM +, Winkler, Tomas wrote: > > > > This patch is wrong, I though the comments were clear. All entry > > > points to find the device must be deleted before we commit to shutting > down the device. > > > > > > You need to figure out some other way to solve

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jason Gunthorpe
On Mon, Oct 03, 2016 at 03:42:25PM +0300, Jarkko Sakkinen wrote: > > I've looked to the registration code and it indeed has few more issues ? > > Maybe TPM_CHIP_FLAG_REGISTERED can be used for sealing the access > > to the device during deregistration, current usage is void. This is done via

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jason Gunthorpe
On Mon, Oct 03, 2016 at 07:05:48AM +, Winkler, Tomas wrote: > > This patch is wrong, I though the comments were clear. All entry points to > > find > > the device must be deleted before we commit to shutting down the device. > > > > You need to figure out some other way to solve your

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jarkko Sakkinen
On Mon, Oct 03, 2016 at 07:05:48AM +, Winkler, Tomas wrote: > > > On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > > > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > > > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > > > > In

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Jarkko Sakkinen
On Mon, Oct 03, 2016 at 07:38:44AM +, Winkler, Tomas wrote: > > > > > On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > > > > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > > > > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > > > > >

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Winkler, Tomas
> > > On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > > > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > > > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > > > > In tpm_del_char_device device_del is called prior to > > > > >

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-03 Thread Winkler, Tomas
> On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > > > In tpm_del_char_device device_del is called prior to tpm2_shutdown > > > > where it

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-02 Thread Jason Gunthorpe
On Sun, Oct 02, 2016 at 01:24:55PM +0300, Jarkko Sakkinen wrote: > On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > > In tpm_del_char_device device_del is called > > > prior to tpm2_shutdown where it is still

Re: [tpmdd-devel] [PATCH] tpm: don't destroy chip device prematurely

2016-10-02 Thread Jarkko Sakkinen
On Sun, Oct 02, 2016 at 01:17:55PM +0300, Jarkko Sakkinen wrote: > On Sun, Oct 02, 2016 at 10:39:31AM +0300, Tomas Winkler wrote: > > In tpm_del_char_device device_del is called > > prior to tpm2_shutdown where it is still used. > > > > Fortunately, so far chip->dev was used only for printouts >