arch/s390/kernel/debug.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/debug.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/debug.c- Extension
.c- Size
- 46434 bytes
- Lines
- 1834
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/stddef.hlinux/kernel.hlinux/errno.hlinux/slab.hlinux/ctype.hlinux/string.hlinux/sysctl.hlinux/uaccess.hlinux/export.hlinux/init.hlinux/fs.hlinux/math.hlinux/minmax.hlinux/debugfs.hlinux/glob.hlinux/stringify.hasm/debug.h
Detected Declarations
function debug_get_paramfunction s390dbf_parse_onefunction s390dbf_parsefunction debug_areas_freefunction debug_info_freefunction debug_info_getfunction debug_info_putfunction debug_format_entryfunction debug_next_entryfunction debug_to_act_entryfunction debug_prev_entryfunction previousfunction debug_inputfunction debug_openfunction debug_file_private_freefunction debug_closefunction debug_dumpfunction _debug_registerfunction debug_register_modefunction debug_registerfunction debug_register_staticfunction _debug_unregisterfunction debug_unregisterfunction debug_set_sizefunction _debug_set_levelfunction debug_set_levelfunction proceed_active_entryfunction proceed_active_areafunction debug_areas_swapfunction debug_events_appendfunction debug_finish_entryfunction s390dbf_procactivefunction debug_stop_allfunction debug_set_criticalfunction debug_count_numargsfunction debug_register_viewfunction debug_unregister_viewfunction debug_get_uintfunction debug_prolog_pages_fnfunction sizefunction debug_prolog_level_fnfunction debug_input_level_fnfunction debug_flushfunction debug_input_flush_fnfunction debug_hex_ascii_format_fnfunction debug_dflt_header_fnfunction debug_sprintf_format_fnfunction debug_init
Annotated Snippet
static const struct file_operations debug_file_ops = {
.owner = THIS_MODULE,
.read = debug_output,
.write = debug_input,
.open = debug_open,
.release = debug_close,
};
static struct dentry *debug_debugfs_root_entry;
/* List of debug area parameters to override */
#define PARAM_UNSET -2
#define PARAM_NUM 16
static struct debug_param_t {
char name[DEBUG_MAX_NAME_LEN + 1];
int level;
int pages;
} debug_param[PARAM_NUM];
static int debug_param_num;
/* functions */
static void debug_get_param(const char *name, int *level, int *pages)
{
struct debug_param_t *p;
int i;
for (i = 0; i < debug_param_num; i++) {
p = &debug_param[i];
if (!glob_match(p->name, name))
continue;
if (level && p->level != PARAM_UNSET) {
pr_info("%s: override level to %d\n", name, p->level);
*level = p->level;
}
if (pages && p->pages != PARAM_UNSET) {
pr_info("%s: override pages to %d\n", name, p->pages);
*pages = p->pages;
}
}
}
#define LVL_LEN 10
#define LVL_FMT "%" __stringify(LVL_LEN) "[^:]"
#define NAME_FMT "%" __stringify(DEBUG_MAX_NAME_LEN) "[^:]"
static bool __init s390dbf_parse_one(const char *arg, struct debug_param_t *param)
{
struct debug_param_t p = { { 0 }, PARAM_UNSET, PARAM_UNSET };
char level[LVL_LEN + 1] = { 0 };
/* arg: <name|pattern>:[<level>|-]:[<pages>] */
if (sscanf(arg, NAME_FMT ":" LVL_FMT ":%d", p.name, level, &p.pages) > 1) {
if (strcmp(level, "-") == 0)
p.level = DEBUG_OFF_LEVEL;
else if (kstrtoint(level, 0, &p.level) != 0)
return false;
} else if (sscanf(arg, NAME_FMT "::%d", p.name, &p.pages) != 2) {
return false;
}
if (p.level != PARAM_UNSET && p.level != DEBUG_OFF_LEVEL &&
(p.level < 0 || p.level > DEBUG_MAX_LEVEL))
return false;
if (p.pages != PARAM_UNSET && p.pages < 0)
return false;
*param = p;
return true;
}
static int __init s390dbf_parse(char *arg)
{
debug_info_t **id;
int i, rc = 0;
while (arg && debug_param_num < PARAM_NUM) {
if (s390dbf_parse_one(arg, &debug_param[debug_param_num]))
debug_param_num++;
else
rc = -EINVAL;
arg = strchr(arg, ',');
if (arg)
arg++;
}
/*
* Apply level to static debug areas, delay buffer size changes until
* regular memory allocations are possible.
*/
for (i = 0, id = __s390dbf_info; &id[i] < __s390dbf_info_end; i++)
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/kernel.h`, `linux/errno.h`, `linux/slab.h`, `linux/ctype.h`, `linux/string.h`, `linux/sysctl.h`, `linux/uaccess.h`.
- Detected declarations: `function debug_get_param`, `function s390dbf_parse_one`, `function s390dbf_parse`, `function debug_areas_free`, `function debug_info_free`, `function debug_info_get`, `function debug_info_put`, `function debug_format_entry`, `function debug_next_entry`, `function debug_to_act_entry`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.