All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	srajiv@linux.vnet.ibm.com
Subject: Re: [PATCH] TPM: Let the tpm char device be openable multiple times
Date: Tue, 3 Nov 2009 10:15:38 -0700	[thread overview]
Message-ID: <20091103171538.GP1966@obsidianresearch.com> (raw)
In-Reply-To: <20091103104352.3a460ae9@lxorguk.ukuu.org.uk>

On Tue, Nov 03, 2009 at 10:43:52AM +0000, Alan Cox wrote:
> > - Move the user space data buffer and related goop into a
> >   struct tpm_file, create one struct tpm_file per open file.
> 
> Is that really sufficient ?

Yes, I think so. Basically, all I did was take the per-device locking
that was already there and make it per-file. The locking hasn't
changed. If there was a multi-threading bug in the old code, it is
still in this version - but I looked for such a thing and didn't
see anything.

> You can open a file once, dup it (or inherit it and get multiple callers
> from the same file handle. Ditto consider threated apps

Yes, I did, I think it is OK. All the operations involving the file's
buffer are atomic or protected by a per-file mutex. Do you see
something specific?

It would be dangerous to do that anyhow, the way the TPM interface
works requires matched write/read pairs. The driver has a hacky way to
halt a write until the matching write happens, but it is based on
timeouts and probably isn't 100% reliable.

Thanks,
Jason

  reply	other threads:[~2009-11-03 17:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03  0:35 [PATCH] TPM: Let the tpm char device be openable multiple times Jason Gunthorpe
2009-11-03 10:43 ` Alan Cox
2009-11-03 17:15   ` Jason Gunthorpe [this message]
2009-11-03 17:31 ` [tpmdd-devel] " Hal Finney
2009-11-03 17:46   ` Jason Gunthorpe
2009-11-03 18:14   ` Valdis.Kletnieks
2009-11-03 22:41     ` Jason Gunthorpe
2009-11-04  3:24       ` Valdis.Kletnieks
2009-11-04  4:27         ` Jason Gunthorpe
2009-11-04  9:58         ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2012-09-30 23:33 Jason Gunthorpe
2012-10-10 16:33 ` Kent Yoder
2012-10-12 20:56   ` Jason Gunthorpe
2012-10-15 22:02     ` Kent Yoder

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=20091103171538.GP1966@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srajiv@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.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.