Re: [PATCH 2/2] swiotlb: Enforce page alignment in swiotlb_alloc()

From: Christoph Hellwig
Date: Tue Jan 30 2024 - 09:34:59 EST


On Mon, Jan 29, 2024 at 07:49:40PM +0000, Will Deacon wrote:
> > > return pfn_to_page(PFN_DOWN(tlb_addr));
> >
> > So PFN_DOWN aligns the address and thus per se converting the unaligned
> > address isn't a problem.
>
> Hmm, I'm not sure I follow why it isn't a problem. If the first 2KiB slot
> of the 4KiB page has already been allocated to somebody else, isn't it a
> big problem to align down like that? Maybe I should word the warning
> message a bit better -- how about:

But the problem is that it's used, not that we can't create a page
from a non-aligned address.

>
> "Cannot allocate pages from non page-aligned swiotlb addr 0x%pa.\n"

That sounds better.