fault.c (d585a021c0b10b0477d6b608c53e1feb8cde0507) | fault.c (f4dbfa8f3131a84257223393905f7efad0ca5996) |
---|---|
1/* 2 * PowerPC version 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 4 * 5 * Derived from "arch/i386/mm/fault.c" 6 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 7 * 8 * Modified by Cort Dougan and Paul Mackerras. --- 15 unchanged lines hidden (view full) --- 24#include <linux/ptrace.h> 25#include <linux/mman.h> 26#include <linux/mm.h> 27#include <linux/interrupt.h> 28#include <linux/highmem.h> 29#include <linux/module.h> 30#include <linux/kprobes.h> 31#include <linux/kdebug.h> | 1/* 2 * PowerPC version 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 4 * 5 * Derived from "arch/i386/mm/fault.c" 6 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 7 * 8 * Modified by Cort Dougan and Paul Mackerras. --- 15 unchanged lines hidden (view full) --- 24#include <linux/ptrace.h> 25#include <linux/mman.h> 26#include <linux/mm.h> 27#include <linux/interrupt.h> 28#include <linux/highmem.h> 29#include <linux/module.h> 30#include <linux/kprobes.h> 31#include <linux/kdebug.h> |
32#include <linux/perf_counter.h> |
|
32 33#include <asm/firmware.h> 34#include <asm/page.h> 35#include <asm/pgtable.h> 36#include <asm/mmu.h> 37#include <asm/mmu_context.h> 38#include <asm/system.h> 39#include <asm/uaccess.h> --- 125 unchanged lines hidden (view full) --- 165 as is current->mm == NULL. */ 166 printk(KERN_EMERG "Page fault in user mode with " 167 "in_atomic() = %d mm = %p\n", in_atomic(), mm); 168 printk(KERN_EMERG "NIP = %lx MSR = %lx\n", 169 regs->nip, regs->msr); 170 die("Weird page fault", regs, SIGSEGV); 171 } 172 | 33 34#include <asm/firmware.h> 35#include <asm/page.h> 36#include <asm/pgtable.h> 37#include <asm/mmu.h> 38#include <asm/mmu_context.h> 39#include <asm/system.h> 40#include <asm/uaccess.h> --- 125 unchanged lines hidden (view full) --- 166 as is current->mm == NULL. */ 167 printk(KERN_EMERG "Page fault in user mode with " 168 "in_atomic() = %d mm = %p\n", in_atomic(), mm); 169 printk(KERN_EMERG "NIP = %lx MSR = %lx\n", 170 regs->nip, regs->msr); 171 die("Weird page fault", regs, SIGSEGV); 172 } 173 |
174 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 175 |
|
173 /* When running in the kernel we expect faults to occur only to 174 * addresses in user space. All other faults represent errors in the 175 * kernel and should generate an OOPS. Unfortunately, in the case of an 176 * erroneous fault occurring in a code path which already holds mmap_sem 177 * we will deadlock attempting to validate the fault against the 178 * address space. Luckily the kernel only validly references user 179 * space from well defined areas of code, which are listed in the 180 * exceptions table. --- 123 unchanged lines hidden (view full) --- 304 if (ret & VM_FAULT_OOM) 305 goto out_of_memory; 306 else if (ret & VM_FAULT_SIGBUS) 307 goto do_sigbus; 308 BUG(); 309 } 310 if (ret & VM_FAULT_MAJOR) { 311 current->maj_flt++; | 176 /* When running in the kernel we expect faults to occur only to 177 * addresses in user space. All other faults represent errors in the 178 * kernel and should generate an OOPS. Unfortunately, in the case of an 179 * erroneous fault occurring in a code path which already holds mmap_sem 180 * we will deadlock attempting to validate the fault against the 181 * address space. Luckily the kernel only validly references user 182 * space from well defined areas of code, which are listed in the 183 * exceptions table. --- 123 unchanged lines hidden (view full) --- 307 if (ret & VM_FAULT_OOM) 308 goto out_of_memory; 309 else if (ret & VM_FAULT_SIGBUS) 310 goto do_sigbus; 311 BUG(); 312 } 313 if (ret & VM_FAULT_MAJOR) { 314 current->maj_flt++; |
315 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 316 regs, address); |
|
312#ifdef CONFIG_PPC_SMLPAR 313 if (firmware_has_feature(FW_FEATURE_CMO)) { 314 preempt_disable(); 315 get_lppaca()->page_ins += (1 << PAGE_FACTOR); 316 preempt_enable(); 317 } 318#endif | 317#ifdef CONFIG_PPC_SMLPAR 318 if (firmware_has_feature(FW_FEATURE_CMO)) { 319 preempt_disable(); 320 get_lppaca()->page_ins += (1 << PAGE_FACTOR); 321 preempt_enable(); 322 } 323#endif |
319 } else | 324 } else { |
320 current->min_flt++; | 325 current->min_flt++; |
326 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 327 regs, address); 328 } |
|
321 up_read(&mm->mmap_sem); 322 return 0; 323 324bad_area: 325 up_read(&mm->mmap_sem); 326 327bad_area_nosemaphore: 328 /* User mode accesses cause a SIGSEGV */ --- 80 unchanged lines hidden --- | 329 up_read(&mm->mmap_sem); 330 return 0; 331 332bad_area: 333 up_read(&mm->mmap_sem); 334 335bad_area_nosemaphore: 336 /* User mode accesses cause a SIGSEGV */ --- 80 unchanged lines hidden --- |