arch/powerpc/kernel/stacktrace.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/stacktrace.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/stacktrace.c- Extension
.c- Size
- 5244 bytes
- Lines
- 214
- 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
linux/delay.hlinux/export.hlinux/kallsyms.hlinux/module.hlinux/nmi.hlinux/sched.hlinux/sched/debug.hlinux/sched/task_stack.hlinux/stacktrace.hasm/ptrace.hasm/processor.hlinux/ftrace.hasm/kprobes.hlinux/rethook.hasm/paca.h
Detected Declarations
function arch_stack_walkfunction arch_stack_walk_reliablefunction handle_backtrace_ipifunction raise_backtrace_ipifunction for_each_cpufunction arch_trigger_cpumask_backtrace
Annotated Snippet
if (cpu == smp_processor_id()) {
handle_backtrace_ipi(NULL);
continue;
}
delay_us = 5 * USEC_PER_SEC;
if (smp_send_safe_nmi_ipi(cpu, handle_backtrace_ipi, delay_us)) {
// Now wait up to 5s for the other CPU to do its backtrace
while (cpumask_test_cpu(cpu, mask) && delay_us) {
udelay(1);
delay_us--;
}
// Other CPU cleared itself from the mask
if (delay_us)
continue;
}
p = paca_ptrs[cpu];
cpumask_clear_cpu(cpu, mask);
pr_warn("CPU %d didn't respond to backtrace IPI, inspecting paca.\n", cpu);
if (!virt_addr_valid(p)) {
pr_warn("paca pointer appears corrupt? (%px)\n", p);
continue;
}
pr_warn("irq_soft_mask: 0x%02x in_mce: %d in_nmi: %d",
p->irq_soft_mask, p->in_mce, p->in_nmi);
if (virt_addr_valid(p->__current))
pr_cont(" current: %d (%s)\n", p->__current->pid,
p->__current->comm);
else
pr_cont(" current pointer corrupt? (%px)\n", p->__current);
pr_warn("Back trace of paca->saved_r1 (0x%016llx) (possibly stale):\n", p->saved_r1);
show_stack(p->__current, (unsigned long *)p->saved_r1, KERN_WARNING);
}
}
void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu)
{
nmi_trigger_cpumask_backtrace(mask, exclude_cpu, raise_backtrace_ipi);
}
#endif /* defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_NMI_IPI) */
Annotation
- Immediate include surface: `linux/delay.h`, `linux/export.h`, `linux/kallsyms.h`, `linux/module.h`, `linux/nmi.h`, `linux/sched.h`, `linux/sched/debug.h`, `linux/sched/task_stack.h`.
- Detected declarations: `function arch_stack_walk`, `function arch_stack_walk_reliable`, `function handle_backtrace_ipi`, `function raise_backtrace_ipi`, `function for_each_cpu`, `function arch_trigger_cpumask_backtrace`.
- 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.