Re: [PATCH 4/4] block: Integrity profile init function to trigger module loads
From: Ard Biesheuvel
Date: Sun Aug 26 2018 - 09:44:48 EST
On 26 August 2018 at 15:30, Martin K. Petersen
<martin.petersen@xxxxxxxxxx> wrote:
>
> Hi Ard,
>
>>> However, since the dependency for "crc10dif" is already satisfied,
>>> nothing is going to cause the hardware-accelerated kernel modules to
>>> get loaded.
>>
>> This is not true. All accelerated implementations based on SIMD
>> polynomial multiplication are tried to the respective CPU features
>> bits. This applies to x86, power, ARM and arm64.
>>
>> E.g., for x86 you have
>>
>> alias: cpu:type:x86,ven*fam*mod*:feature:*0081*
>>
>> which will be matched by udev if /sys/devices/system/cpu/modalias
>> contains feature 0081, and so the modules will be loaded automatically
>> at boot.
>
> If I can avoid carrying that init callback in the block integrity code
> that will definitely make me happy. However, loading crct10dif-pclmul
> does not happen automatically for me. crc-t10dif is linked statically
> and every user of the CRC goes through that library. So nothing ever
> requests the "crct10dif" modalias and no accelerator modules are loaded.
>
> <fresh boot>
>
> # lsmod | grep crc
> crc32c_intel 24576 0
> crc_ccitt 16384 1 ipv6
>
> # modinfo crc32c_intel | grep cpu:type
> alias: cpu:type:x86,ven*fam*mod*:feature:*0094*
>
> # modinfo crct10dif-pclmul | grep cpu:type
> alias: cpu:type:x86,ven*fam*mod*:feature:*0081*
>
> # egrep -o "0081|0094" /sys/devices/system/cpu/modalias
> 0081
> 0094
>
> # modprobe crct10dif
> # lsmod | grep crc
> crct10dif_pclmul 16384 1
> crc32c_intel 24576 0
> crc_ccitt 16384 1 ipv6
>
> It's interesting that crc32c_intel is loaded but libcrc32c is not. That
> matches your description of how things should work. But crct10dif-pclmul
> isn't loaded and neither is crc32_pclmul:
>
> # modprobe crc32
> # lsmod | grep crc
> crc32_generic 16384 0
> crc32_pclmul 16384 0
> crc32c_intel 24576 0
> crc_ccitt 16384 1 ipv6
>
That is odd. On my Ubuntu system, both crct10dif_pclmul and
crc32_pclmul get loaded automatically.