From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6D4E81B13A for ; Wed, 26 Sep 2018 12:17:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 03:17:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,305,1534834800"; d="scan'208";a="265839874" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.17.84]) ([10.252.17.84]) by fmsmga005.fm.intel.com with ESMTP; 26 Sep 2018 03:16:40 -0700 To: Shreyansh Jain Cc: ferruh.yigit@intel.com, dev@dpdk.org References: <20180925125423.7505-1-shreyansh.jain@nxp.com> <20180925125423.7505-4-shreyansh.jain@nxp.com> <894130a9-017c-348d-31f8-c4c23f517f25@nxp.com> <67e25f1a-110c-db32-5f3b-a065e77fecc6@intel.com> <5fb7c022-228f-89d3-43b6-5d08e258fba4@nxp.com> From: "Burakov, Anatoly" Message-ID: <97d24013-43cc-5225-13e8-6b1d09da010e@intel.com> Date: Wed, 26 Sep 2018 11:16:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 3/5] common/dpaax: add library for PA VA translation table 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, 26 Sep 2018 10:17:10 -0000 On 25-Sep-18 3:08 PM, Burakov, Anatoly wrote: > On 25-Sep-18 3:00 PM, Shreyansh Jain wrote: >> On Tuesday 25 September 2018 07:21 PM, Burakov, Anatoly wrote: >>> On 25-Sep-18 2:39 PM, Shreyansh Jain wrote: >>>> Hello Anatoly, >>>> >>>> On Tuesday 25 September 2018 06:58 PM, Burakov, Anatoly wrote: >>>>> On 25-Sep-18 1:54 PM, Shreyansh Jain wrote: >>>>>> A common library, valid for dpaaX drivers, which is used to maintain >>>>>> a local copy of PA->VA translations. >>>>>> >>>>>> In case of physical addressing mode (one of the option for FSLMC, and >>>>>> only option for DPAA bus), the addresses of descriptors Rx'd are >>>>>> physical. These need to be converted into equivalent VA for rte_mbuf >>>>>> and other similar calls. >>>>>> >>>>>> Using the rte_mem_virt2iova or rte_mem_virt2phy is expensive. This >>>>>> library is an attempt to reduce the overall cost associated with >>>>>> this translation. >>>>>> >>>>>> A small table is maintained, containing continuous entries >>>>>> representing a continguous physical range. Each of these entries >>>>>> stores the equivalent VA, which is fed during mempool creation, or >>>>>> memory allocation/deallocation callbacks. >>>>>> >>>>>> Signed-off-by: Shreyansh Jain >>>>>> --- >>>>> >>>>> Hi Shreyansh, >>>>> >>>>> So, basically, you're reimplementing old DPDK's memory view >>>>> (storing VA's in a PA-centric way). Makes sense :) >>>> >>>> Yes, and frankly, I couldn't come up with any other way. >>>> >>>>> >>>>> I should caution you that right now, external memory allocator >>>>> implementation does *not* trigger any callbacks for newly added >>>>> memory. So, anything coming from external memory will not be >>>>> reflected in your table, unless it happens to be already there >>>>> before dpaax_iova_table_populate() gets called. This patchset makes >>>>> a good argument for why perhaps it should trigger callbacks. Thoughts? >>>> >>>> Oh. Then I must be finishing reading through your patches for >>>> external memory sooner. I didn't realize this. >>> >>> To be clear, the current implementation of external memory allocators >>> is not necessarily final - it's not too late to add callbacks to >>> enable your use case better, if that's required (and it should be >>> pretty easy to implement as well). >>> >> >> Is there any reason why external may not be raising call back right >> now? I might have missed any previous conversation on this. Or may be, >> it is just lack of need. > > Well, pretty much - it didn't occur to me that it may be needed. I > specifically went out of my way to note that it is the responsibility of > the user to perform any DMA mappings, but i missed the fact that there > may be other users interested to know that a user has just added a new > external memory segment. > >> >> As for whether it is required - I do see a need. It is definitely >> possible that after rte_eal_init has been completed (and underlying >> probe), applications allocate memory. In which case, even existing >> memevent callbacks (like the one in fslmc_bus, which VFIO/DMA maps the >> area) would have issues. From the external memory patchset, I do see >> that it is assumed DMA mapping is caller's responsibility. >> >> Having such callback would help drives reduce that throwback of >> responsibility. > > I do not want to assume that user necessarily wants to map external > memory for DMA unless explicitly asked to do so. At the same time, i can > see that some uses may not have anything to do with DMA mapping and may > instead be cases like yours, where you just need the address. In our > case, we can just ignore external memory in VFIO and virtio callbacks, > but still allow other callbacks to handle external memory as they see fit. > >> >> (Speaking of external memory patches, I also realize that my memevent >> callback in this patch series need to handle msl->external). > > Yes, we have to be careful on merge. > Hi Shreyansh, I'm currently implementing callback support for external memory. I think the decision to leave DMA mapping to the user may have been a bad one. For starters, one of the buses (bus/fslmc) has its own VFIO infrastructure independent of EAL's VFIO, so if we don't map it there - we can't map it at all because there's no generic manual way to do a DMA map with bus/fslmc driver after the fact. Also, if we leave VFIO mapping to the user, we end up with an inconsistency where we provide memory callbacks which can potentially create DMA mappings (such as what some MLX drivers do), but VFIO DMA mappings will be ignored because "reasons". The only place where we really *don't* want to see external memory is virtio, because there is no segment fd support for external memory yet. Every other place, i think it's a good idea to not skip external memory. So, starting from v5, DMA mapping will be performed automatically for external memory when IOVA addresses are available. -- Thanks, Anatoly