Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753184AbcDRQG4 (ORCPT ); Mon, 18 Apr 2016 12:06:56 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37850 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752807AbcDRQGy (ORCPT ); Mon, 18 Apr 2016 12:06:54 -0400 Subject: Re: [PATCH V2] net: ethernet: mellanox: correct page conversion To: David Miller References: <1460845412-13120-1-git-send-email-okaya@codeaurora.org> <20160418.000039.1946438541182822213.davem@davemloft.net> <87c17d3f979cf0167cd37077f39d0534@codeaurora.org> <20160418.115902.1053705461620271779.davem@davemloft.net> Cc: linux-rdma@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, yishaih@mellanox.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <5715061A.40802@codeaurora.org> Date: Mon, 18 Apr 2016 12:06:51 -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: <20160418.115902.1053705461620271779.davem@davemloft.net> 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: 1660 Lines: 43 On 4/18/2016 11:59 AM, David Miller wrote: > From: okaya@codeaurora.org > Date: Mon, 18 Apr 2016 01:06:27 -0400 > >> On 2016-04-18 00:00, David Miller wrote: >>> From: Sinan Kaya >>> Date: Sat, 16 Apr 2016 18:23:32 -0400 >>> >>>> Current code is assuming that the address returned by >>>> dma_alloc_coherent >>>> is a logical address. This is not true on ARM/ARM64 systems. This >>>> patch >>>> replaces dma_alloc_coherent with dma_map_page API. The address >>>> returned >>>> can later by virtually mapped from the CPU side with vmap API. >>>> Signed-off-by: Sinan Kaya >>> You can't do this. >>> The DMA map page API gives non-coherent mappings, and thus requires >>> proper flushing. >>> So a straight conversion like this is never legitimate. >> >> I would agree on proper dma api usage. However, the code is already >> assuming coherent architecture by mapping the cpu pages as >> page_kernel. >> >> Dma_map_page returns cached buffers and you don't need cache flushes >> on coherent architecture to make the data visible. > > All you are telling me is that there are two bugs instead of one, so now > both need to be fixed. > The removal of vmap also fixes the coherency assumption. It is one fix for both. I was thinking of submitting another patch to change the vmap argument PAGE_KERNEL based on the coherency support of the architecture. I don't need to do that anymore if the other experiment works. -- 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