Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbcDRPVR (ORCPT ); Mon, 18 Apr 2016 11:21:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59679 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbcDRPVP (ORCPT ); Mon, 18 Apr 2016 11:21:15 -0400 Subject: Re: [PATCH V2] net: ethernet: mellanox: correct page conversion To: Christoph Hellwig , Eli Cohen References: <1460845412-13120-1-git-send-email-okaya@codeaurora.org> <20160418065447.GA11539@x-vnc01.mtx.labs.mlnx> <20160418143255.GA15203@infradead.org> <20160418151702.GA26565@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: <5714FB68.3020604@codeaurora.org> Date: Mon, 18 Apr 2016 11:21:12 -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: <20160418151702.GA26565@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: 1655 Lines: 43 On 4/18/2016 11:17 AM, Christoph Hellwig wrote: > On Mon, Apr 18, 2016 at 02:39:36PM +0000, Eli Cohen wrote: >> Right, I did not suggest this as a patch but just wanted to pinpoint the problematic issue which is that virt_to_page does not give you the correct pointer to the page. > > Removing both the virt_to_page + vmap calls would solve the issue > indeed. > I was looking at the code. I don't see how removing virt_to_page + vmap would solve the issue. The code is trying to access the buffer space with direct.buf member from the CPU side. This member would become NULL, when this code is removed and also in mlx4_en_map_buffer. if (BITS_PER_LONG == 64) { struct page **pages; pages = kmalloc(sizeof *pages * buf->nbufs, gfp); if (!pages) goto err_free; ... ... if (!buf->direct.buf) goto err_free; } drivers/net/ethernet/mellanox/mlx4/en_tx.c (2 hits) Line 110: ring->buf = ring->wqres.buf.direct.buf; Line 114: (unsigned long long) ring->wqres.buf.direct.map); drivers/net/ethernet/mellanox/mlx4/en_rx.c (1 hit) Line 404: ring->buf = ring->wqres.buf.direct.buf; drivers/net/ethernet/mellanox/mlx4/en_cq.c (1 hit) Line 85: cq->buf = (struct mlx4_cqe *)cq->wqres.buf.direct.buf; What am I missing? -- 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