arch/loongarch/kernel/ftrace_dyn.c
Source file repositories/reference/linux-study-clean/arch/loongarch/kernel/ftrace_dyn.c
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/kernel/ftrace_dyn.c- Extension
.c- Size
- 8936 bytes
- Lines
- 352
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ftrace.hlinux/kprobes.hlinux/uaccess.hasm/inst.hasm/module.h
Detected Declarations
function Copyrightfunction reachable_by_blfunction ftrace_find_callable_addrfunction ftrace_find_callable_addrfunction ftrace_modify_callfunction ftrace_update_ftrace_funcfunction ftrace_init_nopfunction ftrace_make_callfunction ftrace_make_nopfunction arch_ftrace_update_codefunction ftrace_dyn_arch_initfunction prepare_ftrace_returnfunction ftrace_graph_funcfunction ftrace_modify_graph_callerfunction ftrace_enable_ftrace_graph_callerfunction ftrace_disable_ftrace_graph_callerfunction kprobe_ftrace_handlerfunction arch_prepare_kprobe_ftrace
Annotated Snippet
if (!p->pre_handler || !p->pre_handler(p, regs)) {
/*
* Emulate singlestep (and also recover regs->csr_era)
* as if there is a nop
*/
instruction_pointer_set(regs, (unsigned long)p->addr + MCOUNT_INSN_SIZE);
if (unlikely(p->post_handler)) {
kcb->kprobe_status = KPROBE_HIT_SSDONE;
p->post_handler(p, regs, 0);
}
instruction_pointer_set(regs, orig_ip);
}
/*
* If pre_handler returns !0, it changes regs->csr_era. We have to
* skip emulating post_handler.
*/
__this_cpu_write(current_kprobe, NULL);
}
out:
ftrace_test_recursion_unlock(bit);
}
NOKPROBE_SYMBOL(kprobe_ftrace_handler);
int arch_prepare_kprobe_ftrace(struct kprobe *p)
{
p->ainsn.insn = NULL;
return 0;
}
#endif /* CONFIG_KPROBES_ON_FTRACE */
Annotation
- Immediate include surface: `linux/ftrace.h`, `linux/kprobes.h`, `linux/uaccess.h`, `asm/inst.h`, `asm/module.h`.
- Detected declarations: `function Copyright`, `function reachable_by_bl`, `function ftrace_find_callable_addr`, `function ftrace_find_callable_addr`, `function ftrace_modify_call`, `function ftrace_update_ftrace_func`, `function ftrace_init_nop`, `function ftrace_make_call`, `function ftrace_make_nop`, `function arch_ftrace_update_code`.
- Atlas domain: Architecture Layer / arch/loongarch.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.