Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2022-04-15 10:46:12
Also in:
linux-mm, lkml
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2022-04-15 10:46:12
Also in:
linux-mm, lkml
On Fri, Apr 15, 2022 at 12:22:27PM +0200, Ard Biesheuvel wrote:
Subsequent objects are owned by the driver, and it is the responsibility of the driver not to modify the fields while it is also mapped for DMA (and we have had issues in the past where drivers violated this rule). So as long as ARCH_KMALLOC_ALIGN guarantees actual DMA minimum alignment for both the start and the end, we shouldn't need any explicit padding at the end.
I don't understand why this is guaranteed. The driver context size is arbitrary so it could end in the middle of a cacheline. The slab allocator could well lay it out so that the next kmalloc object starts right after the end of the context, in which case they would share a cache-line. The next kmalloc object could be (and in fact is likely to be) of the same type. Previously this wasn't possible because kmalloc guaranteed alignment.
I'l do a scan of drivers/crypto to figure out how much we are relying on this to begin with.
Thanks, -- Email: Herbert Xu [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel