Thread (43 messages) 43 messages, 6 authors, 2024-08-30

Re: [RFC 0/7] Introduce swiotlb throttling

From: Petr Tesařík <hidden>
Date: 2024-08-23 05:46:49
Also in: linux-hyperv, linux-iommu, linux-nvme, linux-scsi, lkml

On Fri, 23 Aug 2024 02:20:41 +0000
Michael Kelley [off-list ref] wrote:
From: Bart Van Assche <bvanassche@acm.org> Sent: Thursday, August 22, 2024 12:29 PM
quoted
On 8/22/24 11:37 AM, mhkelley58@gmail.com wrote:  
quoted
Linux device drivers may make DMA map/unmap calls in contexts that
cannot block, such as in an interrupt handler.  
Although I really appreciate your work, what alternatives have been
considered? How many drivers perform DMA mapping from atomic context?
Would it be feasible to modify these drivers such that DMA mapping
always happens in a context in which sleeping is allowed?
  
I had assumed that allowing DMA mapping from interrupt context is a
long-time fundamental requirement that can't be changed.  It's been
allowed at least for the past 20 years, as Linus added this statement to
kernel documentation in 2005:

   The streaming DMA mapping routines can be called from interrupt context.

But I don't have any idea how many drivers actually do that. There are
roughly 1700 call sites in kernel code/drivers that call one of the
dma_map_*() variants, so looking through them all doesn't seem
feasible.
Besides, calls from interrupt context are not the only calls which are
not allowed to schedule (e.g. lock nesting comes to mind). Even if we
agreed to make DMA mapping routines blocking, I believe the easiest way
would be to start adding DMA_ATTR_MAY_BLOCK until it would be used by
all drivers. ;-)

But most importantly, if streaming DMA could block, there would be no
need for a SWIOTLB, because you could simply allocate a bounce buffer
from the buddy allocator when it's needed.

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