[PATCH v6 05/11] powerpc/perf: Use functions to track lockless pgtbl walks

From: Leonardo Bras
Date: Wed Feb 05 2020 - 22:11:46 EST


Applies the new functions used for tracking lockless pgtable walks on
read_user_stack_slow.

local_irq_{save,restore} is already inside {begin,end}_lockless_pgtbl_walk,
so there is no need to repeat it here.

Variable that saves the irq mask was renamed from flags to irq_mask so it
doesn't lose meaning now it's not directly passed to local_irq_* functions.

Signed-off-by: Leonardo Bras <leonardo@xxxxxxxxxxxxx>
---
arch/powerpc/perf/callchain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index cbc251981209..fd9979e69f36 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -116,14 +116,14 @@ static int read_user_stack_slow(void __user *ptr, void *buf, int nb)
unsigned shift;
unsigned long addr = (unsigned long) ptr;
unsigned long offset;
- unsigned long pfn, flags;
+ unsigned long pfn, irq_mask;
void *kaddr;

pgdir = current->mm->pgd;
if (!pgdir)
return -EFAULT;

- local_irq_save(flags);
+ irq_mask = begin_lockless_pgtbl_walk();
ptep = find_current_mm_pte(pgdir, addr, NULL, &shift);
if (!ptep)
goto err_out;
@@ -145,7 +145,7 @@ static int read_user_stack_slow(void __user *ptr, void *buf, int nb)
memcpy(buf, kaddr + offset, nb);
ret = 0;
err_out:
- local_irq_restore(flags);
+ end_lockless_pgtbl_walk(irq_mask);
return ret;
}

--
2.24.1