Re: [PATCH v1 1/1] dm-integrity: Implement asynch digest support

Eric Biggers
2025-01-15T17:37:38Z

On Wed, Jan 15, 2025 at 05:46:57PM +0100, Harald Freudenberger wrote:
> Use the async digest in-kernel crypto API instead of the
> synchronous digest API. This has the advantage of being able
> to use synchronous as well as asynchronous digest implementations
> as the in-kernel API has an automatic wrapping mechanism
> to provide all synchronous digests via the asynch API.
>
> Tested with crc32, sha256, hmac-sha256 and the s390 specific
> implementations for hmac-sha256 and protected key phmac-sha256.
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>

As Mikulas mentioned, this reduces performance for everyone else, which is not
great. It also makes the code more complicated.

I also see that you aren't actually using the algorithm in an async manner, but
rather waiting for it synchronously each time. Thus the ability to operate
asynchronously provides no benefit in this case, and this change is purely about
allowing a particular driver to be used, presumably the s390 phmac one from your
recent patchset. Since s390 phmac seems to be new code, and furthermore it is
CPU-based and thus uses virtual addresses (which makes the use of scatterlists
entirely pointless), wouldn't it be easier to just make it implement shash
instead of ahash, moving any wait that may be necessary into the driver itself?

- Eric