On Wed, Aug 31, 2022 at 1:59 PM John Hubbard <jhubbard@xxxxxxxxxx> wrote: > > On 8/31/22 12:43, Yang Shi wrote: > >>> It looks powerpc does issue IPI for pmd flush. But arm64 doesn't IIRC. > >>> > >>> So maybe we should implement pmdp_collapse_flush() for those arches to > >>> issue IPI. > >> > >> ... or find another way to detect and handle this in GUP-fast? > >> > >> Not sure if, for handling PMDs, it could be sufficient to propagate the > >> pmdp pointer + value and double check that the values didn't change. > > > > Should work too, right before pinning the page. > > > > pmdp_collapse_flush() is actually just called by khugepaged, so arch > > specific implementation should not be a problem and we avoid making > > gup fast more complicated. > > > > And just to pile on, about that gup fast complexity: depending upon IPIs > added a lot of complexity, not just because of the IPI dependency, but > more importantly because only some arches even *have* IPIs. So an > entirely different set of reasoning has to be used *in addition* to > working through the IPI story. And sure enough, we can see the fallout: > you are uncovering lots of half-correct comments in that area. > > So getting rid of the dependency on IPIs in gup fast would go a long way > to simplifying it, and maybe even improving overall CPU load (insert > some hand-wavy notes here about IPIs being worse than things like RCU). > > But the real win is in the complexity reduction in gup fast. Thanks, John. Yeah, I still had some wrong impressions about how to serialize against fast GUP. If you guys thought fixing the problem in gup code is the preferred way, I won't insist on arch-specific pmdp_collapse_flush(). > > > thanks, > > -- > John Hubbard > NVIDIA