Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'dma-mapping-6.6-2023-09-09' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fixes from Christoph Hellwig:

- move a dma-debug call that prints a message out from a lock that's
causing problems with the lock order in serial drivers (Sergey
Senozhatsky)

- fix the CONFIG_DMA_NUMA_CMA Kconfig entry to have the right
dependency and not default to y (Christoph Hellwig)

- move an ifdef a bit to remove a __maybe_unused that seems to trip up
some sensitivities (Christoph Hellwig)

- revert a bogus check in the CMA allocator (Zhenhua Huang)

* tag 'dma-mapping-6.6-2023-09-09' of git://git.infradead.org/users/hch/dma-mapping:
Revert "dma-contiguous: check for memory region overlap"
dma-pool: remove a __maybe_unused label in atomic_pool_expand
dma-contiguous: fix the Kconfig entry for CONFIG_DMA_NUMA_CMA
dma-debug: don't call __dma_entry_alloc_check_leak() under free_entries_lock

+18 -13
+1 -1
kernel/dma/Kconfig
··· 160 160 161 161 config DMA_NUMA_CMA 162 162 bool "Enable separate DMA Contiguous Memory Area for NUMA Node" 163 - default NUMA 163 + depends on NUMA 164 164 help 165 165 Enable this option to get numa CMA areas so that NUMA devices 166 166 can get local memory by DMA coherent APIs.
-5
kernel/dma/contiguous.c
··· 473 473 return -EBUSY; 474 474 } 475 475 476 - if (memblock_is_region_reserved(rmem->base, rmem->size)) { 477 - pr_info("Reserved memory: overlap with other memblock reserved region\n"); 478 - return -EBUSY; 479 - } 480 - 481 476 if (!of_get_flat_dt_prop(node, "reusable", NULL) || 482 477 of_get_flat_dt_prop(node, "no-map", NULL)) 483 478 return -EINVAL;
+15 -5
kernel/dma/debug.c
··· 637 637 return entry; 638 638 } 639 639 640 - static void __dma_entry_alloc_check_leak(void) 640 + /* 641 + * This should be called outside of free_entries_lock scope to avoid potential 642 + * deadlocks with serial consoles that use DMA. 643 + */ 644 + static void __dma_entry_alloc_check_leak(u32 nr_entries) 641 645 { 642 - u32 tmp = nr_total_entries % nr_prealloc_entries; 646 + u32 tmp = nr_entries % nr_prealloc_entries; 643 647 644 648 /* Shout each time we tick over some multiple of the initial pool */ 645 649 if (tmp < DMA_DEBUG_DYNAMIC_ENTRIES) { 646 650 pr_info("dma_debug_entry pool grown to %u (%u00%%)\n", 647 - nr_total_entries, 648 - (nr_total_entries / nr_prealloc_entries)); 651 + nr_entries, 652 + (nr_entries / nr_prealloc_entries)); 649 653 } 650 654 } 651 655 ··· 660 656 */ 661 657 static struct dma_debug_entry *dma_entry_alloc(void) 662 658 { 659 + bool alloc_check_leak = false; 663 660 struct dma_debug_entry *entry; 664 661 unsigned long flags; 662 + u32 nr_entries; 665 663 666 664 spin_lock_irqsave(&free_entries_lock, flags); 667 665 if (num_free_entries == 0) { ··· 673 667 pr_err("debugging out of memory - disabling\n"); 674 668 return NULL; 675 669 } 676 - __dma_entry_alloc_check_leak(); 670 + alloc_check_leak = true; 671 + nr_entries = nr_total_entries; 677 672 } 678 673 679 674 entry = __dma_entry_alloc(); 680 675 681 676 spin_unlock_irqrestore(&free_entries_lock, flags); 677 + 678 + if (alloc_check_leak) 679 + __dma_entry_alloc_check_leak(nr_entries); 682 680 683 681 #ifdef CONFIG_STACKTRACE 684 682 entry->stack_len = stack_trace_save(entry->stack_entries,
+2 -2
kernel/dma/pool.c
··· 135 135 remove_mapping: 136 136 #ifdef CONFIG_DMA_DIRECT_REMAP 137 137 dma_common_free_remap(addr, pool_size); 138 - #endif 139 - free_page: __maybe_unused 138 + free_page: 140 139 __free_pages(page, order); 140 + #endif 141 141 out: 142 142 return ret; 143 143 }