Skip to content

Commit f3963f6

Browse files
committed
mm/access_process_vm: use the new follow_pfnmap API
jira LE-3557 Rebuild_History Non-Buildable kernel-5.14.0-570.26.1.el9_6 commit-author Peter Xu <[email protected]> commit b17269a Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-570.26.1.el9_6/b17269a5.failed Use the new API that can understand huge pfn mappings. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Niklas Schnelle <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> (cherry picked from commit b17269a) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # mm/memory.c
1 parent 5f19a10 commit f3963f6

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
mm/access_process_vm: use the new follow_pfnmap API
2+
3+
jira LE-3557
4+
Rebuild_History Non-Buildable kernel-5.14.0-570.26.1.el9_6
5+
commit-author Peter Xu <[email protected]>
6+
commit b17269a51cc7f046a6f2cf9a6c314a0de885e5a5
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-570.26.1.el9_6/b17269a5.failed
10+
11+
Use the new API that can understand huge pfn mappings.
12+
13+
Link: https://lkml.kernel.org/r/[email protected]
14+
Signed-off-by: Peter Xu <[email protected]>
15+
Cc: Alexander Gordeev <[email protected]>
16+
Cc: Alex Williamson <[email protected]>
17+
Cc: Aneesh Kumar K.V <[email protected]>
18+
Cc: Borislav Petkov <[email protected]>
19+
Cc: Catalin Marinas <[email protected]>
20+
Cc: Christian Borntraeger <[email protected]>
21+
Cc: Dave Hansen <[email protected]>
22+
Cc: David Hildenbrand <[email protected]>
23+
Cc: Gavin Shan <[email protected]>
24+
Cc: Gerald Schaefer <[email protected]>
25+
Cc: Heiko Carstens <[email protected]>
26+
Cc: Ingo Molnar <[email protected]>
27+
Cc: Jason Gunthorpe <[email protected]>
28+
Cc: Matthew Wilcox <[email protected]>
29+
Cc: Niklas Schnelle <[email protected]>
30+
Cc: Paolo Bonzini <[email protected]>
31+
Cc: Ryan Roberts <[email protected]>
32+
Cc: Sean Christopherson <[email protected]>
33+
Cc: Sven Schnelle <[email protected]>
34+
Cc: Thomas Gleixner <[email protected]>
35+
Cc: Vasily Gorbik <[email protected]>
36+
Cc: Will Deacon <[email protected]>
37+
Cc: Zi Yan <[email protected]>
38+
Signed-off-by: Andrew Morton <[email protected]>
39+
(cherry picked from commit b17269a51cc7f046a6f2cf9a6c314a0de885e5a5)
40+
Signed-off-by: Jonathan Maple <[email protected]>
41+
42+
# Conflicts:
43+
# mm/memory.c
44+
diff --cc mm/memory.c
45+
index e2794e3b8919,cfc278691466..000000000000
46+
--- a/mm/memory.c
47+
+++ b/mm/memory.c
48+
@@@ -5749,37 -6341,34 +5749,45 @@@ int generic_access_phys(struct vm_area_
49+
resource_size_t phys_addr;
50+
unsigned long prot = 0;
51+
void __iomem *maddr;
52+
- pte_t *ptep, pte;
53+
- spinlock_t *ptl;
54+
int offset = offset_in_page(addr);
55+
int ret = -EINVAL;
56+
+ bool writable;
57+
+ struct follow_pfnmap_args args = { .vma = vma, .address = addr };
58+
59+
+ if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
60+
+ return -EINVAL;
61+
+
62+
retry:
63+
++<<<<<<< HEAD
64+
+ if (follow_pte(vma->vm_mm, addr, &ptep, &ptl))
65+
++=======
66+
+ if (follow_pfnmap_start(&args))
67+
++>>>>>>> b17269a51cc7 (mm/access_process_vm: use the new follow_pfnmap API)
68+
return -EINVAL;
69+
- pte = ptep_get(ptep);
70+
- pte_unmap_unlock(ptep, ptl);
71+
+ prot = pgprot_val(args.pgprot);
72+
+ phys_addr = (resource_size_t)args.pfn << PAGE_SHIFT;
73+
+ writable = args.writable;
74+
+ follow_pfnmap_end(&args);
75+
76+
- prot = pgprot_val(pte_pgprot(pte));
77+
- phys_addr = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
78+
-
79+
- if ((write & FOLL_WRITE) && !pte_write(pte))
80+
+ if ((write & FOLL_WRITE) && !writable)
81+
return -EINVAL;
82+
83+
maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
84+
if (!maddr)
85+
return -ENOMEM;
86+
87+
++<<<<<<< HEAD
88+
+ if (follow_pte(vma->vm_mm, addr, &ptep, &ptl))
89+
++=======
90+
+ if (follow_pfnmap_start(&args))
91+
++>>>>>>> b17269a51cc7 (mm/access_process_vm: use the new follow_pfnmap API)
92+
goto out_unmap;
93+
94+
- if (!pte_same(pte, ptep_get(ptep))) {
95+
- pte_unmap_unlock(ptep, ptl);
96+
+ if ((prot != pgprot_val(args.pgprot)) ||
97+
+ (phys_addr != (args.pfn << PAGE_SHIFT)) ||
98+
+ (writable != args.writable)) {
99+
+ follow_pfnmap_end(&args);
100+
iounmap(maddr);
101+
-
102+
goto retry;
103+
}
104+
105+
* Unmerged path mm/memory.c

0 commit comments

Comments
 (0)