[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250619124906.47505-1-lizhe.67@bytedance.com>
Date: Thu, 19 Jun 2025 20:49:04 +0800
From: lizhe.67@...edance.com
To: jgg@...pe.ca
Cc: akpm@...ux-foundation.org,
alex.williamson@...hat.com,
david@...hat.com,
kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
lizhe.67@...edance.com,
peterx@...hat.com
Subject: Re: [PATCH v4 2/3] gup: introduce unpin_user_folio_dirty_locked()
On Thu, 19 Jun 2025 09:35:04 -0300, jgg@...pe.ca wrote:
> On Thu, Jun 19, 2025 at 05:05:42PM +0800, lizhe.67@...edance.com 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.
Then this approach appears to be no problem, and there’s no need to
introduce any new interfaces. All modifications remain internal to
vfio. I’ll send out a v5 patch based on this approach.
Thanks,
Zhe
Powered by blists - more mailing lists