Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807AbcDSShr (ORCPT ); Tue, 19 Apr 2016 14:37:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40208 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753417AbcDSShq (ORCPT ); Tue, 19 Apr 2016 14:37:46 -0400 Subject: Re: [PATCH V2] net: ethernet: mellanox: correct page conversion To: Christoph Hellwig References: <1460845412-13120-1-git-send-email-okaya@codeaurora.org> <20160419182212.GA8441@infradead.org> Cc: linux-rdma@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, Yishai Hadas , netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <57167AF6.9090507@codeaurora.org> Date: Tue, 19 Apr 2016 14:37:42 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160419182212.GA8441@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1983 Lines: 47 On 4/19/2016 2:22 PM, Christoph Hellwig wrote: > What I think we need is something like the patch below. In the long > ru nwe should also kill the mlx4_buf structure which now is pretty > pointless. Maybe; this could be the correct approach if we can guarantee that the architecture can allocate the requested amount of memory with dma_alloc_coherent. When I brought this issue a year ago, the objection was that my code doesn't compile on intel (dma_to_phys) and also some arches run out of DMA memory with existing customer base. If there is a real need to maintain compatibility with the existing architectures due to limited amount of DMA memory, we need to correct this code to make proper use of vmap via alloc_pages and also insert the dma_sync in proper places for DMA API conformance. Also, the tx descriptors always has to be allocated from a single DMA region or the tx code needs to be corrected to support page_list. If we can live with just using dma_alloc_coherent, your solution is better. I was trying to put this support for 64bit arches only while maintaining support for the existing code base. > > --- > From a493881d2a6c90152d3daabb7b6b3afd1d254d78 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Tue, 19 Apr 2016 14:12:14 -0400 > Subject: mlx4_en: don't try to split and vmap dma coherent allocations > > The memory returned by dma_alloc_coherent is not suitable for calling > virt_to_page on it, as it might for example come from vmap allocator. > > Remove the code that calls virt_to_page and vmap on dma coherent > allocations from the mlx4 drivers, and replace them with a single > high-order dma_alloc_coherent call. > > Signed-off-by: Christoph Hellwig > Reported-by: Sinan Kaya -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project