From: Herbert Xu <herbert@gondor.apana.org.au>
To: Harald Freudenberger <freude@linux.ibm.com>
Cc: davem@davemloft.net, dengler@linux.ibm.com,
linux-s390@vger.kernel.org, linux-crypto@vger.kernel.org,
Eric Biggers <ebiggers@kernel.org>
Subject: Re: [PATCH v6 2/2] s390/crypto: New s390 specific protected key hash phmac
Date: Tue, 3 Dec 2024 16:50:42 +0800 [thread overview]
Message-ID: <Z07GYlVeohJJyLNE@gondor.apana.org.au> (raw)
In-Reply-To: <c86548e680a151394fa814f543103481@linux.ibm.com>
On Mon, Dec 02, 2024 at 06:25:22PM +0100, Harald Freudenberger wrote:
>
> - The attempt to derive a protected key usable by the cpacf instructions
> depends of the raw key material used. For 'clear key' material the
> derivation process is a simple instruction which can't fail.
> A more preferred way however is to use 'secure key' material which
> is transferred to a crypto card and then re-wrapped to be usable
> with cpacf instructions. This requires communication with a crypto
> card and thus may fail - because there is no card at all or there
> is temporarily no card available or the card is in bad state. If there
> is no usable card the AP bus returns -EBUSY at the pkey_key2protkey()
> function and triggers an asynchronous bus scan. As long as this scan
> is running (usually about 100ms or so) the -EBUSY is returned to indicate
> that the caller should retry "later". Other states are covered with
> other return codes like ENODEV or EIO and the caller is not supposed
> to loop but should fail. When there is no accessible hardware available
> to derive a protected key either the user or the admin broke something
> or something went really the bad way and then there is no help but the
> storage device must fail.
Thanks for the explanation. I think it's fair enough to fail an
op if the hardware is absent or broken.
So all I need is for you to turn the BUSY case into a delayed retry
and I think that should be good enough.
> - Do I get you right, that a completion is ok? I always had the impression
> that waiting on a completion is also a sleeping act and thus not allowed?
No, what I mean is that if you get an EBUSY, you should return
-EINPROGRESS to indicate that the operation is pending, and then
schedule a delayed work to retry the operation. When the retry
fails or succeeds, it should invoke the callback with the correct
error status.
If the retry gets EBUSY again, then schedule another delayed
work, or fail permanently by invoking the callback if you hit
some sort of threshold like your existing limit of 3.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2024-12-03 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 11:10 [PATCH v6 0/2] New s390 specific protected key hmac Harald Freudenberger
2024-11-29 11:10 ` [PATCH v6 1/2] s390/crypto: Add protected key hmac subfunctions for KMAC Harald Freudenberger
2024-11-29 11:10 ` [PATCH v6 2/2] s390/crypto: New s390 specific protected key hash phmac Harald Freudenberger
2024-11-29 14:48 ` Herbert Xu
2024-12-02 17:25 ` Harald Freudenberger
2024-12-03 8:50 ` Herbert Xu [this message]
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=Z07GYlVeohJJyLNE@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=dengler@linux.ibm.com \
--cc=ebiggers@kernel.org \
--cc=freude@linux.ibm.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-s390@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