Re: Memory corruption with CONFIG_SWIOTLB_DYNAMIC=y

From: Christoph Hellwig
Date: Mon Nov 06 2023 - 02:44:56 EST


On Fri, Nov 03, 2023 at 07:59:49PM +0100, Petr Tesařík wrote:
> I don't think it's possible to improve the allocation logic without
> modifying the page allocator and/or the DMA atomic pool allocator to
> take additional constraints into account.
>
> I had a wild idea back in March, but it would require some intrusive
> changes in the mm subsystem. Among other things, it would make memory
> zones obsolete. I mean, people may actually like to get rid of DMA,
> DMA32 and NORMAL, but you see how many nasty bugs were introduced even
> by a relatively small change in SWIOTLB. Replacing memory zones with a
> system based on generic physical allocation constraints would probably
> blow up the universe. ;-)

It would be very nice, at least for DMA32 or the 30/31-bit DMA pools
used on some architectures. For the x86-style 16MB zone DMA I suspect
just having a small pool on the side that's not even exposed to the
memory allocator would probably work better.

I think a lot of the MM folks would love to be able to kill of the
extra zones.