drivers/acpi/processor_throttling.c
Source file repositories/reference/linux-study-clean/drivers/acpi/processor_throttling.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/processor_throttling.c- Extension
.c- Size
- 30930 bytes
- Lines
- 1244
- Domain
- Driver Families
- Bucket
- drivers/acpi
- 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/kernel.hlinux/module.hlinux/slab.hlinux/init.hlinux/sched.hlinux/cpufreq.hlinux/acpi.hlinux/uaccess.hacpi/processor.hasm/io.hasm/msr.h
Detected Declarations
struct throttling_tstatestruct acpi_processor_throttling_argfunction acpi_processor_update_tsd_coordfunction for_each_possible_cpufunction for_each_possible_cpufunction for_each_possible_cpufunction for_each_possible_cpufunction acpi_processor_throttling_initfunction acpi_processor_throttling_notifierfunction acpi_processor_get_platform_limitfunction acpi_processor_tstate_has_changedfunction acpi_processor_reevaluate_tstatefunction acpi_processor_get_throttling_controlfunction acpi_processor_get_throttling_statesfunction acpi_processor_get_tsdfunction acpi_processor_get_throttling_fadtfunction acpi_throttling_rdmsrfunction acpi_throttling_wrmsrfunction acpi_throttling_rdmsrfunction acpi_throttling_wrmsrfunction acpi_read_throttling_statusfunction acpi_write_throttling_statefunction acpi_get_throttling_statefunction acpi_get_throttling_valuefunction acpi_processor_get_throttling_ptcfunction __acpi_processor_get_throttlingfunction acpi_processor_get_throttlingfunction acpi_processor_get_fadt_infofunction acpi_processor_set_throttling_fadtfunction acpi_processor_set_throttling_ptcfunction acpi_processor_throttling_fnfunction __acpi_processor_set_throttlingfunction for_each_cpu_andfunction acpi_processor_set_throttlingfunction acpi_processor_get_throttling_infofunction acpi_processor_get_throttling_states
Annotated Snippet
struct throttling_tstate {
unsigned int cpu; /* cpu nr */
int target_state; /* target T-state */
};
struct acpi_processor_throttling_arg {
struct acpi_processor *pr;
int target_state;
bool force;
};
#define THROTTLING_PRECHANGE (1)
#define THROTTLING_POSTCHANGE (2)
static int acpi_processor_get_throttling(struct acpi_processor *pr);
static int __acpi_processor_set_throttling(struct acpi_processor *pr,
int state, bool force, bool direct);
static int acpi_processor_update_tsd_coord(void)
{
int count_target;
int retval = 0;
unsigned int i, j;
cpumask_var_t covered_cpus;
struct acpi_processor *pr, *match_pr;
struct acpi_tsd_package *pdomain, *match_pdomain;
struct acpi_processor_throttling *pthrottling, *match_pthrottling;
if (!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))
return -ENOMEM;
/*
* Now that we have _TSD data from all CPUs, lets setup T-state
* coordination between all CPUs.
*/
for_each_possible_cpu(i) {
pr = per_cpu(processors, i);
if (!pr)
continue;
/* Basic validity check for domain info */
pthrottling = &(pr->throttling);
/*
* If tsd package for one cpu is invalid, the coordination
* among all CPUs is thought as invalid.
* Maybe it is ugly.
*/
if (!pthrottling->tsd_valid_flag) {
retval = -EINVAL;
break;
}
}
if (retval)
goto err_ret;
for_each_possible_cpu(i) {
pr = per_cpu(processors, i);
if (!pr)
continue;
if (cpumask_test_cpu(i, covered_cpus))
continue;
pthrottling = &pr->throttling;
pdomain = &(pthrottling->domain_info);
cpumask_set_cpu(i, pthrottling->shared_cpu_map);
cpumask_set_cpu(i, covered_cpus);
/*
* If the number of processor in the TSD domain is 1, it is
* unnecessary to parse the coordination for this CPU.
*/
if (pdomain->num_processors <= 1)
continue;
/* Validate the Domain info */
count_target = pdomain->num_processors;
for_each_possible_cpu(j) {
if (i == j)
continue;
match_pr = per_cpu(processors, j);
if (!match_pr)
continue;
match_pthrottling = &(match_pr->throttling);
match_pdomain = &(match_pthrottling->domain_info);
if (match_pdomain->domain != pdomain->domain)
continue;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/init.h`, `linux/sched.h`, `linux/cpufreq.h`, `linux/acpi.h`, `linux/uaccess.h`.
- Detected declarations: `struct throttling_tstate`, `struct acpi_processor_throttling_arg`, `function acpi_processor_update_tsd_coord`, `function for_each_possible_cpu`, `function for_each_possible_cpu`, `function for_each_possible_cpu`, `function for_each_possible_cpu`, `function acpi_processor_throttling_init`, `function acpi_processor_throttling_notifier`, `function acpi_processor_get_platform_limit`.
- Atlas domain: Driver Families / drivers/acpi.
- 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.