mirror of
https://github.com/torvalds/linux.git
synced 2025-11-30 23:16:01 +07:00
Merge tag 'acpi-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki:
"These fix issues in the ACPI CPPC library and in the recently added
parser for the ACPI MRRM table:
- Limit some checks in the ACPI CPPC library to online CPUs to avoid
accessing uninitialized per-CPU variables when some CPUs are
offline to start with, like during boot with 'nosmt=force' (Gautham
Shenoy)
- Rework add_boot_memory_ranges() in the ACPI MRRM table parser to
fix memory leaks and improve error handling (Kaushlendra Kumar)"
* tag 'acpi-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: MRRM: Fix memory leaks and improve error handling
ACPI: CPPC: Limit perf ctrs in PCC check only to online CPUs
ACPI: CPPC: Perform fast check switch only for online CPUs
ACPI: CPPC: Check _CPC validity for only the online CPUs
ACPI: CPPC: Detect preferred core availability on online CPUs
This commit is contained in:
@@ -196,7 +196,7 @@ int amd_detect_prefcore(bool *detected)
|
||||
break;
|
||||
}
|
||||
|
||||
for_each_present_cpu(cpu) {
|
||||
for_each_online_cpu(cpu) {
|
||||
u32 tmp;
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -152,26 +152,49 @@ ATTRIBUTE_GROUPS(memory_range);
|
||||
|
||||
static __init int add_boot_memory_ranges(void)
|
||||
{
|
||||
struct kobject *pkobj, *kobj;
|
||||
struct kobject *pkobj, *kobj, **kobjs;
|
||||
int ret = -EINVAL;
|
||||
char *name;
|
||||
char name[16];
|
||||
int i;
|
||||
|
||||
pkobj = kobject_create_and_add("memory_ranges", acpi_kobj);
|
||||
if (!pkobj)
|
||||
return -ENOMEM;
|
||||
|
||||
for (int i = 0; i < mrrm_mem_entry_num; i++) {
|
||||
name = kasprintf(GFP_KERNEL, "range%d", i);
|
||||
if (!name) {
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
kobj = kobject_create_and_add(name, pkobj);
|
||||
|
||||
ret = sysfs_create_groups(kobj, memory_range_groups);
|
||||
if (ret)
|
||||
return ret;
|
||||
kobjs = kcalloc(mrrm_mem_entry_num, sizeof(*kobjs), GFP_KERNEL);
|
||||
if (!kobjs) {
|
||||
kobject_put(pkobj);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < mrrm_mem_entry_num; i++) {
|
||||
scnprintf(name, sizeof(name), "range%d", i);
|
||||
kobj = kobject_create_and_add(name, pkobj);
|
||||
if (!kobj) {
|
||||
ret = -ENOMEM;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = sysfs_create_groups(kobj, memory_range_groups);
|
||||
if (ret) {
|
||||
kobject_put(kobj);
|
||||
goto cleanup;
|
||||
}
|
||||
kobjs[i] = kobj;
|
||||
}
|
||||
|
||||
kfree(kobjs);
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (kobjs[j]) {
|
||||
sysfs_remove_groups(kobjs[j], memory_range_groups);
|
||||
kobject_put(kobjs[j]);
|
||||
}
|
||||
}
|
||||
kfree(kobjs);
|
||||
kobject_put(pkobj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ bool acpi_cpc_valid(void)
|
||||
if (acpi_disabled)
|
||||
return false;
|
||||
|
||||
for_each_present_cpu(cpu) {
|
||||
for_each_online_cpu(cpu) {
|
||||
cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
|
||||
if (!cpc_ptr)
|
||||
return false;
|
||||
@@ -476,7 +476,7 @@ bool cppc_allow_fast_switch(void)
|
||||
struct cpc_desc *cpc_ptr;
|
||||
int cpu;
|
||||
|
||||
for_each_present_cpu(cpu) {
|
||||
for_each_online_cpu(cpu) {
|
||||
cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
|
||||
desired_reg = &cpc_ptr->cpc_regs[DESIRED_PERF];
|
||||
if (!CPC_IN_SYSTEM_MEMORY(desired_reg) &&
|
||||
@@ -1435,7 +1435,7 @@ bool cppc_perf_ctrs_in_pcc(void)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_present_cpu(cpu) {
|
||||
for_each_online_cpu(cpu) {
|
||||
struct cpc_register_resource *ref_perf_reg;
|
||||
struct cpc_desc *cpc_desc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user