All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Andrey Pronin <apronin@chromium.org>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	semenzato@chromium.org, groeck@chromium.org
Subject: Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
Date: Mon, 16 Jan 2017 11:33:18 +0200	[thread overview]
Message-ID: <20170116093318.wmmr2z54pc6k7t2c@intel.com> (raw)
In-Reply-To: <20170114004230.GA21035@apronin>

On Fri, Jan 13, 2017 at 04:42:30PM -0800, Andrey Pronin wrote:
> On Fri, Jan 13, 2017 at 05:28:57PM -0700, Jason Gunthorpe wrote:
> > On Fri, Jan 13, 2017 at 04:09:54PM -0800, Andrey Pronin wrote:
> > > Resetting TPM while processing a command may lead to issues
> > > on the next boot. Ensure that we don't have any ongoing
> > > commands, and that no further commands can be sent to the chip
> > > by unregistering the device in the shutdown handler.
> > > tpm_chip_unregister() waits for the completion of an ongoing
> > > command, if any, and then clears out chip->ops and unregisters
> > > sysfs entities.
> > 
> > Unregistering in a shutdown handler seems very strange, it also waits
> > for userspace things, so I wonder if it could be problematic?
> > 
> > Maybe just use
> > 
> >    down_write(&chip->ops_sem);
> >    chip->ops = NULL;
> >    up_write(&chip->ops_sem);
> > 
> > In the shutdown handler?
> 
> down_write(&chip->ops_sem) would still wait for completing the initiated
> writes, since tpm_write() in tpm-dev.c calls tpm_try_get_ops().
> Also, tpm-sysfs.c calls chip->ops directly, so sysfs should be
> unregistered first.

Why don't you fix the tpm-sysfs issue but rather misusing
tpm_chip_unregister?

/Jarkko

  reply	other threads:[~2017-01-16  9:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-14  0:09 [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin
2017-01-14  0:09 ` Andrey Pronin
2017-01-14  0:28 ` Jason Gunthorpe
2017-01-14  0:28   ` Jason Gunthorpe
2017-01-14  0:42   ` Andrey Pronin
2017-01-16  9:33     ` Jarkko Sakkinen [this message]
2017-01-25 18:59       ` [tpmdd-devel] " Jarkko Sakkinen
2017-01-16 16:19     ` Jason Gunthorpe
2017-01-17 17:58       ` Andrey Pronin
2017-01-17 17:58         ` Andrey Pronin
2017-01-17 19:27         ` Jason Gunthorpe
2017-01-17 19:27           ` Jason Gunthorpe
2017-01-17 20:13           ` Andrey Pronin
2017-01-17 20:13             ` Andrey Pronin
2017-01-17 20:59             ` Jason Gunthorpe
2017-01-17 20:59               ` Jason Gunthorpe
2017-01-17 23:00               ` Andrey Pronin
2017-01-17 23:00                 ` Andrey Pronin
2017-01-17 23:22                 ` Jason Gunthorpe
2017-01-17 23:22                   ` Jason Gunthorpe
2017-01-23 20:02                   ` Andrey Pronin
2017-01-23 20:02                     ` Andrey Pronin
2017-01-23 20:16                     ` [tpmdd-devel] " Andrey Pronin
2017-01-23 20:39                     ` Jason Gunthorpe
2017-01-23 20:39                       ` Jason Gunthorpe
2017-01-23 22:19                       ` Andrey Pronin
2017-01-23 22:57                         ` Jason Gunthorpe
2017-01-23 22:57                           ` Jason Gunthorpe

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=20170116093318.wmmr2z54pc6k7t2c@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=apronin@chromium.org \
    --cc=groeck@chromium.org \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=semenzato@chromium.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.