Re: Decrypting only uses 2 threads.

dE <[email protected]> Wed, 17 Apr 2024 12:48:28 +0530
Newsgroups dev.linux.lists.cryptsetup
Message-ID <CADofXPC=3A-bvm8vvcQT2Cw2CT7z+OBRZySY0ASVUSd=DouVuQ@mail.gmail.com>
Ok, thanks. ctr is only used for testing since it's sureshot parallel.

On Mon, Apr 15, 2024 at 3:14 PM Milan Broz <[email protected]> wrote:
>
> 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