From: Taehee Yoo <ap420073@gmail.com>
To: "Elliott, Robert (Servers)" <elliott@hpe.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ard Biesheuvel <ardb@kernel.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"ebiggers@google.com" <ebiggers@google.com>
Subject: Re: [PATCH] crypto: x86: Do not acquire fpu context for too long
Date: Wed, 12 Oct 2022 15:08:24 +0900 [thread overview]
Message-ID: <d12093d7-d01c-081f-fa04-c608f8021a60@gmail.com> (raw)
In-Reply-To: <MW5PR84MB1842FD77B90B1553367235CEAB219@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM>
Hi Elliott, Robert
2022. 10. 10. 오전 4:58에 Elliott, Robert (Servers) 이(가) 쓴 글:
>
>
>> -----Original Message-----
>> From: Herbert Xu <herbert@gondor.apana.org.au>
>> Sent: Sunday, October 9, 2022 1:20 AM
>> To: Elliott, Robert (Servers) <elliott@hpe.com>
>> Cc: Ard Biesheuvel <ardb@kernel.org>; Taehee Yoo
<ap420073@gmail.com>; linux-
>> crypto@vger.kernel.org; davem@davemloft.net; tglx@linutronix.de;
>> mingo@redhat.com; bp@alien8.de; dave.hansen@linux.intel.com;
x86@kernel.org;
>> hpa@zytor.com; ebiggers@google.com
>> Subject: Re: [PATCH] crypto: x86: Do not acquire fpu context for too
long
>>
>> On Sat, Oct 08, 2022 at 07:48:07PM +0000, Elliott, Robert (Servers)
wrote:
>>>
>>> Perhaps the cycles mode needs to call cond_resched() too?
>>
>> Yes, just make the cond_resched unconditional. Having a few too many
>> rescheds shouldn't be an issue.
>
> This looks promising. I was able to trigger a lot of rcu stalls by
setting:
> echo 2 > /sys/module/rcupdate/parameters/rcu_cpu_stall_timeout
> echo 200 > /sys/module/rcupdate/parameters/rcu_exp_cpu_stall_timeout
>
> and running these concurrently:
> watch -n 0 modprobe tcrypt=200
> watch -n 0 module tcrypt=0 through 999
>
> After changing tcrypt to call cond_resched in both cases, I don't see any
> more rcu stalls.
>
> I am getting miscompares from the extended self-test for crc32 and
> crct10dif, and will investigate those further.
>
> BTW, the way tcrypt always refuses to load leads to an ever-growing
list in
> the Call Traces:
>
> kernel: Unloaded tainted modules: tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 t
> crypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
> tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
> tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():
> 1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1
tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt():1 tcrypt()
> :1 tcrypt():1 tcrypt():1 tcrypt():1
>
>
>
I tested mb_aead as well.
I can find rcu stalls easily while testing gcm(aes-generic) with the
below commands.
#shell1
while :
do
modprobe tcrypt mode=215 num_mb=1024
done
#shell2
while :
do
modprobe tcrypt mode=0
done
Then, I added cond_resched() as you mentioned.
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index a82679b576bb..eeb3abb4eece 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -415,6 +415,7 @@ static void test_mb_aead_speed(const char *algo, int
enc, int secs,
} else {
ret = test_mb_aead_cycles(data, enc, bs,
num_mb);
+ cond_resched();
}
I can't see rcu stalls anymore, I think it works well.
prev parent reply other threads:[~2022-10-12 6:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 4:49 [PATCH] crypto: x86: Do not acquire fpu context for too long Taehee Yoo
2022-10-04 4:52 ` Herbert Xu
2022-10-04 6:01 ` Taehee Yoo
2022-10-04 15:16 ` Elliott, Robert (Servers)
2022-10-07 21:54 ` Ard Biesheuvel
2022-10-08 19:48 ` Elliott, Robert (Servers)
2022-10-09 6:19 ` Herbert Xu
2022-10-09 19:58 ` Elliott, Robert (Servers)
2022-10-11 15:16 ` Elliott, Robert (Servers)
2022-10-12 6:08 ` Taehee Yoo [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=d12093d7-d01c-081f-fa04-c608f8021a60@gmail.com \
--to=ap420073@gmail.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=elliott@hpe.com \
--cc=herbert@gondor.apana.org.au \
--cc=hpa@zytor.com \
--cc=linux-crypto@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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