Re: Decrypting only uses 2 threads.

Milan Broz <[email protected]> Mon, 15 Apr 2024 11:44:29 +0200
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On 4/15/24 10:49 AM, dE wrote:
> Hi.
>      I'm trying to encrypt some block devices and trying to use a
> cipher and mode which is multithreaded. I'm trying out
> aes-ctr-essiv:sha256 to test multithreading, but have also tried
> aes-xts-essiv:sha256 with the same result.
> 
> The encryption is definitely multithread (massively), but while
> reading from the encrypted block device, I see that only 2 threads are
> being used. As a result when the CPU is throttled (deliberately), I
> see a drop in throughput while increased CPU utilization only in 2
> cores.

I think dm-crypt will not switch decryption from different core when coming
from block layer here (if you have multiple threads/processes reading
from dm-crypt device, I think it will be parallelized as expected).
Maybe setting different scheduler helps.

Anyway, this is question for kernel, better ask on dm-devel list and
always mention kernel version here.

> The following commands were used to setup the encryption --
> 
> cryptsetup -y -d - -c aes-ctr-essiv:sha256 --key-size 256 create disk1 /dev/sda

Never use CTR mode for FDE this way, it is insecure as the only tweak is fixed
(CTR requires nonce while sector number is reused).

Milan