csky: Fixup FAULT_FLAG_XXX param for handle_mm_fault
The past code only passes the FAULT_FLAG_WRITE into handle_mm_fault and missing USER & DEFAULT & RETRY. The patch references to arch/riscv/mm/fault.c, but there is no FAULT_FLAG_INSTRUCTION in csky hw. Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
This commit is contained in:
parent
1152cb5a9a
commit
78bfa70b16
@ -80,6 +80,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
|
|||||||
struct vm_area_struct *vma = NULL;
|
struct vm_area_struct *vma = NULL;
|
||||||
struct task_struct *tsk = current;
|
struct task_struct *tsk = current;
|
||||||
struct mm_struct *mm = tsk->mm;
|
struct mm_struct *mm = tsk->mm;
|
||||||
|
unsigned int flags = FAULT_FLAG_DEFAULT;
|
||||||
int si_code;
|
int si_code;
|
||||||
int fault;
|
int fault;
|
||||||
unsigned long address = read_mmu_entryhi() & PAGE_MASK;
|
unsigned long address = read_mmu_entryhi() & PAGE_MASK;
|
||||||
@ -150,6 +151,13 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
|
|||||||
if (in_atomic() || !mm)
|
if (in_atomic() || !mm)
|
||||||
goto bad_area_nosemaphore;
|
goto bad_area_nosemaphore;
|
||||||
|
|
||||||
|
if (user_mode(regs))
|
||||||
|
flags |= FAULT_FLAG_USER;
|
||||||
|
|
||||||
|
if (is_write(regs))
|
||||||
|
flags |= FAULT_FLAG_WRITE;
|
||||||
|
|
||||||
|
retry:
|
||||||
mmap_read_lock(mm);
|
mmap_read_lock(mm);
|
||||||
vma = find_vma(mm, address);
|
vma = find_vma(mm, address);
|
||||||
if (!vma)
|
if (!vma)
|
||||||
@ -180,8 +188,7 @@ good_area:
|
|||||||
* make sure we exit gracefully rather than endlessly redo
|
* make sure we exit gracefully rather than endlessly redo
|
||||||
* the fault.
|
* the fault.
|
||||||
*/
|
*/
|
||||||
fault = handle_mm_fault(vma, address, is_write(regs) ? FAULT_FLAG_WRITE : 0,
|
fault = handle_mm_fault(vma, address, flags, regs);
|
||||||
regs);
|
|
||||||
if (unlikely(fault & VM_FAULT_ERROR)) {
|
if (unlikely(fault & VM_FAULT_ERROR)) {
|
||||||
if (fault & VM_FAULT_OOM)
|
if (fault & VM_FAULT_OOM)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
@ -191,6 +198,18 @@ good_area:
|
|||||||
goto bad_area;
|
goto bad_area;
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
|
||||||
|
flags |= FAULT_FLAG_TRIED;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* No need to mmap_read_unlock(mm) as we would
|
||||||
|
* have already released it in __lock_page_or_retry
|
||||||
|
* in mm/filemap.c.
|
||||||
|
*/
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
mmap_read_unlock(mm);
|
mmap_read_unlock(mm);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user