From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [PATCH v3 46/68] vfio: allow to map other memory regions Date: Wed, 4 Apr 2018 12:27:41 +0100 Message-ID: References: <0de49c396f7e2c0651acb4cc4a575919234f4c8d.1522797505.git.anatoly.burakov@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Bruce Richardson , keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com, benjamin.walker@intel.com, thomas@monjalon.net, konstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com, louise.m.daly@intel.com, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, olivier.matz@6wind.com, shreyansh.jain@nxp.com, gowrishankar.m@linux.vnet.ibm.com, Pawel Wodkowski To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1B1111C100 for ; Wed, 4 Apr 2018 13:27:48 +0200 (CEST) In-Reply-To: <0de49c396f7e2c0651acb4cc4a575919234f4c8d.1522797505.git.anatoly.burakov@intel.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 04-Apr-18 12:21 AM, Anatoly Burakov wrote: > Currently it is not possible to use memory that is not owned by DPDK to > perform DMA. This scenarion might be used in vhost applications (like > SPDK) where guest send its own memory table. To fill this gap provide > API to allow registering arbitrary address in VFIO container. > > Signed-off-by: Pawel Wodkowski > Signed-off-by: Anatoly Burakov > Signed-off-by: Gowrishankar Muthukrishnan > --- > There's a larger issue raised by this patch. We do support hotplug for VFIO devices, and VFIO will drop all maps whenever last device used by VFIO is unplugged. Since primary use case for this API is mapping non-DPDK-owned memory for DMA, this presents a problem, because we're not tracking the mapped areas anywhere, which means that on last device hot-unplug followed by first device hotplug event, whatever DMA maps user has set up, will be gone - only DPDK-owned memory will be remapped. One way we could solve it is to store user maps in a local tailq and remap those on hotplug. Another way would be to not solve it and just document this limitation - that using this API in conjunction with hotplug will result in undefined behavior. I would tend to favor the first way. -- Thanks, Anatoly