Re: [v2 PATCH 0/9] crypto: Add helpers for allocating with DMA alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 25 Nov 2022 at 05:35, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> This patch series adds helpers to allow drivers to explicitly
> request ARCH_DMA_MINALIGN when allocating memory through the
> Crypto API.
>
> Note that I've only converted one file in one driver as this
> is only meant to show how it's done and find out what else we
> may need.
>
> Other drivers will be added later.
>

Hi Herbert,

This approach seems conceptually similar to what I proposed a while ago:
https://lore.kernel.org/all/20220406142715.2270256-1-ardb@xxxxxxxxxx/

If we agree that creating a distinction between ordinary allocations
and ones that are rounded up to DMA alignment is ok, I wonder if we
could minimize the churn by simply choosing between one or the other
by taking the CRYPTO_ALG_ASYNC flag into account. On x86 and other
arches that don't care about the distinction, none of this has any
effect anyway. And on arm64, only hardware implementations use the
CRYPTO_ALG_ASYNC flag, which makes its presence a reasonable heuristic
to decide whether an algo implementation is backed by hardware that
relies on DMA (the penalty for getting it wrong would be to use DMA
ailgnment unnecessarily, which we already do today anyway)

We'd still need changes in the generic crypto layer to distinguish the
two cases, but we wouldn't need any changes to the drivers, which
seems like a huge benefit to me



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux