From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CB3A01B2A2 for ; Wed, 1 Nov 2017 08:29:09 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2017 00:29:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,327,1505804400"; d="scan'208";a="916133961" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.254.27.219]) ([10.254.27.219]) by FMSMGA003.fm.intel.com with ESMTP; 01 Nov 2017 00:29:07 -0700 To: "Tan, Jianfeng" , Thomas Monjalon , "Richardson, Bruce" , "Gonzalez Monroy, Sergio" Cc: "dev@dpdk.org" , Santosh Shukla References: <20171101010726.17781-1-ferruh.yigit@intel.com> <9339bd0d-b9be-21ef-5aa8-1f5b8b5af11f@intel.com> From: Ferruh Yigit Message-ID: <0cc520ff-46c0-e291-755d-acbdacf7bdc0@intel.com> Date: Wed, 1 Nov 2017 00:29:07 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2017 07:29:10 -0000 On 10/31/2017 11:37 PM, Tan, Jianfeng wrote: > > >> -----Original Message----- >> From: Yigit, Ferruh >> Sent: Wednesday, November 1, 2017 2:33 PM >> To: Tan, Jianfeng; Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, >> Sergio >> Cc: dev@dpdk.org; Santosh Shukla >> Subject: Re: [PATCH] eal: disable IOVA mode detection by default >> >> On 10/31/2017 7:17 PM, Tan, Jianfeng wrote: >>> >>> >>>> -----Original Message----- >>>> From: Yigit, Ferruh >>>> Sent: Wednesday, November 1, 2017 9:07 AM >>>> To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio >>>> Cc: dev@dpdk.org; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla >>>> Subject: [PATCH] eal: disable IOVA mode detection by default >>>> >>>> Fix kernel crash with KNI because KNI requires physical addresses. >>>> >>>> A config option introduced to disable IOVA mode detection and to set it >>>> to physical address by default. Disabling config option will enable IOVA >>>> mode detection. >>>> >>>> When there is no intension to use KNI, it is safe to enable detection. >>>> >>>> Config option disable IOVA mode detection by default to be sure only >> who >>>> is aware of result enable it. >>>> >>>> Fixes: 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy") >>>> >>>> Signed-off-by: Ferruh Yigit >>>> --- >>>> Cc: Jianfeng Tan >>>> Cc: Santosh Shukla >>>> Cc: Thomas Monjalon >>> >>> Refer to how vhost-kernel works, we may leverage a memory region table >> to do the translation. The bad side is it's less efficient than current >> phys_to_virt. >> >> Hi Jianfeng, >> >> Can you please elaborate? > > It is very similar to what Jacob proposed (KNI IOMMU). > 1. Share memsegs (memory regions) with KNI, some pairs of (userspace_addr, length). > 2. KNI maintains an address translation table, (userspace_addr, length, kernel_addr). > 3. Every time we need a kernel va, we search the table to obtain the addr. I see, this looks like can work. But I concern about cost of this lookup, which needs to be done per packet. Current address translations are basic arithmetic operations. What do you think doing va -> pa translation in userspace via eal APIs, and keep KNI kernel code intact? Overall translation cost should be same, but the code complexity kept in eal layer which already knows about memsegs. > > Thanks, > Jianfeng > > >> >> Thanks, >> ferruh >> >>> Another side, we did not check the result of phys_to_virt, that's why >> kernel crashes. >>> >>> Thanks, >>> Jianfeng >>> >