From: "Stefan Berger" <stefanb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Stefan,
linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH v7 08/10] tpm: Proxy driver for supporting multiple emulated TPMs
Date: Sun, 13 Mar 2016 17:20:40 -0500 [thread overview]
Message-ID: <201603132220.u2DMKrk6023870@d03av04.boulder.ibm.com> (raw)
In-Reply-To: <20160313200652.GA3087-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1804 bytes --]
Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote on 03/13/2016
04:06:52 PM:
>
> On Sat, Mar 12, 2016 at 06:27:13PM -0500, Stefan Berger wrote:
> > This fix should solve the problem:
> >
> > diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c
> > b/drivers/char/tpm/tpm_vtpm_proxy.c
> > index d73944e..01e5070 100644
> > --- a/drivers/char/tpm/tpm_vtpm_proxy.c
> > +++ b/drivers/char/tpm/tpm_vtpm_proxy.c
> > @@ -456,10 +456,10 @@ err_delete_proxy_dev:
> > */
> > static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
> > {
> > - tpm_chip_unregister(proxy_dev->chip);
> > -
> > vtpm_proxy_fops_undo_open(proxy_dev);
> >
> > + tpm_chip_unregister(proxy_dev->chip);
> > +
> > vtpm_proxy_delete_proxy_dev(proxy_dev);
> > }
> >
> > Can you let me know whether this gets it working for you? I'd
prepare a
> > v9.
>
> So is the deadlock such that:
>
> * tpm_chip_unregister() tries to write lock ops_sem.
> * tpm_transmit() holds read lock to ops_sem.
>
> This takes two minutes if no timeouts are calculated.
>
> And is the effect of moving vtpm_proxy_fops_undo_open() upwards such
> that vtpm_proxy_tpm_req_canceled() starts returning true, which in
> effect breaks the loop in tpm_transmit()?
>
> Yeah, the fix as a code change is very simple but I had to use perf
> probe to verify this so maybe a comment there would be in place to
> tell why tpm_chip_unregister() must be called last (write lock).
I'll put a comment. The reason is that the client (user of /dev/tpmX) is
possibly holding the 'ops' lock while we the proxy driver needs it when
calling tom_chip_unregister.
Thanks for trying it.
Stefan
[-- Attachment #1.2: Type: text/html, Size: 2512 bytes --]
[-- Attachment #2: Type: text/plain, Size: 291 bytes --]
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
[-- Attachment #3: Type: text/plain, Size: 192 bytes --]
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
next prev parent reply other threads:[~2016-03-13 22:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1457751065-11507-1-git-send-email-stefanb@linux.vnet.ibm.com>
[not found] ` <1457751065-11507-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-03-12 2:51 ` [PATCH v7 08/10] tpm: Proxy driver for supporting multiple emulated TPMs Stefan Berger
[not found] ` <1457751065-11507-9-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-03-12 18:51 ` Jarkko Sakkinen
[not found] ` <20160312185154.GA12412-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-12 23:27 ` Stefan Berger
2016-03-13 1:52 ` Stefan Berger
[not found] ` <201603122327.u2CNRI56031122@d01av04.pok.ibm.com>
[not found] ` <201603122327.u2CNRI56031122-YREtIfBy6dDImUpY6SP3GEEOCMrvLtNR@public.gmane.org>
2016-03-13 20:06 ` Jarkko Sakkinen
[not found] ` <20160313200652.GA3087-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-13 22:20 ` Stefan Berger [this message]
2016-03-12 2:51 ` [PATCH v7 09/10] tpm: Initialize TPM and get durations and timeouts Stefan Berger
2016-03-12 2:51 ` [PATCH v7 10/10] tpm: Add documentation for the tpm_vtpm device driver Stefan Berger
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=201603132220.u2DMKrk6023870@d03av04.boulder.ibm.com \
--to=stefanb-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).