[pkg-cryptsetup-devel] Bug#1016474: cryptsetup: The system installed on encrypted LVM (both root and swap partitions) freezes during massive writes
Milan Broz
gmazyland at gmail.com
Tue Aug 2 08:26:40 BST 2022
On 01/08/2022 23:00, Wojciech Zabołotny wrote:
> Probably the number of affected people is quite big, but they have
> simply accepted this situation.
This is much more complicated. The problem with the "freezing" system while writing to a dm-crypt device (whatever type) is not new, but also it is not one problem.
I know about several issues that caused this, and most of them should be fixed. Some are related to specific HW only.
Please do not mix observation now and years ago - always use a new kernel, and always describe what you see *now*.
The dm-crypt was several times heavily optimized for parallel processing, and each change usually caused another problem in some other specific situation :-)
If you can reproduce it reliably with new upstream kernel, please report it to the dm-devel list.
Just in short, what I know:
1) there was a problem that dm-crypt allocated too much IO in progress (and memory), and flushing the device causes "freezes" or OOM.
This should be fixed (in 2018) in recent kernels, and dm-crypt internally limits maximal allocated memory.
2) I remember that on AMD CPUs was a problem with the queue handling; the workaround was using that dm-crypt performance option.
(IIRC, nobody from DM devels was able to reproduce it, not sure if because of lack of HW or other reasons.)
3) External drives connected through USB cause problems, but this happens even without dm-crypt - encryption only worsens it.
It is a problem how USB handles storage devices; I do not think the problem is in dm-crypt itself.
There were a lot of problems with crypto algorithm drivers allocating memory on the hot path (these should not be used by dm-crypt anymore) or bad implementations (notable QAT driver that only recently was fixed).
Setting blocks device scheduler (CFQ, none) has also had an impact here.
Rotational drives behave completely differently from SSD and NVME.
...
TLDR: Reproducing issues is usually very complicated, usually it is something specific specific for your system - if you can help, please send report to dm-devel list.
Cryptsetup cannot "optimize" any performance flags to use, this would fix one issue and cause many others.
Milan
More information about the pkg-cryptsetup-devel
mailing list