Re: [PATCH v3 0/3] Fix double allocation in swiotlb_alloc()

From: Petr Tesařík
Date: Mon Feb 19 2024 - 07:40:32 EST


On Mon, 19 Feb 2024 09:24:39 +0000
Will Deacon <will@xxxxxxxxxx> wrote:

> Hey Christoph,
>
> On Mon, Feb 19, 2024 at 07:35:27AM +0100, Christoph Hellwig wrote:
> > Robin and Petr, does this looks good to you now?

It looks good to me for the boot-time swiotlb pool. Dynamic allocation
of transient swiotlb pools does not take these additional alignment
constraints into account, so when allocation may fail. OTOH the
underlying allocator(s) do not provide a suitable API, so I don't think
it's worth fixing.

In the worst case, a DMA buffer will fail to map, which may already
happen today.

> FWIW, I'm likely to send a v4 addressing another issue reported by
> Nicolin with NVME and 64k pages [1], so you may as well wait for that.

I'm interested. The code look quite OK to me as it is, but I assume it
again uncovers something when the difference between PAGE_SHIFT and
IOTLB_SHIFT is more than one (which was motivation for my initial fix,
which in the end broke more than it fixed).

Petr T