Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

Guo Ren 78bfa70b 1152cb5a

+21 -2
+21 -2
arch/csky/mm/fault.c
··· 80 80 struct vm_area_struct *vma = NULL; 81 81 struct task_struct *tsk = current; 82 82 struct mm_struct *mm = tsk->mm; 83 + unsigned int flags = FAULT_FLAG_DEFAULT; 83 84 int si_code; 84 85 int fault; 85 86 unsigned long address = read_mmu_entryhi() & PAGE_MASK; ··· 151 150 if (in_atomic() || !mm) 152 151 goto bad_area_nosemaphore; 153 152 153 + if (user_mode(regs)) 154 + flags |= FAULT_FLAG_USER; 155 + 156 + if (is_write(regs)) 157 + flags |= FAULT_FLAG_WRITE; 158 + 159 + retry: 154 160 mmap_read_lock(mm); 155 161 vma = find_vma(mm, address); 156 162 if (!vma) ··· 188 180 * make sure we exit gracefully rather than endlessly redo 189 181 * the fault. 190 182 */ 191 - fault = handle_mm_fault(vma, address, is_write(regs) ? FAULT_FLAG_WRITE : 0, 192 - regs); 183 + fault = handle_mm_fault(vma, address, flags, regs); 193 184 if (unlikely(fault & VM_FAULT_ERROR)) { 194 185 if (fault & VM_FAULT_OOM) 195 186 goto out_of_memory; ··· 198 191 goto bad_area; 199 192 BUG(); 200 193 } 194 + 195 + if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) { 196 + flags |= FAULT_FLAG_TRIED; 197 + 198 + /* 199 + * No need to mmap_read_unlock(mm) as we would 200 + * have already released it in __lock_page_or_retry 201 + * in mm/filemap.c. 202 + */ 203 + goto retry; 204 + } 205 + 201 206 mmap_read_unlock(mm); 202 207 return; 203 208