arch/x86/kernel/cpu/debugfs.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/cpu/debugfs.c- Extension
.c- Size
- 3269 bytes
- Lines
- 102
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hasm/apic.hasm/processor.hcpu.h
Detected Declarations
function cpu_debug_showfunction cpu_debug_openfunction dom_debug_showfunction dom_debug_openfunction cpu_init_debugfs
Annotated Snippet
static const struct file_operations dfs_cpu_ops = {
.open = cpu_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int dom_debug_show(struct seq_file *m, void *p)
{
static const char *domain_names[TOPO_MAX_DOMAIN] = {
[TOPO_SMT_DOMAIN] = "Thread",
[TOPO_CORE_DOMAIN] = "Core",
[TOPO_MODULE_DOMAIN] = "Module",
[TOPO_TILE_DOMAIN] = "Tile",
[TOPO_DIE_DOMAIN] = "Die",
[TOPO_DIEGRP_DOMAIN] = "DieGrp",
[TOPO_PKG_DOMAIN] = "Package",
};
unsigned int dom, nthreads = 1;
for (dom = 0; dom < TOPO_MAX_DOMAIN; dom++) {
nthreads *= x86_topo_system.dom_size[dom];
seq_printf(m, "domain: %-10s shift: %u dom_size: %5u max_threads: %5u\n",
domain_names[dom], x86_topo_system.dom_shifts[dom],
x86_topo_system.dom_size[dom], nthreads);
}
return 0;
}
static int dom_debug_open(struct inode *inode, struct file *file)
{
return single_open(file, dom_debug_show, inode->i_private);
}
static const struct file_operations dfs_dom_ops = {
.open = dom_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static __init int cpu_init_debugfs(void)
{
struct dentry *dir, *base = debugfs_create_dir("topo", arch_debugfs_dir);
unsigned long id;
char name[24];
debugfs_create_file("domains", 0444, base, NULL, &dfs_dom_ops);
dir = debugfs_create_dir("cpus", base);
for_each_possible_cpu(id) {
sprintf(name, "%lu", id);
debugfs_create_file(name, 0444, dir, (void *)id, &dfs_cpu_ops);
}
return 0;
}
late_initcall(cpu_init_debugfs);
Annotation
- Immediate include surface: `linux/debugfs.h`, `asm/apic.h`, `asm/processor.h`, `cpu.h`.
- Detected declarations: `function cpu_debug_show`, `function cpu_debug_open`, `function dom_debug_show`, `function dom_debug_open`, `function cpu_init_debugfs`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: pattern 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.