drivers/resctrl/mpam_resctrl.c
Source file repositories/reference/linux-study-clean/drivers/resctrl/mpam_resctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/resctrl/mpam_resctrl.c- Extension
.c- Size
- 44642 bytes
- Lines
- 1713
- Domain
- Driver Families
- Bucket
- drivers/resctrl
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/arm_mpam.hlinux/cacheinfo.hlinux/cpu.hlinux/cpumask.hlinux/errno.hlinux/limits.hlinux/list.hlinux/math.hlinux/printk.hlinux/rculist.hlinux/resctrl.hlinux/slab.hlinux/types.hlinux/wait.hasm/mpam.hmpam_internal.htest_mpam_resctrl.c
Detected Declarations
function resctrl_arch_alloc_capablefunction for_each_mpam_resctrl_controlfunction resctrl_arch_mon_capablefunction resctrl_arch_is_evt_configurablefunction resctrl_arch_mon_event_config_readfunction resctrl_arch_mbm_cntr_assign_enabledfunction resctrl_arch_mbm_cntr_assign_setfunction resctrl_arch_io_alloc_enablefunction resctrl_arch_get_io_alloc_enabledfunction resctrl_arch_pre_mountfunction resctrl_reset_task_closidsfunction resctrl_arch_set_cdp_enabledfunction mpam_resctrl_hide_cdpfunction resctrl_arch_get_num_closidfunction resctrl_arch_system_num_rmid_idxfunction resctrl_arch_rmid_idx_encodefunction resctrl_arch_rmid_idx_decodefunction resctrl_arch_sched_infunction resctrl_arch_set_cpu_default_closid_rmidfunction resctrl_arch_sync_cpu_closid_rmidfunction resctrl_arch_set_closid_rmidfunction resctrl_arch_match_closidfunction resctrl_arch_match_rmidfunction resctrl_arch_mon_ctx_alloc_no_waitfunction resctrl_arch_mon_ctx_free_no_waitfunction resctrl_arch_mon_ctx_freefunction __read_monfunction read_mon_cdp_safefunction resctrl_arch_rmid_readfunction update_rmid_limitsfunction cache_has_usable_cporfunction mba_class_use_mbw_maxfunction class_has_usable_mbafunction cache_has_usable_csufunction get_mba_granularityfunction mbw_max_to_percentfunction percent_to_mbw_maxfunction get_mba_minfunction find_l3_equivalent_bitmaskfunction topology_matches_l3function srcu_read_lock_heldfunction traffic_matches_l3function mpam_resctrl_pick_cachesfunction srcu_read_lock_heldfunction mpam_resctrl_pick_mbafunction srcu_read_lock_heldfunction counter_update_classfunction mpam_resctrl_pick_counters
Annotated Snippet
* populates this from a device_initcall(). mpam_resctrl_setup() must wait.
*/
static bool cacheinfo_ready;
static DECLARE_WAIT_QUEUE_HEAD(wait_cacheinfo_ready);
/*
* If resctrl_init() succeeded, resctrl_exit() can be used to remove support
* for the filesystem in the event of an error.
*/
static bool resctrl_enabled;
bool resctrl_arch_alloc_capable(void)
{
struct mpam_resctrl_res *res;
enum resctrl_res_level rid;
for_each_mpam_resctrl_control(res, rid) {
if (res->resctrl_res.alloc_capable)
return true;
}
return false;
}
bool resctrl_arch_mon_capable(void)
{
struct mpam_resctrl_res *res = &mpam_resctrl_controls[RDT_RESOURCE_L3];
struct rdt_resource *l3 = &res->resctrl_res;
/* All monitors are presented as being on the L3 cache */
return l3->mon_capable;
}
bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt)
{
return false;
}
void resctrl_arch_mon_event_config_read(void *info)
{
}
void resctrl_arch_mon_event_config_write(void *info)
{
}
void resctrl_arch_reset_rmid_all(struct rdt_resource *r, struct rdt_l3_mon_domain *d)
{
}
void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_l3_mon_domain *d,
u32 closid, u32 rmid, enum resctrl_event_id eventid)
{
}
void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d,
u32 closid, u32 rmid, int cntr_id,
enum resctrl_event_id eventid)
{
}
void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d,
enum resctrl_event_id evtid, u32 rmid, u32 closid,
u32 cntr_id, bool assign)
{
}
int resctrl_arch_cntr_read(struct rdt_resource *r, struct rdt_l3_mon_domain *d,
u32 unused, u32 rmid, int cntr_id,
enum resctrl_event_id eventid, u64 *val)
{
return -EOPNOTSUPP;
}
bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_resource *r)
{
return false;
}
int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable)
{
return -EINVAL;
}
int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable)
{
return -EOPNOTSUPP;
}
bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r)
Annotation
- Immediate include surface: `linux/arm_mpam.h`, `linux/cacheinfo.h`, `linux/cpu.h`, `linux/cpumask.h`, `linux/errno.h`, `linux/limits.h`, `linux/list.h`, `linux/math.h`.
- Detected declarations: `function resctrl_arch_alloc_capable`, `function for_each_mpam_resctrl_control`, `function resctrl_arch_mon_capable`, `function resctrl_arch_is_evt_configurable`, `function resctrl_arch_mon_event_config_read`, `function resctrl_arch_mbm_cntr_assign_enabled`, `function resctrl_arch_mbm_cntr_assign_set`, `function resctrl_arch_io_alloc_enable`, `function resctrl_arch_get_io_alloc_enabled`, `function resctrl_arch_pre_mount`.
- Atlas domain: Driver Families / drivers/resctrl.
- Implementation status: integration implementation candidate.
- 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.