arch/s390/mm/fault.c
Source file repositories/reference/linux-study-clean/arch/s390/mm/fault.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/mm/fault.c- Extension
.c- Size
- 12895 bytes
- Lines
- 481
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel_stat.hlinux/mmu_context.hlinux/cpufeature.hlinux/perf_event.hlinux/signal.hlinux/sched.hlinux/sched/debug.hlinux/kernel.hlinux/errno.hlinux/string.hlinux/types.hlinux/ptrace.hlinux/mman.hlinux/mm.hlinux/smp.hlinux/kdebug.hlinux/init.hlinux/console.hlinux/extable.hlinux/hardirq.hlinux/kprobes.hlinux/uaccess.hlinux/hugetlb.hlinux/kfence.hlinux/pagewalk.hasm/asm-extable.hasm/asm-offsets.hasm/ptrace.hasm/fault.hasm/diag.hasm/irq.hasm/facility.h
Detected Declarations
function Authorfunction get_fault_addressfunction fault_is_writefunction dump_pagetablefunction dump_fault_infofunction init_s390_fault_sysctlsfunction report_user_faultfunction do_sigsegvfunction handle_fault_error_nolockfunction handle_fault_errorfunction do_sigbusfunction codefunction do_protection_exceptionfunction do_dat_exceptionfunction do_secure_storage_access
Annotated Snippet
fault = handle_mm_fault(vma, address, flags | FAULT_FLAG_VMA_LOCK, regs);
if (!(fault & (VM_FAULT_RETRY | VM_FAULT_COMPLETED)))
vma_end_read(vma);
if (!(fault & VM_FAULT_RETRY)) {
count_vm_vma_lock_event(VMA_LOCK_SUCCESS);
goto done;
}
count_vm_vma_lock_event(VMA_LOCK_RETRY);
if (fault & VM_FAULT_MAJOR)
flags |= FAULT_FLAG_TRIED;
/* Quick path to respond to signals */
if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
handle_fault_error_nolock(regs, 0);
return;
}
lock_mmap:
retry:
vma = lock_mm_and_find_vma(mm, address, regs);
if (!vma)
return handle_fault_error_nolock(regs, SEGV_MAPERR);
if (unlikely(!(vma->vm_flags & access)))
return handle_fault_error(regs, SEGV_ACCERR);
fault = handle_mm_fault(vma, address, flags, regs);
if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
handle_fault_error_nolock(regs, 0);
return;
}
/* The fault is fully completed (including releasing mmap lock) */
if (fault & VM_FAULT_COMPLETED)
return;
if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED;
goto retry;
}
mmap_read_unlock(mm);
done:
if (!(fault & VM_FAULT_ERROR))
return;
if (fault & VM_FAULT_OOM) {
if (!user_mode(regs))
handle_fault_error_nolock(regs, 0);
else
pagefault_out_of_memory();
} else if (fault & VM_FAULT_SIGSEGV) {
if (!user_mode(regs))
handle_fault_error_nolock(regs, 0);
else
do_sigsegv(regs, SEGV_MAPERR);
} else if (fault & (VM_FAULT_SIGBUS | VM_FAULT_HWPOISON |
VM_FAULT_HWPOISON_LARGE)) {
if (!user_mode(regs))
handle_fault_error_nolock(regs, 0);
else
do_sigbus(regs);
} else {
pr_emerg("Unexpected fault flags: %08x\n", fault);
BUG();
}
}
void do_protection_exception(struct pt_regs *regs)
{
union teid teid = { .val = regs->int_parm_long };
/*
* Protection exceptions are suppressing, decrement psw address.
* The exception to this rule are aborted transactions, for these
* the PSW already points to the correct location.
*/
if (!(regs->int_code & 0x200)) {
regs->psw.addr = __rewind_psw(regs->psw, regs->int_code >> 16);
set_pt_regs_flag(regs, PIF_PSW_ADDR_ADJUSTED);
}
/*
* If bit 61 if the TEID is not set, the remainder of the
* TEID is unpredictable. Special handling is required.
*/
if (unlikely(!teid.b61)) {
if (user_mode(regs)) {
dump_fault_info(regs);
die(regs, "Unexpected TEID");
}
/* Assume low-address protection in kernel mode. */
return handle_fault_error_nolock(regs, 0);
}
if (unlikely(cpu_has_nx() && teid.b56)) {
regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK);
return handle_fault_error_nolock(regs, SEGV_ACCERR);
Annotation
- Immediate include surface: `linux/kernel_stat.h`, `linux/mmu_context.h`, `linux/cpufeature.h`, `linux/perf_event.h`, `linux/signal.h`, `linux/sched.h`, `linux/sched/debug.h`, `linux/kernel.h`.
- Detected declarations: `function Author`, `function get_fault_address`, `function fault_is_write`, `function dump_pagetable`, `function dump_fault_info`, `function init_s390_fault_sysctls`, `function report_user_fault`, `function do_sigsegv`, `function handle_fault_error_nolock`, `function handle_fault_error`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.