linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
@ 2013-11-25  2:53 Lan Tianyu
  2013-11-25  4:30 ` Viresh Kumar
  0 siblings, 1 reply; 6+ messages in thread
From: Lan Tianyu @ 2013-11-25  2:53 UTC (permalink / raw)
  To: rjw, viresh.kumar, hg197; +Cc: Lan Tianyu, cpufreq, linux-pm, linux-kernel

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.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/cpufreq/cpufreq.c | 2 +-
 include/linux/cpufreq.h   | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 02d534d..1926465 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -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);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 5bd6ab9..b4bb677 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -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)
-- 
1.8.4.rc0.1.g8f6a3e5.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
  2013-11-25  2:53 [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege Lan Tianyu
@ 2013-11-25  4:30 ` Viresh Kumar
  2013-11-25  5:33   ` Lan Tianyu
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2013-11-25  4:30 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Rafael J. Wysocki, hg197, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On 25 November 2013 08:23, Lan Tianyu <tianyu.lan@intel.com> wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
  2013-11-25  4:30 ` Viresh Kumar
@ 2013-11-25  5:33   ` Lan Tianyu
  2013-11-25 11:26     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Lan Tianyu @ 2013-11-25  5:33 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, hg197, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On 2013年11月25日 12:30, Viresh Kumar wrote:
> On 25 November 2013 08:23, Lan Tianyu <tianyu.lan@intel.com> wrote:
>> 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.
> 
> 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.

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.

> 
> --
> viresh
> 


-- 
Best regards
Tianyu Lan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
  2013-11-25  5:33   ` Lan Tianyu
@ 2013-11-25 11:26     ` Rafael J. Wysocki
  2013-11-25 11:55       ` Lan Tianyu
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2013-11-25 11:26 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Viresh Kumar, hg197, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On Monday, November 25, 2013 01:33:39 PM Lan Tianyu wrote:
> On 2013年11月25日 12:30, Viresh Kumar wrote:
> > On 25 November 2013 08:23, Lan Tianyu <tianyu.lan@intel.com> wrote:
> >> 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.
> > 
> > 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.
> 
> 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!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
  2013-11-25 11:26     ` Rafael J. Wysocki
@ 2013-11-25 11:55       ` Lan Tianyu
  2013-11-25 12:14         ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Lan Tianyu @ 2013-11-25 11:55 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Viresh Kumar, hg197, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On 11/25/2013 07:26 PM, Rafael J. Wysocki wrote:
> On Monday, November 25, 2013 01:33:39 PM Lan Tianyu wrote:
>> On 2013年11月25日 12:30, Viresh Kumar wrote:
>>> On 25 November 2013 08:23, Lan Tianyu <tianyu.lan@intel.com> wrote:
>>>> 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.
>>>
>>> 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.
>>
>> 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.


> Thanks!
>


-- 
Best Regards
Tianyu Lan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege
  2013-11-25 11:55       ` Lan Tianyu
@ 2013-11-25 12:14         ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2013-11-25 12:14 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Viresh Kumar, hg197, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On Monday, November 25, 2013 07:55:33 PM Lan Tianyu wrote:
> On 11/25/2013 07:26 PM, Rafael J. Wysocki wrote:
> > On Monday, November 25, 2013 01:33:39 PM Lan Tianyu wrote:
> >> On 2013年11月25日 12:30, Viresh Kumar wrote:
> >>> On 25 November 2013 08:23, Lan Tianyu <tianyu.lan@intel.com> wrote:
> >>>> 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.
> >>>
> >>> 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.
> >>
> >> 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.

If it reads things directly from hardware, it may not be totally neutral.

Thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-25 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25  2:53 [PATCH] Cpufreq: Change sysfs interface cpuinfo_cur_freq access privilege Lan Tianyu
2013-11-25  4:30 ` Viresh Kumar
2013-11-25  5:33   ` Lan Tianyu
2013-11-25 11:26     ` Rafael J. Wysocki
2013-11-25 11:55       ` Lan Tianyu
2013-11-25 12:14         ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).