On Tue, Feb 04, 2025 at 12:42:20PM -0500, Steven Sistare wrote:

> !-------------------------------------------------------------------|
>  CAUTION: External Email
> 
> |-------------------------------------------------------------------!
> 
> On 2/4/2025 10:47 AM, Cédric Le Goater wrote:
> > + John (for vfio-user)
> > 
> > On 1/29/25 15:43, Steve Sistare wrote:
> > > Return the memory region that the translated address is found in, for
> > > use in a subsequent patch.  No functional change.
> > 
> > Keeping a reference on this memory region could be risky. What for ?
> 
> The returned mr is briefly used here in later patches:
> 
> vfio_iommu_map_notify()
>   vfio_get_xlat_addr(&mr)
>     vfio_container_dma_map(mr->ram_block)   ******
>       if ram_block is right
>         vioc->dma_map_file()
>       else
>         vioc->dma_map()

The need for ->ram_block in dma map/unmap is exactly the case for vfio-user too.

Cédric:

> > There is a risk that the life cycle of the returned MemoryRegion
> > doesn't match VFIO expectations.

Can you perhaps explain in a bit more detail your concerns? Are you talking
about current code, or possible future uses?

Is there an alternative approach you could suggest?

regards
john

Reply via email to