drivers/hv/mshv_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/hv/mshv_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hv/mshv_debugfs.c- Extension
.c- Size
- 17021 bytes
- Lines
- 730
- Domain
- Driver Families
- Bucket
- drivers/hv
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/debugfs.hlinux/stringify.hasm/mshyperv.hlinux/slab.hmshv.hmshv_root.hmshv_debugfs_counters.c
Detected Declarations
function lp_stats_showfunction mshv_lp_stats_unmapfunction mshv_lp_stats_mapfunction lp_debugfs_stats_createfunction lp_debugfs_createfunction mshv_debugfs_lp_removefunction mshv_debugfs_lp_createfunction vp_stats_showfunction vp_debugfs_removefunction vp_debugfs_createfunction partition_stats_showfunction mshv_partition_stats_unmapfunction mshv_debugfs_partition_stats_createfunction partition_debugfs_removefunction partition_debugfs_createfunction parent_vp_debugfs_removefunction mshv_debugfs_parent_partition_removefunction parent_vp_debugfs_createfunction mshv_debugfs_parent_partition_createfunction for_each_online_cpufunction hv_stats_showfunction mshv_hv_stats_unmapfunction mshv_hv_stats_mapfunction mshv_debugfs_hv_stats_createfunction mshv_debugfs_vp_createfunction mshv_debugfs_vp_removefunction mshv_debugfs_partition_createfunction mshv_debugfs_partition_removefunction mshv_debugfs_initfunction mshv_debugfs_exit
Annotated Snippet
if (IS_ERR(pstats[HV_STATS_AREA_PARENT])) {
err = PTR_ERR(pstats[HV_STATS_AREA_PARENT]);
goto unmap_self;
}
if (!pstats[HV_STATS_AREA_PARENT])
pstats[HV_STATS_AREA_PARENT] = pstats[HV_STATS_AREA_SELF];
}
dentry = debugfs_create_file("stats", 0400, parent,
pstats, &partition_stats_fops);
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
goto unmap_partition_stats;
}
*partition_stats_ptr = dentry;
return 0;
unmap_partition_stats:
if (pstats[HV_STATS_AREA_PARENT] != pstats[HV_STATS_AREA_SELF])
mshv_partition_stats_unmap(partition_id, pstats[HV_STATS_AREA_PARENT],
HV_STATS_AREA_PARENT);
unmap_self:
mshv_partition_stats_unmap(partition_id, pstats[HV_STATS_AREA_SELF],
HV_STATS_AREA_SELF);
cleanup:
kfree(pstats);
return err;
}
static void partition_debugfs_remove(u64 partition_id, struct dentry *dentry)
{
struct hv_stats_page **pstats = NULL;
pstats = dentry->d_inode->i_private;
debugfs_remove_recursive(dentry->d_parent);
if (pstats[HV_STATS_AREA_PARENT] != pstats[HV_STATS_AREA_SELF]) {
mshv_partition_stats_unmap(partition_id,
pstats[HV_STATS_AREA_PARENT],
HV_STATS_AREA_PARENT);
}
mshv_partition_stats_unmap(partition_id,
pstats[HV_STATS_AREA_SELF],
HV_STATS_AREA_SELF);
kfree(pstats);
}
static int partition_debugfs_create(u64 partition_id,
struct dentry **vp_dir_ptr,
struct dentry **partition_stats_ptr,
struct dentry *parent)
{
char part_id_str[U64_BUF_SZ];
struct dentry *part_id_dir, *vp_dir;
int err;
if (is_l1vh_parent(partition_id))
sprintf(part_id_str, "self");
else
sprintf(part_id_str, "%llu", partition_id);
part_id_dir = debugfs_create_dir(part_id_str, parent);
if (IS_ERR(part_id_dir))
return PTR_ERR(part_id_dir);
vp_dir = debugfs_create_dir("vp", part_id_dir);
if (IS_ERR(vp_dir)) {
err = PTR_ERR(vp_dir);
goto remove_debugfs_partition_id;
}
err = mshv_debugfs_partition_stats_create(partition_id,
partition_stats_ptr,
part_id_dir);
if (err)
goto remove_debugfs_partition_id;
*vp_dir_ptr = vp_dir;
return 0;
remove_debugfs_partition_id:
debugfs_remove_recursive(part_id_dir);
return err;
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/stringify.h`, `asm/mshyperv.h`, `linux/slab.h`, `mshv.h`, `mshv_root.h`, `mshv_debugfs_counters.c`.
- Detected declarations: `function lp_stats_show`, `function mshv_lp_stats_unmap`, `function mshv_lp_stats_map`, `function lp_debugfs_stats_create`, `function lp_debugfs_create`, `function mshv_debugfs_lp_remove`, `function mshv_debugfs_lp_create`, `function vp_stats_show`, `function vp_debugfs_remove`, `function vp_debugfs_create`.
- Atlas domain: Driver Families / drivers/hv.
- 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.