Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752568AbeADKQn (ORCPT + 1 other); Thu, 4 Jan 2018 05:16:43 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:46820 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbeADKQm (ORCPT ); Thu, 4 Jan 2018 05:16:42 -0500 X-Google-Smtp-Source: ACJfBov6Oo+tqgs+kRyAmsabAzSLxTC0ayj+PxGIwDIjwuVcXavH1vtbhNHjVB9oK0HbPjDIreddaA== Reply-To: christian.koenig@amd.com Subject: Re: [PATCH] swiotlb: suppress warning when __GFP_NOWARN is set v4 To: Christoph Hellwig Cc: konrad.wilk@oracle.com, linux-kernel@vger.kernel.org References: <20180104093233.16311-1-christian.koenig@amd.com> <20180104095325.GB13091@infradead.org> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Thu, 4 Jan 2018 11:16:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180104095325.GB13091@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Am 04.01.2018 um 10:53 schrieb Christoph Hellwig: > This seems to collide with my dma direct/swiotlb series posted recently. > >> +++ b/lib/swiotlb.c >> @@ -490,11 +490,11 @@ static void swiotlb_bounce(phys_addr_t orig_addr, phys_addr_t tlb_addr, >> } >> } >> >> -phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, >> - dma_addr_t tbl_dma_addr, >> - phys_addr_t orig_addr, size_t size, >> - enum dma_data_direction dir, >> - unsigned long attrs) >> +static phys_addr_t tbl_map_single(struct device *hwdev, >> + dma_addr_t tbl_dma_addr, >> + phys_addr_t orig_addr, size_t size, >> + enum dma_data_direction dir, >> + unsigned long attrs, bool warn) > We already have DMA_ATTR_NO_WARN which can be passed in attrs. Please > use it instead of reinventing it. > >> swiotlb_alloc_coherent(struct device *hwdev, size_t size, >> dma_addr_t *dma_handle, gfp_t flags) >> { >> + bool warn = !(flags & __GFP_NOWARN); >> dma_addr_t dev_addr; >> void *ret; >> int order = get_order(size); >> @@ -739,7 +750,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, >> * will grab memory from the lowest available address range. >> */ >> phys_addr_t paddr = map_single(hwdev, 0, size, >> - DMA_FROM_DEVICE, 0); >> + DMA_FROM_DEVICE, 0, warn); > Note: in my above series swiotlb_alloc_coherent is going away, and > replaced with a swiotlb_alloc that takes a dma_attrs argument. That's what I thought about as well, but this is a bug fix for stable kernels. So the changes should be as small as possible. But using DMA_ATTR_NO_WARN is a good point, going to send a v5 which uses this instead. Regards, Christian. > > Using that for passing the nowarn flag is the right way to go instead > of using __GFP_NOWARN.