arch/powerpc/include/asm/ftrace.h
Source file repositories/reference/linux-study-clean/arch/powerpc/include/asm/ftrace.h
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/include/asm/ftrace.h- Extension
.h- Size
- 5646 bytes
- Lines
- 181
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/types.hlinux/ftrace_regs.hasm/paca.h
Detected Declarations
struct modulestruct dyn_ftracestruct dyn_arch_ftracestruct ftrace_opsstruct ftrace_ool_stubfunction ftrace_regs_get_return_valuefunction ftrace_regs_get_frame_pointerfunction ftrace_regs_set_instruction_pointerfunction ftrace_regs_get_return_addressfunction arch_syscall_match_sym_namefunction this_cpu_disable_ftracefunction this_cpu_enable_ftracefunction this_cpu_set_ftrace_enabledfunction this_cpu_get_ftrace_enabledfunction this_cpu_disable_ftracefunction register_ftrace_directfunction ftrace_free_init_tramp
Annotated Snippet
struct dyn_arch_ftrace {
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
/* pointer to the associated out-of-line stub */
unsigned long ool_stub;
#endif
};
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
#define ftrace_need_init_nop() (true)
int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
#define ftrace_init_nop ftrace_init_nop
#include <linux/ftrace_regs.h>
static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *fregs)
{
/* We clear regs.msr in ftrace_call */
return arch_ftrace_regs(fregs)->regs.msr ? &arch_ftrace_regs(fregs)->regs : NULL;
}
#define arch_ftrace_fill_perf_regs(fregs, _regs) do { \
(_regs)->result = 0; \
(_regs)->nip = arch_ftrace_regs(fregs)->regs.nip; \
(_regs)->gpr[1] = arch_ftrace_regs(fregs)->regs.gpr[1]; \
asm volatile("mfmsr %0" : "=r" ((_regs)->msr)); \
} while (0)
#undef ftrace_regs_get_return_value
static __always_inline unsigned long
ftrace_regs_get_return_value(const struct ftrace_regs *fregs)
{
return arch_ftrace_regs(fregs)->regs.gpr[3];
}
#define ftrace_regs_get_return_value ftrace_regs_get_return_value
#undef ftrace_regs_get_frame_pointer
static __always_inline unsigned long
ftrace_regs_get_frame_pointer(const struct ftrace_regs *fregs)
{
return arch_ftrace_regs(fregs)->regs.gpr[1];
}
static __always_inline void
ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs,
unsigned long ip)
{
regs_set_return_ip(&arch_ftrace_regs(fregs)->regs, ip);
}
static __always_inline unsigned long
ftrace_regs_get_return_address(struct ftrace_regs *fregs)
{
return arch_ftrace_regs(fregs)->regs.link;
}
struct ftrace_ops;
#define ftrace_graph_func ftrace_graph_func
void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op, struct ftrace_regs *fregs);
#endif
#endif /* __ASSEMBLER__ */
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
#define ARCH_SUPPORTS_FTRACE_OPS 1
#endif
#endif /* CONFIG_FUNCTION_TRACER */
#ifndef __ASSEMBLER__
#ifdef CONFIG_FTRACE_SYSCALLS
/*
* Some syscall entry functions on powerpc start with "ppc_" (fork and clone,
* for instance) or ppc32_/ppc64_. We should also match the sys_ variant with
* those.
*/
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
{
return !strcmp(sym, name) ||
(!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
(!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
(!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
(!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
}
#endif /* CONFIG_FTRACE_SYSCALLS */
#if defined(CONFIG_PPC64) && defined(CONFIG_FUNCTION_TRACER)
#include <asm/paca.h>
static inline void this_cpu_disable_ftrace(void)
Annotation
- Immediate include surface: `asm/types.h`, `linux/ftrace_regs.h`, `asm/paca.h`.
- Detected declarations: `struct module`, `struct dyn_ftrace`, `struct dyn_arch_ftrace`, `struct ftrace_ops`, `struct ftrace_ool_stub`, `function ftrace_regs_get_return_value`, `function ftrace_regs_get_frame_pointer`, `function ftrace_regs_set_instruction_pointer`, `function ftrace_regs_get_return_address`, `function arch_syscall_match_sym_name`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.