arch/x86/kernel/cpu/mce/threshold.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/mce/threshold.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/cpu/mce/threshold.c- Extension
.c- Size
- 4325 bytes
- Lines
- 164
- 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/interrupt.hlinux/kernel.hasm/irq_vectors.hasm/traps.hasm/apic.hasm/mce.hasm/trace/irq_vectors.hinternal.h
Detected Declarations
function mce_save_apei_thr_limitfunction mce_get_apei_thr_limitfunction default_threshold_interruptfunction mce_inherit_stormfunction mce_get_storm_modefunction mce_set_storm_modefunction mce_handle_stormfunction cmci_storm_beginfunction cmci_storm_endfunction mce_track_storm
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Common corrected MCE threshold handler code:
*/
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <asm/irq_vectors.h>
#include <asm/traps.h>
#include <asm/apic.h>
#include <asm/mce.h>
#include <asm/trace/irq_vectors.h>
#include "internal.h"
static u32 mce_apei_thr_limit;
void mce_save_apei_thr_limit(u32 thr_limit)
{
mce_apei_thr_limit = thr_limit;
pr_info("HEST corrected error threshold limit: %u\n", thr_limit);
}
u32 mce_get_apei_thr_limit(void)
{
return mce_apei_thr_limit;
}
static void default_threshold_interrupt(void)
{
pr_err("Unexpected threshold interrupt at vector %x\n",
THRESHOLD_APIC_VECTOR);
}
void (*mce_threshold_vector)(void) = default_threshold_interrupt;
DEFINE_IDTENTRY_SYSVEC(sysvec_threshold)
{
trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR);
inc_irq_stat(THRESHOLD_APIC);
mce_threshold_vector();
trace_threshold_apic_exit(THRESHOLD_APIC_VECTOR);
apic_eoi();
}
DEFINE_PER_CPU(struct mca_storm_desc, storm_desc);
void mce_inherit_storm(unsigned int bank)
{
struct mca_storm_desc *storm = this_cpu_ptr(&storm_desc);
/*
* Previous CPU owning this bank had put it into storm mode,
* but the precise history of that storm is unknown. Assume
* the worst (all recent polls of the bank found a valid error
* logged). This will avoid the new owner prematurely declaring
* the storm has ended.
*/
storm->banks[bank].history = ~0ull;
storm->banks[bank].timestamp = jiffies;
}
bool mce_get_storm_mode(void)
{
return __this_cpu_read(storm_desc.poll_mode);
}
void mce_set_storm_mode(bool storm)
{
__this_cpu_write(storm_desc.poll_mode, storm);
}
static void mce_handle_storm(unsigned int bank, bool on)
{
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
mce_intel_handle_storm(bank, on);
break;
case X86_VENDOR_AMD:
mce_amd_handle_storm(bank, on);
break;
}
}
void cmci_storm_begin(unsigned int bank)
{
struct mca_storm_desc *storm = this_cpu_ptr(&storm_desc);
__set_bit(bank, this_cpu_ptr(mce_poll_banks));
storm->banks[bank].in_storm_mode = true;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `asm/irq_vectors.h`, `asm/traps.h`, `asm/apic.h`, `asm/mce.h`, `asm/trace/irq_vectors.h`, `internal.h`.
- Detected declarations: `function mce_save_apei_thr_limit`, `function mce_get_apei_thr_limit`, `function default_threshold_interrupt`, `function mce_inherit_storm`, `function mce_get_storm_mode`, `function mce_set_storm_mode`, `function mce_handle_storm`, `function cmci_storm_begin`, `function cmci_storm_end`, `function mce_track_storm`.
- 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.