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
239 }239 }
240 240
241 val = gen_pool_alloc(pool, size);241 val = gen_pool_alloc(pool, size);
242 if (val) {242 if (likely(val)) {
243 phys_addr_t phys = gen_pool_virt_to_phys(pool, val);243 phys_addr_t phys = gen_pool_virt_to_phys(pool, val);
244 244
245 *ret_page = pfn_to_page(__phys_to_pfn(phys));245 *ret_page = pfn_to_page(__phys_to_pfn(phys));
246 ptr = (void *)val;246 ptr = (void *)val;
247 memset(ptr, 0, size);247 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);
248 }252 }
249 if (gen_pool_avail(pool) < atomic_pool_size)253 if (gen_pool_avail(pool) < atomic_pool_size)
250 schedule_work(&atomic_pool_work);254 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