Hi Jonathan, On Tue, Apr 19, 2022 at 12:12:41PM +0100, Jonathan Cameron wrote: > For a long time IIO has been making assumption that ____cacheline_aligned > was sufficient to ensure buffers were in their own cacheline and hence > DMA safe. As you noticed, it's not. __cacheline_aligned is meant to align to SMP_CACHE_BYTES which is L1_CACHE_BYTES, typically smaller than ARCH_DMA_MINALIGN. > The above series also highlights that we can do much better anyway on some platforms > using the new ARCH_DMA_MINALIGN (currently it's only defined for some archs but > after that patch everyone gets it). We should be safe to use that everywhere > we currently force ___cachline_aligned and waste a little less space on padding > which is always nice ;) I guess in the meantime you can just use ARCH_KMALLOC_MINALIGN, it gives you the DMA guarantees. Any series decoupling the two will have to update the use. I prefer to use ARCH_DMA_MINALIGN for DMA alignment but still discussing the best way to address the crypto code changes. > Given we have no reports of a problem with 128 byte non DMA coherent platforms > I don't propose to 'fix' this until we can make use of the new define > in the above patch set. That is going to make a mess of backporting the > fix however. I'm wishing we did what crypto has done and had a subsystem > specific define for this but such is life. Maybe we should add a generic __dma_aligned. > We will also want to be careful > that we cover the rather odd sounding case of ARCH_DMA_MINALIGN < 8 given > there are a few drivers that rely on >= 8 to ensure we can do aligned puts > of 64 bit timestamps. I don't think ARCH_DMA_MINALIGN should go below sizeof(long long), that's what ARCH_KMALLOC_MINALIGN is by default, it would break other things. > +CC Catalin for info. If you can sneak the first patch in your series > in for next cycle that would be great even if the rest takes a while longer. I'll try but we have to agree on the crypto change because keeping CRYPTO_MINALIGN as the smaller ARCH_KMALLOC_MINALIGN risks breaking DMA into those structures. -- Catalin