mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
[CPUFREQ] Disable sysfs ui for p4-clockmod.
p4-clockmod has a long history of abuse. It pretends to be a CPU frequency scaling driver, even though it doesn't actually change the CPU frequency, but instead just modulates the frequency with wait-states. The biggest misconception is that when running at the lower 'frequency' p4-clockmod is saving power. This isn't the case, as workloads running slower take longer to complete, preventing the CPU from entering deep C states. However p4-clockmod does have a purpose. It can prevent overheating. Having it hooked up to the cpufreq interfaces is the wrong way to achieve cooling however. It should instead be hooked up to ACPI. This diff introduces a means for a cpufreq driver to register with the cpufreq core, but not present a sysfs interface. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Dave Jones <davej@redhat.com>
This commit is contained in:
parent
10db2e5cbd
commit
e088e4c9cd
3 changed files with 36 additions and 19 deletions
|
@ -276,6 +276,7 @@ static struct cpufreq_driver p4clockmod_driver = {
|
||||||
.name = "p4-clockmod",
|
.name = "p4-clockmod",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.attr = p4clockmod_attr,
|
.attr = p4clockmod_attr,
|
||||||
|
.hide_interface = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -754,6 +754,11 @@ static struct kobj_type ktype_cpufreq = {
|
||||||
.release = cpufreq_sysfs_release,
|
.release = cpufreq_sysfs_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct kobj_type ktype_empty_cpufreq = {
|
||||||
|
.sysfs_ops = &sysfs_ops,
|
||||||
|
.release = cpufreq_sysfs_release,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cpufreq_add_dev - add a CPU device
|
* cpufreq_add_dev - add a CPU device
|
||||||
|
@ -876,26 +881,36 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
|
||||||
memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
|
memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
|
||||||
|
|
||||||
/* prepare interface data */
|
/* prepare interface data */
|
||||||
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj,
|
if (!cpufreq_driver->hide_interface) {
|
||||||
"cpufreq");
|
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
|
||||||
if (ret)
|
&sys_dev->kobj, "cpufreq");
|
||||||
goto err_out_driver_exit;
|
if (ret)
|
||||||
|
goto err_out_driver_exit;
|
||||||
|
|
||||||
/* set up files for this cpu device */
|
/* set up files for this cpu device */
|
||||||
drv_attr = cpufreq_driver->attr;
|
drv_attr = cpufreq_driver->attr;
|
||||||
while ((drv_attr) && (*drv_attr)) {
|
while ((drv_attr) && (*drv_attr)) {
|
||||||
ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
|
ret = sysfs_create_file(&policy->kobj,
|
||||||
if (ret)
|
&((*drv_attr)->attr));
|
||||||
goto err_out_driver_exit;
|
if (ret)
|
||||||
drv_attr++;
|
goto err_out_driver_exit;
|
||||||
}
|
drv_attr++;
|
||||||
if (cpufreq_driver->get) {
|
}
|
||||||
ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
|
if (cpufreq_driver->get) {
|
||||||
if (ret)
|
ret = sysfs_create_file(&policy->kobj,
|
||||||
goto err_out_driver_exit;
|
&cpuinfo_cur_freq.attr);
|
||||||
}
|
if (ret)
|
||||||
if (cpufreq_driver->target) {
|
goto err_out_driver_exit;
|
||||||
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
|
}
|
||||||
|
if (cpufreq_driver->target) {
|
||||||
|
ret = sysfs_create_file(&policy->kobj,
|
||||||
|
&scaling_cur_freq.attr);
|
||||||
|
if (ret)
|
||||||
|
goto err_out_driver_exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq,
|
||||||
|
&sys_dev->kobj, "cpufreq");
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out_driver_exit;
|
goto err_out_driver_exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,6 +234,7 @@ struct cpufreq_driver {
|
||||||
int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
|
int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
|
||||||
int (*resume) (struct cpufreq_policy *policy);
|
int (*resume) (struct cpufreq_policy *policy);
|
||||||
struct freq_attr **attr;
|
struct freq_attr **attr;
|
||||||
|
bool hide_interface;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
|
|
Loading…
Reference in a new issue