tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: ops_sem and tpm_mutex
Date: Tue, 5 Jul 2016 14:06:47 +0300	[thread overview]
Message-ID: <20160705110647.GA28275@intel.com> (raw)

Hi

I started to looking at ops_sem and tpm_mutex because it would be nicer
to have one lock. When we do something that uses ops_sem we do this:

1. read lock for ops_sem
2. lock tpm_mutex

This is the basic pattern. Basically we always loose the benefit of
RW-lock because in every use case we also lock a mutex.

And the mutex of course cannot be taken off because we want to mutually
exclude the TPM access.

What I was thinking that maybe we could have kref for ops instead
of lock. In the places where we now use read lock you could use
kref_get_unless_zero() to avoid races with tpm_chip_unregister().

/Jarkko

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

             reply	other threads:[~2016-07-05 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 11:06 Jarkko Sakkinen [this message]
     [not found] ` <20160705110647.GA28275-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-05 16:01   ` ops_sem and tpm_mutex 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=20160705110647.GA28275@intel.com \
    --to=jarkko.sakkinen-vuqaysv1563yd54fqh9/ca@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).