From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
To: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au
Subject: Re: [PATCH] crypto: vmx -- disable preemption to enable vsx in aes_ctr.c
Date: Mon, 23 Jan 2017 14:07:45 -0200 [thread overview]
Message-ID: <20170123140745.43daedae@dublin> (raw)
In-Reply-To: <1484901333.8207.11.camel@TP420>
On Fri, 20 Jan 2017 16:35:33 +0800
Li Zhong <zhong@linux.vnet.ibm.com> wrote:
> Some preemptible check warnings were reported from
> enable_kernel_vsx(). This patch disables preemption in aes_ctr.c
> before enabling vsx, and they are now consistent with other files in
> the same directory.
>
> Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> ---
> drivers/crypto/vmx/aes_ctr.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/crypto/vmx/aes_ctr.c
> b/drivers/crypto/vmx/aes_ctr.c index 38ed10d..7cf6d31 100644
> --- a/drivers/crypto/vmx/aes_ctr.c
> +++ b/drivers/crypto/vmx/aes_ctr.c
> @@ -80,11 +80,13 @@ static int p8_aes_ctr_setkey(struct crypto_tfm
> *tfm, const u8 *key, int ret;
> struct p8_aes_ctr_ctx *ctx = crypto_tfm_ctx(tfm);
>
> + preempt_disable();
> pagefault_disable();
> enable_kernel_vsx();
> ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
> disable_kernel_vsx();
> pagefault_enable();
> + preempt_enable();
>
> ret += crypto_blkcipher_setkey(ctx->fallback, key, keylen);
> return ret;
> @@ -99,11 +101,13 @@ static void p8_aes_ctr_final(struct
> p8_aes_ctr_ctx *ctx, u8 *dst = walk->dst.virt.addr;
> unsigned int nbytes = walk->nbytes;
>
> + preempt_disable();
> pagefault_disable();
> enable_kernel_vsx();
> aes_p8_encrypt(ctrblk, keystream, &ctx->enc_key);
> disable_kernel_vsx();
> pagefault_enable();
> + preempt_enable();
>
> crypto_xor(keystream, src, nbytes);
> memcpy(dst, keystream, nbytes);
> @@ -132,6 +136,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc
> *desc, blkcipher_walk_init(&walk, dst, src, nbytes);
> ret = blkcipher_walk_virt_block(desc, &walk,
> AES_BLOCK_SIZE); while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
> + preempt_disable();
> pagefault_disable();
> enable_kernel_vsx();
> aes_p8_ctr32_encrypt_blocks(walk.src.virt.addr,
> @@ -143,6 +148,7 @@ static int p8_aes_ctr_crypt(struct blkcipher_desc
> *desc, walk.iv);
> disable_kernel_vsx();
> pagefault_enable();
> + preempt_enable();
>
> /* We need to update IV mostly for last
> bytes/round */ inc = (nbytes & AES_BLOCK_MASK) / AES_BLOCK_SIZE;
>
>
Well observed, Thanks.
prev parent reply other threads:[~2017-01-23 16:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 8:35 [PATCH] crypto: vmx -- disable preemption to enable vsx in aes_ctr.c Li Zhong
2017-01-23 15:03 ` Herbert Xu
2017-01-23 16:07 ` Paulo Flabiano Smorigo [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=20170123140745.43daedae@dublin \
--to=pfsmorigo@linux.vnet.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=zhong@linux.vnet.ibm.com \
/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