arch/x86/kernel/crash.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/crash.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/crash.c- Extension
.c- Size
- 14699 bytes
- Lines
- 575
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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/types.hlinux/kernel.hlinux/smp.hlinux/reboot.hlinux/kexec.hlinux/delay.hlinux/elf.hlinux/elfcore.hlinux/export.hlinux/slab.hlinux/vmalloc.hlinux/memblock.hasm/bootparam.hasm/processor.hasm/hardirq.hasm/nmi.hasm/hw_irq.hasm/apic.hasm/e820/types.hasm/io_apic.hasm/hpet.hlinux/kdebug.hasm/cpu.hasm/reboot.hasm/tdx.hasm/intel_pt.hasm/crash.hasm/cmdline.hasm/sev.hasm/virt.h
Detected Declarations
struct crash_memmap_datafunction kdump_nmi_callbackfunction kdump_nmi_shootdown_cpusfunction crash_smp_send_stopfunction crash_smp_send_stopfunction get_nr_ram_ranges_callbackfunction elf_header_exclude_rangesfunction prepare_elf64_ram_headers_callbackfunction prepare_elf_headersfunction add_e820_entryfunction memmap_entry_callbackfunction memmap_exclude_rangesfunction crash_setup_memmap_entriesfunction crash_load_segmentsfunction arch_crash_hotplug_supportfunction arch_crash_get_elfcorehdr_sizefunction arch_crash_handle_hotplug_event
Annotated Snippet
struct crash_memmap_data {
struct boot_params *params;
/* Type of memory */
unsigned int type;
};
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
{
crash_save_cpu(regs, cpu);
/*
* Disable Intel PT to stop its logging
*/
cpu_emergency_stop_pt();
kdump_sev_callback();
disable_local_APIC();
}
void kdump_nmi_shootdown_cpus(void)
{
nmi_shootdown_cpus(kdump_nmi_callback);
disable_local_APIC();
}
/* Override the weak function in kernel/panic.c */
void crash_smp_send_stop(void)
{
static int cpus_stopped;
if (cpus_stopped)
return;
if (smp_ops.crash_stop_other_cpus)
smp_ops.crash_stop_other_cpus();
else
smp_send_stop();
cpus_stopped = 1;
}
#else
void crash_smp_send_stop(void)
{
/* There are no cpus to shootdown */
}
#endif
void native_machine_crash_shutdown(struct pt_regs *regs)
{
/* 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 shooting down the other cpus in
* an SMP system.
*/
/* The kernel is broken so disable interrupts */
local_irq_disable();
crash_smp_send_stop();
tdx_sys_disable();
x86_virt_emergency_disable_virtualization_cpu();
/*
* Disable Intel PT to stop its logging
*/
cpu_emergency_stop_pt();
#ifdef CONFIG_X86_IO_APIC
/* Prevent crash_kexec() from deadlocking on ioapic_lock. */
ioapic_zap_locks();
clear_IO_APIC();
#endif
lapic_shutdown();
restore_boot_irq_mode();
#ifdef CONFIG_HPET_TIMER
hpet_disable();
#endif
/*
* Non-crash kexec calls enc_kexec_begin() while scheduling is still
* active. This allows the callback to wait until all in-flight
* shared<->private conversions are complete. In a crash scenario,
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/smp.h`, `linux/reboot.h`, `linux/kexec.h`, `linux/delay.h`, `linux/elf.h`, `linux/elfcore.h`.
- Detected declarations: `struct crash_memmap_data`, `function kdump_nmi_callback`, `function kdump_nmi_shootdown_cpus`, `function crash_smp_send_stop`, `function crash_smp_send_stop`, `function get_nr_ram_ranges_callback`, `function elf_header_exclude_ranges`, `function prepare_elf64_ram_headers_callback`, `function prepare_elf_headers`, `function add_e820_entry`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.