Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
PATCH 1/1 Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
Currently, cpuinfo_cur_freq is only accessible for root user while other cpufreq sysfs interfaces(E,G scaling_cur_freq) are available to ordinary user. This seems make no sense. This patch is to change it.
--- drivers/cpufreq/cpufreq.c | 2 +- include/linux/cpufreq.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)
drivers/cpufreq/cpufreq.c +1 -1
@@ -605,7 +605,7 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)return sprintf (buf,"%u\n" , policy->cpuinfo.max_freq); } -cpufreq_freq_attr_ro_perm (cpuinfo_cur_freq,0400 ); +cpufreq_freq_attr_ro (cpuinfo_cur_freq);cpufreq_freq_attr_ro (cpuinfo_min_freq);cpufreq_freq_attr_ro (cpuinfo_max_freq);cpufreq_freq_attr_ro (cpuinfo_transition_latency);
include/linux/cpufreq.h +0 -4
@@ -166,10 +166,6 @@ struct freq_attr {static struct freq_attr _name = \ __ATTR(_name, 0444, show_##_name, NULL) -#define cpufreq_freq_attr_ro_perm (_name, _perm) \ -static struct freq_attr _name = \ -__ATTR(_name, _perm, show_##_name, NULL) -#define cpufreq_freq_attr_rw (_name) \ static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name)
Signature · 1 line
1.8.4.rc0.1.g8f6a3e5.dirty
Viresh Kumar
maintainerQuoted 4 lines · Lan Tianyu
Currently,
cpuinfo_cur_freqis only accessible for root user while other cpufreq sysfsinterfaces(E,G scaling_cur_freq)are available to ordinary user. This seems make no sense. This patch is to change it.
There is nothing wrong with the code and so this is more of a design change..
Probably Rafael can help us here as cpufreq_cur_freq will read stuff directly from hardware instead of using cached value in software.
--
viresh
Quoted 11 lines · Viresh Kumar
Quoted 4 lines · Lan Tianyu
Currently,
cpuinfo_cur_freqis only accessible for root user while other cpufreq sysfsinterfaces(E,G scaling_cur_freq)are available to ordinary user. This seems make no sense. This patch is to change it.There is nothing wrong with the code and so this is more of a design change..
Probably Rafael can help us here as
cpufreq_cur_freqwill read stuff directly from hardware instead of using cached value in software.
I think so, too. I also tried to checking the reason of the privilege by git log but the code was there before linux kernel being migrated to git repository.
Quoted 4 lines
--
viresh
Signature · 2 lines
Best regards Tianyu Lan
Quoted 10 lines · Lan Tianyu
Quoted 9 lines · Viresh Kumar
Quoted 4 lines · Lan Tianyu
Currently,
cpuinfo_cur_freqis only accessible for root user while other cpufreq sysfsinterfaces(E,G scaling_cur_freq)are available to ordinary user. This seems make no sense. This patch is to change it.There is nothing wrong with the code and so this is more of a design change..
Quoted 6 lines
Quoted 2 lines
Probably Rafael can help us here as
cpufreq_cur_freqwill read stuff directly from hardware instead of using cached value in software.I think so, too. I also tried to checking the reason of the privilege by git log but the code was there before linux kernel being migrated to git repository.
And it has always behaved in the same way? Then I wouldn't change it.
Thanks!
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Lan Tianyu
Quoted 9 lines · Viresh Kumar
Quoted 4 lines · Lan Tianyu
Currently,
cpuinfo_cur_freqis only accessible for root user while other cpufreq sysfsinterfaces(E,G scaling_cur_freq)are available to ordinary user. This seems make no sense. This patch is to change it.There is nothing wrong with the code and so this is more of a design change..
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Probably Rafael can help us here as
cpufreq_cur_freqwill read stuff directly from hardware instead of using cached value in software.I think so, too. I also tried to checking the reason of the privilege by git log but the code was there before linux kernel being migrated to git repository.
And it has always behaved in the same way? Then I wouldn't change it.
It has been there since 2.6.12-rc2 or more early. But the cpuinfo_cur_freq is read-only and seems no harmful.
Request from bug 65611.
https://bugzilla.kernel.org/show_bug.cgi?id=65611.
Quoted 2 lines
Thanks!
Signature · 2 lines
Best Regards Tianyu Lan
Quoted 19 lines · Lan Tianyu
Quoted 18 lines · Rafael J. Wysocki
Quoted 16 lines · Lan Tianyu
Quoted 11 lines · Viresh Kumar
Quoted 4 lines · Lan Tianyu
Currently,
cpuinfo_cur_freqis only accessible for root user while other cpufreq sysfsinterfaces(E,G scaling_cur_freq)are available to ordinary user. This seems make no sense. This patch is to change it.There is nothing wrong with the code and so this is more of a design change..
Probably Rafael can help us here as
cpufreq_cur_freqwill read stuff directly from hardware instead of using cached value in software.I think so, too. I also tried to checking the reason of the privilege by git log but the code was there before linux kernel being migrated to git repository.
Quoted 5 lines
Quoted 2 lines
And it has always behaved in the same way? Then I wouldn't change it.
It has been there since 2.6.12-rc2 or more early. But the
cpuinfo_cur_freqis read-only and seems no harmful.
If it reads things directly from hardware, it may not be totally neutral.
Thanks!
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.