Thread (79 messages) 79 messages, 7 authors, 13h ago

Re: [PATCH v6 03/20] dma-direct: use DMA_ATTR_CC_SHARED in alloc/free paths

From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2026-07-03 11:46:57
Also in: linux-arm-kernel, linux-coco, linux-iommu, linux-s390, lkml

On Fri, Jul 03, 2026 at 08:15:49PM +1000, Alexey Kardashevskiy wrote:
On 3/7/26 00:47, Jason Gunthorpe wrote:
quoted
On Thu, Jul 02, 2026 at 10:25:16AM +1000, Alexey Kardashevskiy wrote:
quoted
quoted
quoted
not externally available so I'll have to trick the DMA layer into
using SWIOTLB (which is still all shared, right?) as I specifically
want to skip page conversions. Setting low DMA mask won't guarantee
that the DMA layer won't allocate a page outside of SWIOTLB and
convert it. Manually do
Why so particular?
aahhh I missed "pre-". I need a way to get pre-shared pages for my
sev-guest activities.
It sounds to me like you don't, what you are worried about is
optimizing the dma_alloc_coherent flow to avoid fragmentation and all
CC architetures require this optimization.
It is not about fragmentation, it is about unwanted page state
changes when few pages are shared for a very short time.
That's really basically the same thing. The responsiblity for
optimizing the shared/private conversion lies with the DMA API not the
callers.
When I needed these pages, I could: get a private page, convert,
(possibly trigger RMP and IO PDE smashing if that 4K is backed with
2M), do the VM<->HV communication, convert back to private (and
possibly unsmash the page).
IMHO it would be better to use something like dma_pool to amortize the
coherent allocations instead of trying to hack with swiotlb.

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help