From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] kni: add IOVA va support for kni Date: Mon, 1 Apr 2019 19:20:41 +0100 Message-ID: References: <20180927104846.16356-1-kkokkilagadda@caviumnetworks.com> <3a8f29ca-a9e5-f4a8-742e-f21f2c8d0065@intel.com> <9a29584c5ef02ac205dd74b5e3ce963cb02a7c71.camel@marvell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "Kiran.Kokkilagadda@cavium.com" , "Jerin.JacobKollanukkaran@cavium.com" , "dev@dpdk.org" , "anatoly.burakov@intel.com" , "hemant.agrawal@nxp.com" , "jianfeng.tan@intel.com" To: Jerin Jacob Kollanukkaran , "kkokkilagadda@caviumnetworks.com" Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 629A65B20 for ; Mon, 1 Apr 2019 20:20:44 +0200 (CEST) In-Reply-To: <9a29584c5ef02ac205dd74b5e3ce963cb02a7c71.camel@marvell.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 4/1/2019 6:30 PM, Jerin Jacob Kollanukkaran wrote: > On Tue, 2018-10-02 at 18:05 +0100, Ferruh Yigit wrote: >> On 9/27/2018 11:49 AM, Kiran Kumar wrote: >>> With current KNI implementation kernel module will work only in >>> IOVA=PA mode. This patch will add support for kernel module to work >>> with IOVA=VA mode. >>> >>> The idea is to maintain a mapping in KNI module between user pages >>> and >>> kernel pages and in fast path perform a lookup in this table and >>> get >>> the kernel virtual address for corresponding user virtual address. >>> >>> In IOVA=VA mode, the memory allocated to the pool is physically >>> and virtually contiguous. We will take advantage of this and create >>> a >>> mapping in the kernel.In kernel we need mapping for queues >>> (tx_q, rx_q,... slow path) and mbuf memory (fast path). >>> >>> At the KNI init time, in slow path we will create a mapping for the >>> queues and mbuf using get_user_pages similar to af_xdp. Using pool >>> memory base address, we will create a page map table for the mbuf, >>> which we will use in the fast path for kernel page translation. >>> >>> At KNI init time, we will pass the base address of the pool and >>> size of >>> the pool to kernel. In kernel, using get_user_pages API, we will >>> get >>> the pages with size PAGE_SIZE and store the mapping and start >>> address >>> of user space in a table. >>> >>> In fast path for any user address perform PAGE_SHIFT >>> (user_addr >> PAGE_SHIFT) and subtract the start address from this >>> value, >>> we will get the index of the kernel page with in the page map >>> table. >>> Adding offset to this kernel page address, we will get the kernel >>> address >>> for this user virtual address. >>> >>> For example user pool base address is X, and size is S that we >>> passed to >>> kernel. In kernel we will create a mapping for this using >>> get_user_pages. >>> Our page map table will look like [Y, Y+PAGE_SIZE, Y+(PAGE_SIZE*2) >>> ....] >>> and user start page will be U (we will get it from X >> >>> PAGE_SHIFT). >>> >>> For any user address Z we will get the index of the page map table >>> using >>> ((Z >> PAGE_SHIFT) - U). Adding offset (Z & (PAGE_SIZE - 1)) to >>> this >>> address will give kernel virtual address. >>> >>> Signed-off-by: Kiran Kumar >> >> Hi Kiran, >> >> Thanks for the patch but it was later for this release, missed >> proposal deadline >> etc.. Taking the time remaining for integration deadline, this patch >> will be >> considered for next release. > > Hi Ferruh, > > This patch submitted in Oct last year. Could you please review this? > This feature was added based on community request to support IOVA for > KNI as Initial IOVA support doesn;t have KNI support. > Hi Jerin, I will check it, I remember the request, thanks for the patch.