arch/x86/kernel/cpu/resctrl/rdtgroup.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/cpu/resctrl/rdtgroup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/cpu/resctrl/rdtgroup.c- Extension
.c- Size
- 6473 bytes
- Lines
- 263
- 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/cpu.hlinux/debugfs.hlinux/fs.hlinux/fs_parser.hlinux/sysfs.hlinux/kernfs.hlinux/resctrl.hlinux/seq_buf.hlinux/seq_file.hlinux/sched/signal.hlinux/sched/task.hlinux/slab.hlinux/task_work.hlinux/user_namespace.huapi/linux/magic.hasm/msr.hinternal.h
Detected Declarations
function resctrl_arch_sched_infunction mon_event_config_index_getfunction resctrl_arch_mon_event_config_readfunction resctrl_arch_mon_event_config_writefunction l3_qos_cfg_updatefunction l2_qos_cfg_updatefunction set_cache_qos_cfgfunction rdt_domain_reconfigure_cdpfunction cdp_enablefunction cdp_disablefunction resctrl_arch_set_cdp_enabledfunction resctrl_arch_get_cdp_enabledfunction resctrl_arch_reset_all_ctrls
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* User interface for Resource Allocation in Resource Director Technology(RDT)
*
* Copyright (C) 2016 Intel Corporation
*
* Author: Fenghua Yu <fenghua.yu@intel.com>
*
* More information about RDT be found in the Intel (R) x86 Architecture
* Software Developer Manual.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cpu.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/fs_parser.h>
#include <linux/sysfs.h>
#include <linux/kernfs.h>
#include <linux/resctrl.h>
#include <linux/seq_buf.h>
#include <linux/seq_file.h>
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
#include <linux/task_work.h>
#include <linux/user_namespace.h>
#include <uapi/linux/magic.h>
#include <asm/msr.h>
#include "internal.h"
DEFINE_STATIC_KEY_FALSE(rdt_enable_key);
DEFINE_STATIC_KEY_FALSE(rdt_mon_enable_key);
DEFINE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
/*
* This is safe against resctrl_arch_sched_in() called from __switch_to()
* because __switch_to() is executed with interrupts disabled. A local call
* from update_closid_rmid() is protected against __switch_to() because
* preemption is disabled.
*/
void resctrl_arch_sync_cpu_closid_rmid(void *info)
{
struct resctrl_cpu_defaults *r = info;
if (r) {
this_cpu_write(pqr_state.default_closid, r->closid);
this_cpu_write(pqr_state.default_rmid, r->rmid);
}
/*
* We cannot unconditionally write the MSR because the current
* executing task might have its own closid selected. Just reuse
* the context switch code.
*/
resctrl_arch_sched_in(current);
}
#define INVALID_CONFIG_INDEX UINT_MAX
/**
* mon_event_config_index_get - get the hardware index for the
* configurable event
* @evtid: event id.
*
* Return: 0 for evtid == QOS_L3_MBM_TOTAL_EVENT_ID
* 1 for evtid == QOS_L3_MBM_LOCAL_EVENT_ID
* INVALID_CONFIG_INDEX for invalid evtid
*/
static inline unsigned int mon_event_config_index_get(u32 evtid)
{
switch (evtid) {
case QOS_L3_MBM_TOTAL_EVENT_ID:
return 0;
case QOS_L3_MBM_LOCAL_EVENT_ID:
return 1;
default:
/* Should never reach here */
return INVALID_CONFIG_INDEX;
}
}
void resctrl_arch_mon_event_config_read(void *_config_info)
{
struct resctrl_mon_config_info *config_info = _config_info;
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/debugfs.h`, `linux/fs.h`, `linux/fs_parser.h`, `linux/sysfs.h`, `linux/kernfs.h`, `linux/resctrl.h`, `linux/seq_buf.h`.
- Detected declarations: `function resctrl_arch_sched_in`, `function mon_event_config_index_get`, `function resctrl_arch_mon_event_config_read`, `function resctrl_arch_mon_event_config_write`, `function l3_qos_cfg_update`, `function l2_qos_cfg_update`, `function set_cache_qos_cfg`, `function rdt_domain_reconfigure_cdp`, `function cdp_enable`, `function cdp_disable`.
- 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.