Message ID | 20190918145328.28602-1-aneesh.kumar@linux.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d9101bfa6adc831bda8836c4d774820553c14942 |
Headers | show |
Series | [RFC] powerpc/mm/mce: Keep irq disabled during lockless page table walk | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (d673df64cdd04723ff72c7d31e639c50bc3c1058) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 0 warnings, 1 checks, 35 lines checked |
On Wed, 2019-09-18 at 14:53:28 UTC, "Aneesh Kumar K.V" wrote: > __find_linux_mm_pte return a page table entry pointer walking the > page table without holding locks. To make it safe against a THP > split and collapse, we disable interrupts around the lockless > page table walk. We need to keep the interrupts disabled as long > as we use the page table entry pointer. > > Cc: Balbir Singh <bsingharora@gmail.com> > Cc: Reza Arbab <arbab@linux.ibm.com> > Cc: Santosh Sivaraj <santosh@fossix.org> > Fixes: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/d9101bfa6adc831bda8836c4d774820553c14942 cheers
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index 356e7b99f661..585c37dc1b18 100644 --- a/arch/powerpc/kernel/mce_power.c +++ b/arch/powerpc/kernel/mce_power.c @@ -28,6 +28,7 @@ unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) { pte_t *ptep; + unsigned long pfn; unsigned int shift; unsigned long flags; struct mm_struct *mm; @@ -39,18 +40,21 @@ unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) local_irq_save(flags); ptep = __find_linux_pte(mm->pgd, addr, NULL, &shift); - local_irq_restore(flags); - if (!ptep || pte_special(*ptep)) - return ULONG_MAX; + if (!ptep || pte_special(*ptep)) { + pfn = ULONG_MAX; + goto err_out; + } if (shift > PAGE_SHIFT) { unsigned long rpnmask = (1ul << shift) - PAGE_SIZE; - return pte_pfn(__pte(pte_val(*ptep) | (addr & rpnmask))); - } - - return pte_pfn(*ptep); + pfn = pte_pfn(__pte(pte_val(*ptep) | (addr & rpnmask))); + } else + pfn = pte_pfn(*ptep); +err_out: + local_irq_restore(flags); + return pfn; } /* flush SLBs and reload */
__find_linux_mm_pte return a page table entry pointer walking the page table without holding locks. To make it safe against a THP split and collapse, we disable interrupts around the lockless page table walk. We need to keep the interrupts disabled as long as we use the page table entry pointer. Cc: Balbir Singh <bsingharora@gmail.com> Cc: Reza Arbab <arbab@linux.ibm.com> Cc: Santosh Sivaraj <santosh@fossix.org> Fixes: ba41e1e1ccb9 ("powerpc/mce: Hookup derror (load/store) UE errors") Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> --- arch/powerpc/kernel/mce_power.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)