All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get()
@ 2019-04-19  6:27 Yue Hu
  2019-04-19  6:27 ` [PATCH] cpufreq: Expose real_cpus out to userspace Yue Hu
  2019-04-22  8:19 ` [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Viresh Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Yue Hu @ 2019-04-19  6:27 UTC (permalink / raw)
  To: rjw, viresh.kumar, rafael.j.wysocki; +Cc: linux-pm, huyue2

From: Yue Hu <huyue2@yulong.com>

Currenly, __cpufreq_get() called by show_cpuinfo_cur_freq() will check
->get callback. That is needless since cpuinfo_cur_freq attribute will
not be created if ->get is not set. So let's drop it in __cpufreq_get().
Also keep this check in cpufreq_get().

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 drivers/cpufreq/cpufreq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 047662b..c6187f1 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1548,7 +1548,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
 {
 	unsigned int ret_freq = 0;
 
-	if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
+	if (unlikely(policy_is_inactive(policy)))
 		return ret_freq;
 
 	ret_freq = cpufreq_driver->get(policy->cpu);
@@ -1586,7 +1586,8 @@ unsigned int cpufreq_get(unsigned int cpu)
 
 	if (policy) {
 		down_read(&policy->rwsem);
-		ret_freq = __cpufreq_get(policy);
+		if (cpufreq_driver->get)
+			ret_freq = __cpufreq_get(policy);
 		up_read(&policy->rwsem);
 
 		cpufreq_cpu_put(policy);
-- 
1.9.1


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

* [PATCH] cpufreq: Expose real_cpus out to userspace
  2019-04-19  6:27 [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Yue Hu
@ 2019-04-19  6:27 ` Yue Hu
  2019-04-22  8:23   ` Viresh Kumar
  2019-04-22  8:19 ` [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Viresh Kumar
  1 sibling, 1 reply; 5+ messages in thread
From: Yue Hu @ 2019-04-19  6:27 UTC (permalink / raw)
  To: rjw, viresh.kumar, rafael.j.wysocki; +Cc: linux-pm, huyue2

From: Yue Hu <huyue2@yulong.com>

Currently, there are 3 CPU masks, let's expose real_cpus just like the
others if user want to know related CPUs that are actually present.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 drivers/cpufreq/cpufreq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c6187f1..0322cce 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -824,6 +824,11 @@ static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
 	return cpufreq_show_cpus(policy->cpus, buf);
 }
 
+static ssize_t show_real_cpus(struct cpufreq_policy *policy, char *buf)
+{
+	return cpufreq_show_cpus(policy->real_cpus, buf);
+}
+
 static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
 					const char *buf, size_t count)
 {
@@ -873,6 +878,7 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
 cpufreq_freq_attr_ro(bios_limit);
 cpufreq_freq_attr_ro(related_cpus);
 cpufreq_freq_attr_ro(affected_cpus);
+cpufreq_freq_attr_ro(real_cpus);
 cpufreq_freq_attr_rw(scaling_min_freq);
 cpufreq_freq_attr_rw(scaling_max_freq);
 cpufreq_freq_attr_rw(scaling_governor);
@@ -886,6 +892,7 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
 	&scaling_max_freq.attr,
 	&affected_cpus.attr,
 	&related_cpus.attr,
+	&real_cpus.attr,
 	&scaling_governor.attr,
 	&scaling_driver.attr,
 	&scaling_available_governors.attr,
-- 
1.9.1


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

* Re: [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get()
  2019-04-19  6:27 [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Yue Hu
  2019-04-19  6:27 ` [PATCH] cpufreq: Expose real_cpus out to userspace Yue Hu
@ 2019-04-22  8:19 ` Viresh Kumar
  2019-05-01 10:39   ` Rafael J. Wysocki
  1 sibling, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2019-04-22  8:19 UTC (permalink / raw)
  To: Yue Hu; +Cc: rjw, rafael.j.wysocki, linux-pm, huyue2

On 19-04-19, 14:27, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
> 
> Currenly, __cpufreq_get() called by show_cpuinfo_cur_freq() will check
> ->get callback. That is needless since cpuinfo_cur_freq attribute will
> not be created if ->get is not set. So let's drop it in __cpufreq_get().
> Also keep this check in cpufreq_get().
> 
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
>  drivers/cpufreq/cpufreq.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 047662b..c6187f1 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1548,7 +1548,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
>  {
>  	unsigned int ret_freq = 0;
>  
> -	if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
> +	if (unlikely(policy_is_inactive(policy)))
>  		return ret_freq;
>  
>  	ret_freq = cpufreq_driver->get(policy->cpu);
> @@ -1586,7 +1586,8 @@ unsigned int cpufreq_get(unsigned int cpu)
>  
>  	if (policy) {
>  		down_read(&policy->rwsem);
> -		ret_freq = __cpufreq_get(policy);
> +		if (cpufreq_driver->get)
> +			ret_freq = __cpufreq_get(policy);
>  		up_read(&policy->rwsem);
>  
>  		cpufreq_cpu_put(policy);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* Re: [PATCH] cpufreq: Expose real_cpus out to userspace
  2019-04-19  6:27 ` [PATCH] cpufreq: Expose real_cpus out to userspace Yue Hu
@ 2019-04-22  8:23   ` Viresh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2019-04-22  8:23 UTC (permalink / raw)
  To: Yue Hu; +Cc: rjw, rafael.j.wysocki, linux-pm, huyue2

On 19-04-19, 14:27, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
> 
> Currently, there are 3 CPU masks, let's expose real_cpus just like the
> others if user want to know related CPUs that are actually present.
> 
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
>  drivers/cpufreq/cpufreq.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index c6187f1..0322cce 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -824,6 +824,11 @@ static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
>  	return cpufreq_show_cpus(policy->cpus, buf);
>  }
>  
> +static ssize_t show_real_cpus(struct cpufreq_policy *policy, char *buf)
> +{
> +	return cpufreq_show_cpus(policy->real_cpus, buf);
> +}
> +
>  static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
>  					const char *buf, size_t count)
>  {
> @@ -873,6 +878,7 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
>  cpufreq_freq_attr_ro(bios_limit);
>  cpufreq_freq_attr_ro(related_cpus);
>  cpufreq_freq_attr_ro(affected_cpus);
> +cpufreq_freq_attr_ro(real_cpus);
>  cpufreq_freq_attr_rw(scaling_min_freq);
>  cpufreq_freq_attr_rw(scaling_max_freq);
>  cpufreq_freq_attr_rw(scaling_governor);
> @@ -886,6 +892,7 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
>  	&scaling_max_freq.attr,
>  	&affected_cpus.attr,
>  	&related_cpus.attr,
> +	&real_cpus.attr,
>  	&scaling_governor.attr,
>  	&scaling_driver.attr,
>  	&scaling_available_governors.attr,

The same information can be looked into (indirectly though) by looking
at related_cpus and online_cpus isn't it ? Why expose it then ? I am a
bit against it as it is only used for internal reasons right now.

-- 
viresh

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

* Re: [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get()
  2019-04-22  8:19 ` [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Viresh Kumar
@ 2019-05-01 10:39   ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01 10:39 UTC (permalink / raw)
  To: Viresh Kumar, Yue Hu; +Cc: rafael.j.wysocki, linux-pm, huyue2

On Monday, April 22, 2019 10:19:02 AM CEST Viresh Kumar wrote:
> On 19-04-19, 14:27, Yue Hu wrote:
> > From: Yue Hu <huyue2@yulong.com>
> > 
> > Currenly, __cpufreq_get() called by show_cpuinfo_cur_freq() will check
> > ->get callback. That is needless since cpuinfo_cur_freq attribute will
> > not be created if ->get is not set. So let's drop it in __cpufreq_get().
> > Also keep this check in cpufreq_get().
> > 
> > Signed-off-by: Yue Hu <huyue2@yulong.com>
> > ---
> >  drivers/cpufreq/cpufreq.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 047662b..c6187f1 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1548,7 +1548,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
> >  {
> >  	unsigned int ret_freq = 0;
> >  
> > -	if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
> > +	if (unlikely(policy_is_inactive(policy)))
> >  		return ret_freq;
> >  
> >  	ret_freq = cpufreq_driver->get(policy->cpu);
> > @@ -1586,7 +1586,8 @@ unsigned int cpufreq_get(unsigned int cpu)
> >  
> >  	if (policy) {
> >  		down_read(&policy->rwsem);
> > -		ret_freq = __cpufreq_get(policy);
> > +		if (cpufreq_driver->get)
> > +			ret_freq = __cpufreq_get(policy);
> >  		up_read(&policy->rwsem);
> >  
> >  		cpufreq_cpu_put(policy);
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch applied, thanks!




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

end of thread, other threads:[~2019-05-01 10:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19  6:27 [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Yue Hu
2019-04-19  6:27 ` [PATCH] cpufreq: Expose real_cpus out to userspace Yue Hu
2019-04-22  8:23   ` Viresh Kumar
2019-04-22  8:19 ` [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Viresh Kumar
2019-05-01 10:39   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.