diff mbox series

cpufreq: Expose real_cpus out to userspace

Message ID 20190419062759.8524-2-zbestahu@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show
Series cpufreq: Expose real_cpus out to userspace | expand

Commit Message

Yue Hu April 19, 2019, 6:27 a.m. UTC
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(+)

Comments

Viresh Kumar April 22, 2019, 8:23 a.m. UTC | #1
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.
diff mbox series

Patch

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,