arch/x86/kernel/apic/hw_nmi.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/apic/hw_nmi.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/apic/hw_nmi.c- Extension
.c- Size
- 1371 bytes
- Lines
- 62
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/thread_info.hasm/apic.hasm/nmi.hlinux/cpumask.hlinux/kdebug.hlinux/notifier.hlinux/kprobes.hlinux/nmi.hlinux/init.hlinux/delay.hlocal.h
Detected Declarations
function hw_nmi_get_sample_periodfunction nmi_raise_cpu_backtracefunction arch_trigger_cpumask_backtracefunction nmi_cpu_backtrace_handlerfunction register_nmi_cpu_backtrace_handler
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* HW NMI watchdog support
*
* started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
*
* Arch specific calls to support NMI watchdog
*
* Bits copied from original nmi.c file
*
*/
#include <linux/thread_info.h>
#include <asm/apic.h>
#include <asm/nmi.h>
#include <linux/cpumask.h>
#include <linux/kdebug.h>
#include <linux/notifier.h>
#include <linux/kprobes.h>
#include <linux/nmi.h>
#include <linux/init.h>
#include <linux/delay.h>
#include "local.h"
#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
u64 hw_nmi_get_sample_period(int watchdog_thresh)
{
return (u64)(cpu_khz) * 1000 * watchdog_thresh;
}
#endif
#ifdef arch_trigger_cpumask_backtrace
static void nmi_raise_cpu_backtrace(cpumask_t *mask)
{
__apic_send_IPI_mask(mask, NMI_VECTOR);
}
void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu)
{
nmi_trigger_cpumask_backtrace(mask, exclude_cpu,
nmi_raise_cpu_backtrace);
}
static int nmi_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
{
if (nmi_cpu_backtrace(regs))
return NMI_HANDLED;
return NMI_DONE;
}
NOKPROBE_SYMBOL(nmi_cpu_backtrace_handler);
static int __init register_nmi_cpu_backtrace_handler(void)
{
register_nmi_handler(NMI_LOCAL, nmi_cpu_backtrace_handler,
0, "arch_bt");
return 0;
}
early_initcall(register_nmi_cpu_backtrace_handler);
#endif
Annotation
- Immediate include surface: `linux/thread_info.h`, `asm/apic.h`, `asm/nmi.h`, `linux/cpumask.h`, `linux/kdebug.h`, `linux/notifier.h`, `linux/kprobes.h`, `linux/nmi.h`.
- Detected declarations: `function hw_nmi_get_sample_period`, `function nmi_raise_cpu_backtrace`, `function arch_trigger_cpumask_backtrace`, `function nmi_cpu_backtrace_handler`, `function register_nmi_cpu_backtrace_handler`.
- 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.