On 2/20/2024 1:06 AM, mawupeng wrote:
On 2024/2/20 16:37, Xin Li wrote:
On 2/19/2024 7:48 PM, Wupeng Ma wrote:
follow_phys() was introduced in commit 28b2ee20c7cba ("access_process_vm
device memory infrastructure") in 2008 for getting a physical page address
for a virtual address, and used in generic_access_phys(). And later it's
used in x86 PAT code.
Commit 03668a4debf4f ("mm: use generic follow_pte() in follow_phys()") made
follow_phys() more of a wrapper of follow_pte(), and commit 96667f8a4382d
("mm: Close race in generic_access_phys") replaced follow_phys() with
follow_pte() in generic_access_phys(). And the end result is that
follow_phys() is used in x86 PAT code only.
Thanks for the explanation. I have a better understanding of the history of
this function.
"git blame" tells the story.
As follow_phys() in untrack_pfn() can be replaced with follow_pfn(), then
Yes, this can be replaced with follow_pfn().
maybe we don't have to keep follow_phys(), and just use follow_pte() in
track_pfn_copy()?
As follow_phys() will return unsigned long *prot which is need in track_pfn_copy(),
we need to do something with this.
Commit 96667f8a4382d did that already.
Can we replace follow_pfn with follow_phys()?
Sorry, I don't get your point.
Thanks!
Xin