History

dma-mapping: warn when coherent pool is depleted

When a DMA coherent pool is depleted, allocation failures may or may not get reported in the kernel log depending on the allocator. The admin does have a workaround, however, by using coherent_pool= on the kernel command line. Provide some guidance on the failure and a recommended minimum size for the pools (double the size).

David Rientjes committed 6 years ago

Commit 71cdec41 parent 9ebcfad1 file · +5 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/dma/pool.c+5−1
@@ -239,12 +239,16 @@ void *dma_alloc_from_pool(struct device *dev, size_t size, · 238 unmodified lines
239239 }
240240
241241 val = gen_pool_alloc(pool, size);
242− if (val) {
242+ if (likely(val)) {
243243 phys_addr_t phys = gen_pool_virt_to_phys(pool, val);
244244
245245 *ret_page = pfn_to_page(__phys_to_pfn(phys));
246246 ptr = (void *)val;
247247 memset(ptr, 0, size);
248+ } else {
249+ WARN_ONCE(1, "DMA coherent pool depleted, increase size "
250+ "(recommended min coherent_pool=%zuK)\n",
251+ gen_pool_size(pool) >> 9);
248252 }
249253 if (gen_pool_avail(pool) < atomic_pool_size)
250254 schedule_work(&atomic_pool_work);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t