linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 6/8] crypto: qat - Convert to new AEAD interface
Date: Tue, 04 Aug 2015 06:26:58 -0700	[thread overview]
Message-ID: <55C0BDA2.2030302@intel.com> (raw)
In-Reply-To: <20150804095909.GA28167@gondor.apana.org.au>

On 08/04/2015 02:59 AM, Herbert Xu wrote:
> Good catch.  However it's not as simple as that.  We have a bigger
> problem here.
> 
> For software implementations it's really easy because we use the
> module reference count to prevent unregisters from happening while
> there are tfms using it.
> 
> However for hardware devices this breaks down because you can remove
> the device at any time.  So we'll have to come up with a way of
> handling this without causing live tfms to explode.
> 
> FWIW the current qat code (and possibly other drivers) is buggy
> because if you call unregister while there are still tfms using
> it, it will BUG in the unregister call.

The way we handle it in qat is as follows - when tfm allocates a
crypto "instance" on a qat dev it then calls qat_crypto_put_instance(),
which calls also adf_dev_put() on the appropriate qat device.
This then calls module_put() on accel_dev->owner.
This way, when any tfm is allocated on a device the attempts to rmmod
or ioctl shutdown returns -EBUSY. See adf_ctl_is_device_in_use()
One can only successfully shut down a device or rmmod qat_dh895 when
all tfms are freed.

The only possibility when we may try to restart a device when tfms are
allocated is when we handle HW uncorrectable errors, which in theory
should never happen :)

  parent reply	other threads:[~2015-08-04 13:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30  9:41 [PATCH 0/8] crypto: aed - Convert authenc to new interface Herbert Xu
2015-07-30  9:53 ` [PATCH 1/8] crypto: testmgr - Disable authenc test and convert test vectors Herbert Xu
2015-07-30  9:53 ` [PATCH 2/8] crypto: authenc - Convert to new AEAD interface Herbert Xu
2015-07-30  9:53 ` [PATCH 3/8] crypto: caam - Convert authenc " Herbert Xu
2015-07-30  9:53 ` [PATCH 4/8] crypto: ixp4xx - Convert " Herbert Xu
2015-07-30  9:53 ` [PATCH 5/8] crypto: picoxcell " Herbert Xu
2015-07-30  9:53 ` [PATCH 6/8] crypto: qat " Herbert Xu
2015-07-31 20:39   ` Tadeusz Struk
2015-08-02  1:23     ` Herbert Xu
2015-08-03 17:01       ` Tadeusz Struk
2015-08-04  9:59         ` Herbert Xu
2015-08-04 12:47           ` Herbert Xu
2015-08-04 13:28             ` Tadeusz Struk
2015-08-04 13:26           ` Tadeusz Struk [this message]
2015-08-04 13:32             ` Herbert Xu
2015-08-04 13:42               ` Tadeusz Struk
2015-08-04 13:44                 ` Herbert Xu
2015-08-04 13:50                   ` Tadeusz Struk
2015-07-30  9:53 ` [PATCH 7/8] crypto: talitos " Herbert Xu
2015-07-30  9:53 ` [PATCH 8/8] crypto: testmgr - Reenable authenc tests Herbert Xu

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=55C0BDA2.2030302@intel.com \
    --to=tadeusz.struk@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.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).