On Thu, 2024-06-13 at 17:51 +0800, Baochen Qiang wrote: > > > > Not sure that means anything though, I really would have expected a 4k > > buffer to be 4k aligned - why would you even want to map it across two > > pages? > IMO SWIOTLB manages buffers in a unit of IO_TLB_SIZE, it does not care about whether or not we are crossing page boundaries, no? Well arguably it should have some 'natural' alignment guarantees? > > > > If it is SWIOTLB, shouldn't we get into this condition? > > > > /* > > * Historically, swiotlb allocations >= PAGE_SIZE were guaranteed to be > > * page-aligned in the absence of any other alignment requirements. > > * 'alloc_align_mask' was later introduced to specify the alignment > > * explicitly, however this is passed as zero for streaming mappings > > * and so we preserve the old behaviour there in case any drivers are > > * relying on it. > > */ > > if (!alloc_align_mask && !iotlb_align_mask && alloc_size >= PAGE_SIZE) > > alloc_align_mask = PAGE_SIZE - 1; > > > This is not present in 6.6.32 stable kernel. > Oh. So I guess try to pick up commit 14cebf689a78 ("swiotlb: Reinstate page-alignment for mappings >= PAGE_SIZE"). johannes