Re: [PATCH v4 2/3] gup: introduce unpin_user_folio_dirty_locked()
From: Jason Gunthorpe
Date: Thu Jun 19 2025 - 08:36:33 EST
On Thu, Jun 19, 2025 at 05:05:42PM +0800, lizhe.67@xxxxxxxxxxxxx wrote:
> As I understand it, there seem to be some issues with this
> implementation. How can we obtain the value of dma->has_reserved
> (acquiring it within vfio_pin_pages_remote() might be a good option)
Yes, you record it during vfio_pin_pages operations. If VFIO call
iommu_map on something that went down the non-GUP path then it sets
the flag.
> and ensure that this value remains unchanged from the time of
> assignment until we perform the unpin operation?
Map/unmap are paired and not allowed to race so that isn't an issue.
> I've searched through the code and it appears that there are
> instances where SetPageReserved() is called outside of the
> initialization phase. Please correct me if I am wrong.
It should not be relevant here, pages under use by VFIO are not
permitted to change it will break things.
Jason