From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754291AbbFLIwu (ORCPT ); Fri, 12 Jun 2015 04:52:50 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34102 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753737AbbFLIwm (ORCPT ); Fri, 12 Jun 2015 04:52:42 -0400 Date: Fri, 12 Jun 2015 01:49:56 -0700 From: tip-bot for Joerg Roedel Message-ID: Cc: torvalds@linux-foundation.org, jroedel@suse.de, bp@suse.de, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, hpa@zytor.com, dyoung@redhat.com, joro@8bytes.org, peterz@infradead.org, tglx@linutronix.de, konrad.wilk@oracle.com, brgerst@gmail.com, luto@amacapital.net, dvlasenk@redhat.com, mingo@kernel.org, bp@alien8.de, vgoyal@redhat.com, bhe@redhat.com Reply-To: vgoyal@redhat.com, bhe@redhat.com, luto@amacapital.net, dvlasenk@redhat.com, mingo@kernel.org, bp@alien8.de, brgerst@gmail.com, konrad.wilk@oracle.com, peterz@infradead.org, tglx@linutronix.de, joro@8bytes.org, akpm@linux-foundation.org, hpa@zytor.com, dyoung@redhat.com, torvalds@linux-foundation.org, jroedel@suse.de, bp@suse.de, linux-kernel@vger.kernel.org In-Reply-To: <1433500202-25531-2-git-send-email-joro@8bytes.org> References: <1433500202-25531-2-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/kdump] swiotlb: Warn on allocation failure in swiotlb_alloc_coherent() Git-Commit-ID: 94cc81f9a8f995923e35e2db936741dd62d18350 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 94cc81f9a8f995923e35e2db936741dd62d18350 Gitweb: http://git.kernel.org/tip/94cc81f9a8f995923e35e2db936741dd62d18350 Author: Joerg Roedel AuthorDate: Wed, 10 Jun 2015 17:49:40 +0200 Committer: Ingo Molnar CommitDate: Thu, 11 Jun 2015 08:28:38 +0200 swiotlb: Warn on allocation failure in swiotlb_alloc_coherent() Print a warning when all allocation tries have been failed and the function is about to return NULL. This prepares for calling the function with __GFP_NOWARN to suppress allocation failure warnings before all fall-backs have failed - which we'll do to improve kdump behavior. Signed-off-by: Joerg Roedel Signed-off-by: Borislav Petkov Acked-by: Konrad Rzeszutek Wilk Acked-by: Baoquan He Cc: Andrew Morton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Young Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Jörg Rödel Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vivek Goyal Cc: kexec@lists.infradead.org Link: http://lkml.kernel.org/r/1433500202-25531-2-git-send-email-joro@8bytes.org Signed-off-by: Ingo Molnar --- lib/swiotlb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 3c365ab..42e192d 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -656,7 +656,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, */ phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE); if (paddr == SWIOTLB_MAP_ERROR) - return NULL; + goto err_warn; ret = phys_to_virt(paddr); dev_addr = phys_to_dma(hwdev, paddr); @@ -670,7 +670,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ swiotlb_tbl_unmap_single(hwdev, paddr, size, DMA_TO_DEVICE); - return NULL; + goto err_warn; } } @@ -678,6 +678,13 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, memset(ret, 0, size); return ret; + +err_warn: + pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n", + dev_name(hwdev), size); + dump_stack(); + + return NULL; } EXPORT_SYMBOL(swiotlb_alloc_coherent);