aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/fault.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/mips/mm/fault.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/mips/mm/fault.c')
-rw-r--r--arch/mips/mm/fault.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index ddcec1e1a0c..937cf336816 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -22,6 +22,7 @@
22 22
23#include <asm/branch.h> 23#include <asm/branch.h>
24#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
25#include <asm/system.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/ptrace.h> 27#include <asm/ptrace.h>
27#include <asm/highmem.h> /* For VMALLOC_END */ 28#include <asm/highmem.h> /* For VMALLOC_END */
@@ -41,8 +42,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long writ
41 const int field = sizeof(unsigned long) * 2; 42 const int field = sizeof(unsigned long) * 2;
42 siginfo_t info; 43 siginfo_t info;
43 int fault; 44 int fault;
44 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
45 (write ? FAULT_FLAG_WRITE : 0);
46 45
47#if 0 46#if 0
48 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(), 47 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(),
@@ -92,7 +91,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long writ
92 if (in_atomic() || !mm) 91 if (in_atomic() || !mm)
93 goto bad_area_nosemaphore; 92 goto bad_area_nosemaphore;
94 93
95retry:
96 down_read(&mm->mmap_sem); 94 down_read(&mm->mmap_sem);
97 vma = find_vma(mm, address); 95 vma = find_vma(mm, address);
98 if (!vma) 96 if (!vma)
@@ -114,7 +112,7 @@ good_area:
114 if (!(vma->vm_flags & VM_WRITE)) 112 if (!(vma->vm_flags & VM_WRITE))
115 goto bad_area; 113 goto bad_area;
116 } else { 114 } else {
117 if (cpu_has_rixi) { 115 if (kernel_uses_smartmips_rixi) {
118 if (address == regs->cp0_epc && !(vma->vm_flags & VM_EXEC)) { 116 if (address == regs->cp0_epc && !(vma->vm_flags & VM_EXEC)) {
119#if 0 117#if 0
120 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] XI violation\n", 118 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] XI violation\n",
@@ -146,11 +144,7 @@ good_area:
146 * make sure we exit gracefully rather than endlessly redo 144 * make sure we exit gracefully rather than endlessly redo
147 * the fault. 145 * the fault.
148 */ 146 */
149 fault = handle_mm_fault(mm, vma, address, flags); 147 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
150
151 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
152 return;
153
154 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); 148 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
155 if (unlikely(fault & VM_FAULT_ERROR)) { 149 if (unlikely(fault & VM_FAULT_ERROR)) {
156 if (fault & VM_FAULT_OOM) 150 if (fault & VM_FAULT_OOM)
@@ -159,28 +153,12 @@ good_area:
159 goto do_sigbus; 153 goto do_sigbus;
160 BUG(); 154 BUG();
161 } 155 }
162 if (flags & FAULT_FLAG_ALLOW_RETRY) { 156 if (fault & VM_FAULT_MAJOR) {
163 if (fault & VM_FAULT_MAJOR) { 157 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address);
164 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 158 tsk->maj_flt++;
165 regs, address); 159 } else {
166 tsk->maj_flt++; 160 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address);
167 } else { 161 tsk->min_flt++;
168 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
169 regs, address);
170 tsk->min_flt++;
171 }
172 if (fault & VM_FAULT_RETRY) {
173 flags &= ~FAULT_FLAG_ALLOW_RETRY;
174 flags |= FAULT_FLAG_TRIED;
175
176 /*
177 * No need to up_read(&mm->mmap_sem) as we would
178 * have already released it in __lock_page_or_retry
179 * in mm/filemap.c.
180 */
181
182 goto retry;
183 }
184 } 162 }
185 163
186 up_read(&mm->mmap_sem); 164 up_read(&mm->mmap_sem);