arm64 fix: restore TLB invalidation for the 'break-before-make' rule on
contiguous ptes (missed in a recent clean-up). -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmK/L6kACgkQa9axLQDI XvGmfw//VXSwUarnSbiu54MiJ7jMFW5pf08La1u8dol7O8pN9c1sWn7QDMj6JyN5 KJx4DInPsDkEKX9ZK8HEVXCixg0c2Kfml5y1tCWNtIX3etX5AHc2eRUTp1dy6e96 f+e5lKGayI9gGJmKQFvKfofjienDHtp9UDNqYDmUljhJQ0kAGbI8pUawFC243UAo DWEuTytm08DBn5vSAxumNQyrvSoYdyzkKpaESO2s9x4/BY6iWFqDmYdA7BdySKmC ZLShCpHatz4/BdwqLjMpefjWYz0BJZGffIv+9fU0cvvwoVsB5BWdO6JR7b4Xktfi coYbRGtsBvQClmtH7jCKQBwomyYxNIJW6i0zlVS5nKRrbIwsa9K0yaG2rIX6zxZ1 z2xqpBZcJpRBuHwVMs2Zfyvy5LPpVQptN0YxBv6orAVGamyBfKF9MLqFnr1giHXi q/Ryx6GsCM15TQrJLxV0lq72lBF6PhXerQ9flXa1TCktKf2Zpdnh0xBoWQEw/Jiz mzROq1zBDPJEz/MmN1BPR1cQTFDGa4VHVl+F3s0Q5ZATVPAuQDbltU5OQTQCiBdg J54qgjvN+rDczJTulHJlquwmBI9OIz6pVfeutHlW1YNF3iZFg1bGgUSCcOrD54Xm 2bxNKn1Q+Intky0d84k5Af7CDiUrCMRbfLCDhM09XgDYE2yCxts= =aTjQ -----END PGP SIGNATURE----- Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fix from Catalin Marinas: "Restore TLB invalidation for the 'break-before-make' rule on contiguous ptes (missed in a recent clean-up)" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: hugetlb: Restore TLB invalidation for BBM on contiguous ptes
This commit is contained in:
commit
d0f67adb79
|
@ -214,6 +214,19 @@ static pte_t get_clear_contig(struct mm_struct *mm,
|
|||
return orig_pte;
|
||||
}
|
||||
|
||||
static pte_t get_clear_contig_flush(struct mm_struct *mm,
|
||||
unsigned long addr,
|
||||
pte_t *ptep,
|
||||
unsigned long pgsize,
|
||||
unsigned long ncontig)
|
||||
{
|
||||
pte_t orig_pte = get_clear_contig(mm, addr, ptep, pgsize, ncontig);
|
||||
struct vm_area_struct vma = TLB_FLUSH_VMA(mm, 0);
|
||||
|
||||
flush_tlb_range(&vma, addr, addr + (pgsize * ncontig));
|
||||
return orig_pte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Changing some bits of contiguous entries requires us to follow a
|
||||
* Break-Before-Make approach, breaking the whole contiguous set
|
||||
|
@ -447,19 +460,20 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
|
|||
int ncontig, i;
|
||||
size_t pgsize = 0;
|
||||
unsigned long pfn = pte_pfn(pte), dpfn;
|
||||
struct mm_struct *mm = vma->vm_mm;
|
||||
pgprot_t hugeprot;
|
||||
pte_t orig_pte;
|
||||
|
||||
if (!pte_cont(pte))
|
||||
return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
|
||||
|
||||
ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize);
|
||||
ncontig = find_num_contig(mm, addr, ptep, &pgsize);
|
||||
dpfn = pgsize >> PAGE_SHIFT;
|
||||
|
||||
if (!__cont_access_flags_changed(ptep, pte, ncontig))
|
||||
return 0;
|
||||
|
||||
orig_pte = get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig);
|
||||
orig_pte = get_clear_contig_flush(mm, addr, ptep, pgsize, ncontig);
|
||||
|
||||
/* Make sure we don't lose the dirty or young state */
|
||||
if (pte_dirty(orig_pte))
|
||||
|
@ -470,7 +484,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma,
|
|||
|
||||
hugeprot = pte_pgprot(pte);
|
||||
for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn)
|
||||
set_pte_at(vma->vm_mm, addr, ptep, pfn_pte(pfn, hugeprot));
|
||||
set_pte_at(mm, addr, ptep, pfn_pte(pfn, hugeprot));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -492,7 +506,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,
|
|||
ncontig = find_num_contig(mm, addr, ptep, &pgsize);
|
||||
dpfn = pgsize >> PAGE_SHIFT;
|
||||
|
||||
pte = get_clear_contig(mm, addr, ptep, pgsize, ncontig);
|
||||
pte = get_clear_contig_flush(mm, addr, ptep, pgsize, ncontig);
|
||||
pte = pte_wrprotect(pte);
|
||||
|
||||
hugeprot = pte_pgprot(pte);
|
||||
|
@ -505,17 +519,15 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm,
|
|||
pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
|
||||
unsigned long addr, pte_t *ptep)
|
||||
{
|
||||
struct mm_struct *mm = vma->vm_mm;
|
||||
size_t pgsize;
|
||||
int ncontig;
|
||||
pte_t orig_pte;
|
||||
|
||||
if (!pte_cont(READ_ONCE(*ptep)))
|
||||
return ptep_clear_flush(vma, addr, ptep);
|
||||
|
||||
ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize);
|
||||
orig_pte = get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig);
|
||||
flush_tlb_range(vma, addr, addr + pgsize * ncontig);
|
||||
return orig_pte;
|
||||
ncontig = find_num_contig(mm, addr, ptep, &pgsize);
|
||||
return get_clear_contig_flush(mm, addr, ptep, pgsize, ncontig);
|
||||
}
|
||||
|
||||
static int __init hugetlbpage_init(void)
|
||||
|
|
Loading…
Reference in New Issue