aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-22 20:40:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-22 20:40:55 -0400
commite2172d8fd500a51a3845bc2294cdf4feaa388dab (patch)
treef9eb9b8b0d704e3c86d1f953cdbbcf57522f9352
parente75c73ad64478c12b3a44b86a3e7f62a4f65b93e (diff)
parent94fb9334182284e8e7e4bcb9125c25dc33af19d4 (diff)
Merge branch 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 kdump updates from Ingo Molnar: "Three kdump robustness related improvements (Joerg Roedel)" * 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/crash: Allocate enough low memory when crashkernel=high x86/swiotlb: Try coherent allocations with __GFP_NOWARN swiotlb: Warn on allocation failure in swiotlb_alloc_coherent()
-rw-r--r--arch/x86/kernel/pci-swiotlb.c7
-rw-r--r--arch/x86/kernel/setup.c12
-rw-r--r--lib/swiotlb.c11
3 files changed, 23 insertions, 7 deletions
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index 77dd0ad58be4..adf0392d549a 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -20,6 +20,13 @@ void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
20{ 20{
21 void *vaddr; 21 void *vaddr;
22 22
23 /*
24 * Don't print a warning when the first allocation attempt fails.
25 * swiotlb_alloc_coherent() will print a warning when the DMA
26 * memory allocation ultimately failed.
27 */
28 flags |= __GFP_NOWARN;
29
23 vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags, 30 vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags,
24 attrs); 31 attrs);
25 if (vaddr) 32 if (vaddr)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d74ac33290ae..cba828892790 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -531,12 +531,14 @@ static void __init reserve_crashkernel_low(void)
531 if (ret != 0) { 531 if (ret != 0) {
532 /* 532 /*
533 * two parts from lib/swiotlb.c: 533 * two parts from lib/swiotlb.c:
534 * swiotlb size: user specified with swiotlb= or default. 534 * -swiotlb size: user-specified with swiotlb= or default.
535 * swiotlb overflow buffer: now is hardcoded to 32k. 535 *
536 * We round it to 8M for other buffers that 536 * -swiotlb overflow buffer: now hardcoded to 32k. We round it
537 * may need to stay low too. 537 * to 8M for other buffers that may need to stay low too. Also
538 * make sure we allocate enough extra low memory so that we
539 * don't run out of DMA buffers for 32-bit devices.
538 */ 540 */
539 low_size = swiotlb_size_or_default() + (8UL<<20); 541 low_size = max(swiotlb_size_or_default() + (8UL<<20), 256UL<<20);
540 auto_set = true; 542 auto_set = true;
541 } else { 543 } else {
542 /* passed with crashkernel=0,low ? */ 544 /* passed with crashkernel=0,low ? */
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 3c365ab6cf5f..42e192decbfd 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -656,7 +656,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
656 */ 656 */
657 phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE); 657 phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE);
658 if (paddr == SWIOTLB_MAP_ERROR) 658 if (paddr == SWIOTLB_MAP_ERROR)
659 return NULL; 659 goto err_warn;
660 660
661 ret = phys_to_virt(paddr); 661 ret = phys_to_virt(paddr);
662 dev_addr = phys_to_dma(hwdev, paddr); 662 dev_addr = phys_to_dma(hwdev, paddr);
@@ -670,7 +670,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
670 /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ 670 /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
671 swiotlb_tbl_unmap_single(hwdev, paddr, 671 swiotlb_tbl_unmap_single(hwdev, paddr,
672 size, DMA_TO_DEVICE); 672 size, DMA_TO_DEVICE);
673 return NULL; 673 goto err_warn;
674 } 674 }
675 } 675 }
676 676
@@ -678,6 +678,13 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
678 memset(ret, 0, size); 678 memset(ret, 0, size);
679 679
680 return ret; 680 return ret;
681
682err_warn:
683 pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n",
684 dev_name(hwdev), size);
685 dump_stack();
686
687 return NULL;
681} 688}
682EXPORT_SYMBOL(swiotlb_alloc_coherent); 689EXPORT_SYMBOL(swiotlb_alloc_coherent);
683 690