[dpdk-dev] [PATCH v3 46/68] vfio: allow to map other memory regions

Burakov, Anatoly anatoly.burakov at intel.com
Wed Apr 4 13:27:41 CEST 2018


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 <pawelx.wodkowski at intel.com>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> ---
> 

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


More information about the dev mailing list