On 2022-11-07 14:38, Christoph Hellwig wrote:
On Mon, Nov 07, 2022 at 01:03:31PM +0000, Robin Murphy wrote:
On 2022-11-06 22:01, Catalin Marinas wrote:
With all the infrastructure in place for bouncing small kmalloc()
buffers, add the corresponding Kconfig entry and select it for arm64.
AFAICS we're missing the crucial part to ensure that SWIOTLB is available
even when max_pfn <= arm64_dma_phys_limit, which is very likely to be true
on low-memory systems that care most about kmalloc wastage. The only way to
override that currently is with "swiotlb=force", but bouncing *everything*
is not desirable either.
FYI, one of the reasons for the swiotlb_init refactor that passes
flags and a boolean a while ago is that we can trivially just either
pass another flag or check a condition in swiotlb_init to allocate the
buffer. There's actually another case for which we need the
unconditional allocation, and that is the bouncing for untrusted
external devices with dma-iommu.
Right, I guess machines with Thunderbolt and all the firmware
annotations but less than 4GB of RAM are unlikely to exist in the wild,
so the untrusted bouncing logic has been getting lucky so far. There are
however plenty of arm64 systems with small amounts of RAM and
non-coherent USB so in this case someone's likely to fall over it pretty
much right away. I know it's easy to add a new condition, but it still
has to actually *be* added.
Thanks,
Robin.