arch/powerpc/kexec/crash.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kexec/crash.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kexec/crash.c- Extension
.c- Size
- 16386 bytes
- Lines
- 657
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/smp.hlinux/reboot.hlinux/kexec.hlinux/export.hlinux/crash_dump.hlinux/delay.hlinux/irq.hlinux/types.hlinux/libfdt.hlinux/memory.hasm/processor.hasm/machdep.hasm/kexec.hasm/smp.hasm/setjmp.hasm/debug.hasm/interrupt.hasm/kexec_ranges.hasm/crashdump-ppc64.h
Detected Declarations
function handle_faultfunction crash_ipi_callbackfunction crash_kexec_prepare_cpusfunction crash_kexec_secondaryfunction crash_kexec_prepare_cpusfunction crash_kexec_secondaryfunction crash_kexec_wait_realmodefunction crash_shutdown_registerfunction crash_shutdown_unregisterfunction default_machine_crash_shutdownfunction sync_backup_region_phdrfunction machine_kexec_post_loadfunction arch_crash_get_elfcorehdr_sizefunction update_crash_elfcorehdrfunction segmentfunction get_fdt_indexfunction update_crash_fdtfunction arch_crash_hotplug_supportfunction arch_crash_handle_hotplug_eventexport crash_shutdown_registerexport crash_shutdown_unregister
Annotated Snippet
if (--msecs < 0) {
/* No response, kdump image may not have been loaded */
local_irq_restore(flags);
return;
}
mdelay(1);
}
crash_ipi_callback(regs);
}
#else /* ! CONFIG_SMP */
static void crash_kexec_prepare_cpus(void)
{
/*
* move the secondaries to us so that we can copy
* the new kernel 0-0x100 safely
*
* do this if kexec in setup.c ?
*/
#ifdef CONFIG_PPC64
smp_release_cpus();
#else
/* FIXME */
#endif
}
void crash_kexec_secondary(struct pt_regs *regs)
{
}
#endif /* CONFIG_SMP */
/* wait for all the CPUs to hit real mode but timeout if they don't come in */
#if defined(CONFIG_SMP) && defined(CONFIG_PPC64)
noinstr static void __maybe_unused crash_kexec_wait_realmode(int cpu)
{
unsigned int msecs;
int i;
msecs = REAL_MODE_TIMEOUT;
for (i=0; i < nr_cpu_ids && msecs > 0; i++) {
if (i == cpu)
continue;
while (paca_ptrs[i]->kexec_state < KEXEC_STATE_REAL_MODE) {
barrier();
if (!cpu_possible(i) || !cpu_online(i) || (msecs <= 0))
break;
msecs--;
mdelay(1);
}
}
mb();
}
#else
static inline void crash_kexec_wait_realmode(int cpu) {}
#endif /* CONFIG_SMP && CONFIG_PPC64 */
void crash_kexec_prepare(void)
{
/* Avoid hardlocking with irresponsive CPU holding logbuf_lock */
printk_deferred_enter();
/*
* This function is only called after the system
* has panicked or is otherwise in a critical state.
* The minimum amount of code to allow a kexec'd kernel
* to run successfully needs to happen here.
*
* In practice this means stopping other cpus in
* an SMP system.
* The kernel is broken so disable interrupts.
*/
hard_irq_disable();
/*
* Make a note of crashing cpu. Will be used in machine_kexec
* such that another IPI will not be sent.
*/
crashing_cpu = smp_processor_id();
crash_kexec_prepare_cpus();
}
/*
* Register a function to be called on shutdown. Only use this if you
* can't reset your device in the second kernel.
*/
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/smp.h`, `linux/reboot.h`, `linux/kexec.h`, `linux/export.h`, `linux/crash_dump.h`, `linux/delay.h`, `linux/irq.h`.
- Detected declarations: `function handle_fault`, `function crash_ipi_callback`, `function crash_kexec_prepare_cpus`, `function crash_kexec_secondary`, `function crash_kexec_prepare_cpus`, `function crash_kexec_secondary`, `function crash_kexec_wait_realmode`, `function crash_shutdown_register`, `function crash_shutdown_unregister`, `function default_machine_crash_shutdown`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.