Message ID | 1455885728-10315-6-git-send-email-stefanb@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Feb 19, 2016 at 07:42:02AM -0500, Stefan Berger wrote:
> Get rid of the locking of the module
Little more in the comment please..
Now that the tpm core has strong locking around 'ops' it is possible
to remove a TPM driver, module and all, even while user space still
has things like /dev/tpmX open. For consistency and simplicity, drop
the module locking entirely.
Jason
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
On Fri, Feb 19, 2016 at 07:42:02AM -0500, Stefan Berger wrote: > Get rid of the locking of the module > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> I tend to think that this should have been part of the previous patch with the description in the commit message why the RW-semaphore gives the needed guarantees. /Jarkko > --- > drivers/char/tpm/tpm-chip.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index 0561400..fe15637 100644 > --- a/drivers/char/tpm/tpm-chip.c > +++ b/drivers/char/tpm/tpm-chip.c > @@ -57,9 +57,6 @@ int tpm_try_get_ops(struct tpm_chip *chip) > if (!chip->ops) > goto out_lock; > > - if (!try_module_get(chip->dev.parent->driver->owner)) > - goto out_lock; > - > return 0; > out_lock: > up_read(&chip->ops_sem); > @@ -77,7 +74,6 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops); > */ > void tpm_put_ops(struct tpm_chip *chip) > { > - module_put(chip->dev.parent->driver->owner); > up_read(&chip->ops_sem); > put_device(&chip->dev); > } > -- > 2.4.3 > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
On Mon, Feb 22, 2016 at 11:11:41PM +0200, Jarkko Sakkinen wrote: > On Fri, Feb 19, 2016 at 07:42:02AM -0500, Stefan Berger wrote: > > Get rid of the locking of the module > > > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> > > I tend to think that this should have been part of the previous patch > with the description in the commit message why the RW-semaphore gives > the needed guarantees. Module locking is user visible (no longer prevents rmmod), and Stefan wrote this code so it deserves it's own patch. The ops changes are not user visible. Jason ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
Jason Gunthorpe <jgunthorpe@obsidianresearch.com> wrote on 02/22/2016 01:22:45 PM: > Subject: Re: [tpmdd-devel] [PATCH v3 05/11] tpm: Get rid of module locking > > On Fri, Feb 19, 2016 at 07:42:02AM -0500, Stefan Berger wrote: > > Get rid of the locking of the module > > Little more in the comment please.. > > Now that the tpm core has strong locking around 'ops' it is possible > to remove a TPM driver, module and all, even while user space still > has things like /dev/tpmX open. For consistency and simplicity, drop > the module locking entirely. Took the text :-) Thanks. Stefan ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 0561400..fe15637 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -57,9 +57,6 @@ int tpm_try_get_ops(struct tpm_chip *chip) if (!chip->ops) goto out_lock; - if (!try_module_get(chip->dev.parent->driver->owner)) - goto out_lock; - return 0; out_lock: up_read(&chip->ops_sem); @@ -77,7 +74,6 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops); */ void tpm_put_ops(struct tpm_chip *chip) { - module_put(chip->dev.parent->driver->owner); up_read(&chip->ops_sem); put_device(&chip->dev); }
Get rid of the locking of the module Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> --- drivers/char/tpm/tpm-chip.c | 4 ---- 1 file changed, 4 deletions(-)