All of lore.kernel.org
 help / color / mirror / Atom feed
* Decrypting only uses 2 threads.
@ 2024-04-18 16:15 dE
  0 siblings, 0 replies; 4+ messages in thread
From: dE @ 2024-04-18 16:15 UTC (permalink / raw)
  To: dm-devel

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.
The following commands were used to setup the encryption --

cryptsetup -y -d - -c aes-ctr-essiv:sha256 --key-size 256 create disk1 /dev/sda

Is there anything I can do to increase concurrency while decrypting?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Decrypting only uses 2 threads.
  2024-04-15  9:44 ` Milan Broz
@ 2024-04-17  7:18   ` dE
  0 siblings, 0 replies; 4+ messages in thread
From: dE @ 2024-04-17  7:18 UTC (permalink / raw)
  To: Milan Broz; +Cc: cryptsetup

Ok, thanks. ctr is only used for testing since it's sureshot parallel.

On Mon, Apr 15, 2024 at 3:14 PM Milan Broz <gmazyland@gmail.com> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Decrypting only uses 2 threads.
  2024-04-15  8:49 dE
@ 2024-04-15  9:44 ` Milan Broz
  2024-04-17  7:18   ` dE
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2024-04-15  9:44 UTC (permalink / raw)
  To: dE, cryptsetup

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Decrypting only uses 2 threads.
@ 2024-04-15  8:49 dE
  2024-04-15  9:44 ` Milan Broz
  0 siblings, 1 reply; 4+ messages in thread
From: dE @ 2024-04-15  8:49 UTC (permalink / raw)
  To: cryptsetup

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.
The following commands were used to setup the encryption --

cryptsetup -y -d - -c aes-ctr-essiv:sha256 --key-size 256 create disk1 /dev/sda

Is there anything I can do to increase concurrency while decrypting?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-18 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 16:15 Decrypting only uses 2 threads dE
  -- strict thread matches above, loose matches on Subject: below --
2024-04-15  8:49 dE
2024-04-15  9:44 ` Milan Broz
2024-04-17  7:18   ` dE

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.