linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: don't print value of .driver_data from core
@ 2014-03-27 10:07 Viresh Kumar
  2014-03-27 10:19 ` Srivatsa S. Bhat
  2014-03-27 10:48 ` Gautham R Shenoy
  0 siblings, 2 replies; 6+ messages in thread
From: Viresh Kumar @ 2014-03-27 10:07 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, cpufreq, linux-pm, linux-kernel, srivatsa.bhat,
	ego, svaidy, preeti, Viresh Kumar

CPUFreq core doesn't control value of .driver_data and this field is completely
driver specific. This can contain any value and not only indexes. For most of
the drivers, which aren't using this field, its value is zero. So, printing this
from core doesn't make any sense. Don't print it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/freq_table.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index 8e54f97..f002272 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -36,8 +36,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
 		    && table[i].driver_data == CPUFREQ_BOOST_FREQ)
 			continue;
 
-		pr_debug("table entry %u: %u kHz, %u driver_data\n",
-					i, freq, table[i].driver_data);
+		pr_debug("table entry %u: %u kHz\n", i, freq);
 		if (freq < min_freq)
 			min_freq = freq;
 		if (freq > max_freq)
@@ -175,8 +174,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
 	} else
 		*index = optimal.driver_data;
 
-	pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency,
-		table[*index].driver_data);
+	pr_debug("target index is %u, freq is:%u kHz\n", *index,
+		 table[*index].frequency);
 
 	return 0;
 }
-- 
1.7.12.rc2.18.g61b472e


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

* Re: [PATCH] cpufreq: don't print value of .driver_data from core
  2014-03-27 10:07 [PATCH] cpufreq: don't print value of .driver_data from core Viresh Kumar
@ 2014-03-27 10:19 ` Srivatsa S. Bhat
  2014-03-27 10:48 ` Gautham R Shenoy
  1 sibling, 0 replies; 6+ messages in thread
From: Srivatsa S. Bhat @ 2014-03-27 10:19 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: rjw, linaro-kernel, cpufreq, linux-pm, linux-kernel, ego, svaidy,
	preeti

On 03/27/2014 03:37 PM, Viresh Kumar wrote:
> CPUFreq core doesn't control value of .driver_data and this field is completely
> driver specific. This can contain any value and not only indexes. For most of
> the drivers, which aren't using this field, its value is zero. So, printing this
> from core doesn't make any sense. Don't print it.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Regards,
Srivatsa S. Bhat

> ---
>  drivers/cpufreq/freq_table.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
> index 8e54f97..f002272 100644
> --- a/drivers/cpufreq/freq_table.c
> +++ b/drivers/cpufreq/freq_table.c
> @@ -36,8 +36,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
>  		    && table[i].driver_data == CPUFREQ_BOOST_FREQ)
>  			continue;
> 
> -		pr_debug("table entry %u: %u kHz, %u driver_data\n",
> -					i, freq, table[i].driver_data);
> +		pr_debug("table entry %u: %u kHz\n", i, freq);
>  		if (freq < min_freq)
>  			min_freq = freq;
>  		if (freq > max_freq)
> @@ -175,8 +174,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
>  	} else
>  		*index = optimal.driver_data;
> 
> -	pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency,
> -		table[*index].driver_data);
> +	pr_debug("target index is %u, freq is:%u kHz\n", *index,
> +		 table[*index].frequency);
> 
>  	return 0;
>  }
> 


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

* Re: [PATCH] cpufreq: don't print value of .driver_data from core
  2014-03-27 10:07 [PATCH] cpufreq: don't print value of .driver_data from core Viresh Kumar
  2014-03-27 10:19 ` Srivatsa S. Bhat
@ 2014-03-27 10:48 ` Gautham R Shenoy
  2014-03-27 10:59   ` Viresh Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: Gautham R Shenoy @ 2014-03-27 10:48 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: rjw, linaro-kernel, cpufreq, linux-pm, linux-kernel,
	srivatsa.bhat, ego, svaidy, preeti


On Thu, Mar 27, 2014 at 03:37:22PM +0530, Viresh Kumar wrote:
> CPUFreq core doesn't control value of .driver_data and this field is completely
> driver specific. This can contain any value and not only indexes. For most of
> the drivers, which aren't using this field, its value is zero. So, printing this
> from core doesn't make any sense. Don't print it.

So after this patch, driver_data is only going to be used by drivers
which want an "unsigned int" value to be saved along with the
frequency in the frequency_table and for those who want to overload
its interpretation to indicate BOOST.

>From the core's stand point, it is useful only for determining whether
a frequency is BOOST frequency or not. 

So, wouldn't it be logical to allow drivers maintain their own driver
data since the core is anyway not interested in it, and change this
.driver_data to "flags" or some such which can indicate boost ?

--
Thanks and Regards
gautham.

> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/freq_table.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
> index 8e54f97..f002272 100644
> --- a/drivers/cpufreq/freq_table.c
> +++ b/drivers/cpufreq/freq_table.c
> @@ -36,8 +36,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
>  		    && table[i].driver_data == CPUFREQ_BOOST_FREQ)
>  			continue;
> 
> -		pr_debug("table entry %u: %u kHz, %u driver_data\n",
> -					i, freq, table[i].driver_data);
> +		pr_debug("table entry %u: %u kHz\n", i, freq);
>  		if (freq < min_freq)
>  			min_freq = freq;
>  		if (freq > max_freq)
> @@ -175,8 +174,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
>  	} else
>  		*index = optimal.driver_data;
> 
> -	pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency,
> -		table[*index].driver_data);
> +	pr_debug("target index is %u, freq is:%u kHz\n", *index,
> +		 table[*index].frequency);
> 
>  	return 0;
>  }
> -- 
> 1.7.12.rc2.18.g61b472e
> 


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

* Re: [PATCH] cpufreq: don't print value of .driver_data from core
  2014-03-27 10:48 ` Gautham R Shenoy
@ 2014-03-27 10:59   ` Viresh Kumar
  2014-03-27 11:26     ` Gautham R Shenoy
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2014-03-27 10:59 UTC (permalink / raw)
  To: ego@linux.vnet.ibm.com
  Cc: Rafael J. Wysocki, Lists linaro-kernel, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List,
	Srivatsa S. Bhat, Vaidyanathan Srinivasan, Preeti U Murthy

On 27 March 2014 16:18, Gautham R Shenoy <ego@linux.vnet.ibm.com> wrote:
> So after this patch, driver_data is only going to be used by drivers
> which want an "unsigned int" value to be saved along with the
> frequency in the frequency_table and for those who want to overload
> its interpretation to indicate BOOST.
>
> From the core's stand point, it is useful only for determining whether
> a frequency is BOOST frequency or not.

Yes.

> So, wouldn't it be logical to allow drivers maintain their own driver
> data since the core is anyway not interested in it, and change this
> .driver_data to "flags" or some such which can indicate boost ?

We can add another field .flags in case Rafael doesn't accept the
other proposal I sent for fixing BOOST issue.

But the point behind keeping .driver_data field here was: many drivers
have some information attached to each frequency and they are closely
bound to each other. And so it made more sense to keep them together.
This is still used by many drivers and I wouldn't like them to maintain
separate arrays for keeping this information. They are so much bound
to the frequencies at the same index, that keeping them separately
wouldn't be a good idea.

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

* Re: [PATCH] cpufreq: don't print value of .driver_data from core
  2014-03-27 10:59   ` Viresh Kumar
@ 2014-03-27 11:26     ` Gautham R Shenoy
  2014-03-28  8:00       ` Lukasz Majewski
  0 siblings, 1 reply; 6+ messages in thread
From: Gautham R Shenoy @ 2014-03-27 11:26 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: ego@linux.vnet.ibm.com, Rafael J. Wysocki, Lists linaro-kernel,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List, Srivatsa S. Bhat,
	Vaidyanathan Srinivasan, Preeti U Murthy

On Thu, Mar 27, 2014 at 04:29:37PM +0530, Viresh Kumar wrote:
> On 27 March 2014 16:18, Gautham R Shenoy <ego@linux.vnet.ibm.com> wrote:
> > So after this patch, driver_data is only going to be used by drivers
> > which want an "unsigned int" value to be saved along with the
> > frequency in the frequency_table and for those who want to overload
> > its interpretation to indicate BOOST.
> >
> > From the core's stand point, it is useful only for determining whether
> > a frequency is BOOST frequency or not.
> 
> Yes.
> 
> > So, wouldn't it be logical to allow drivers maintain their own driver
> > data since the core is anyway not interested in it, and change this
> > .driver_data to "flags" or some such which can indicate boost ?
> 
> We can add another field .flags in case Rafael doesn't accept the
> other proposal I sent for fixing BOOST issue.

Even with that patch, the .driver_data won't be opaque. And that's not
good. Because, while some driver might not be explicitly setting the
value of .driver_data to 0xABABABAB, it might want to store the value
obtained at runtime into this field. And it could so happen
that at runtime this value is 0xABABABAB.

> 
> But the point behind keeping .driver_data field here was: many drivers
> have some information attached to each frequency and they are closely
> bound to each other. And so it made more sense to keep them together.
> This is still used by many drivers and I wouldn't like them to maintain
> separate arrays for keeping this information. They are so much bound
> to the frequencies at the same index, that keeping them separately
> wouldn't be a good idea.

I understand this part. However there might be more data than an
"unsigned int" that the drivers would like to be bound at the same
index. Voltage information, for instance.

> 
--
Thanks and Regards
gautham.


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

* Re: [PATCH] cpufreq: don't print value of .driver_data from core
  2014-03-27 11:26     ` Gautham R Shenoy
@ 2014-03-28  8:00       ` Lukasz Majewski
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Majewski @ 2014-03-28  8:00 UTC (permalink / raw)
  To: ego, Viresh Kumar
  Cc: Lists linaro-kernel, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Rafael J. Wysocki,
	Linux Kernel Mailing List, Srivatsa S. Bhat,
	Vaidyanathan Srinivasan, Preeti U Murthy

Hi Gautham,

> On Thu, Mar 27, 2014 at 04:29:37PM +0530, Viresh Kumar wrote:
> > On 27 March 2014 16:18, Gautham R Shenoy <ego@linux.vnet.ibm.com>
> > wrote:
> > > So after this patch, driver_data is only going to be used by
> > > drivers which want an "unsigned int" value to be saved along with
> > > the frequency in the frequency_table and for those who want to
> > > overload its interpretation to indicate BOOST.
> > >
> > > From the core's stand point, it is useful only for determining
> > > whether a frequency is BOOST frequency or not.
> > 
> > Yes.
> > 
> > > So, wouldn't it be logical to allow drivers maintain their own
> > > driver data since the core is anyway not interested in it, and
> > > change this .driver_data to "flags" or some such which can
> > > indicate boost ?
> > 
> > We can add another field .flags in case Rafael doesn't accept the
> > other proposal I sent for fixing BOOST issue.
> 
> Even with that patch, the .driver_data won't be opaque. And that's not
> good. Because, while some driver might not be explicitly setting the
> value of .driver_data to 0xABABABAB, it might want to store the value
> obtained at runtime into this field. And it could so happen
> that at runtime this value is 0xABABABAB.

The .driver_data initially stored the index of the freq_table. Even the
name was ".index" not .driver_data. The "index" name was informative
and reflected the purpose of the field. For this reason the BOOST
marker was fitted there, since BOOST is somewhat extra state.

Then the name was chaged to .drviver_data. This name indicates that
driver specific information can be stored there (in the uint32 format).

It would work if we stored there only flags (like it is now). However
Gutham proposed idea to store there the voltage value - preferably
stored as int.

For me it seems, like we are trying to mix arbitrary values and
predefined flags in one variable. In my opinion we should
split .driver_data field to two separate ones - namely .flags and
.driver_data.

Another solution, but NOT recommended by me, would be to split this
field to have 16 bits for flags (upper) and lower 16 bits for values.


> 
> > 
> > But the point behind keeping .driver_data field here was: many
> > drivers have some information attached to each frequency and they
> > are closely bound to each other. And so it made more sense to keep
> > them together. This is still used by many drivers and I wouldn't
> > like them to maintain separate arrays for keeping this information.
> > They are so much bound to the frequencies at the same index, that
> > keeping them separately wouldn't be a good idea.
> 
> I understand this part. However there might be more data than an
> "unsigned int" that the drivers would like to be bound at the same
> index. Voltage information, for instance.
> 
> > 
> --
> Thanks and Regards
> gautham.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

end of thread, other threads:[~2014-03-28  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 10:07 [PATCH] cpufreq: don't print value of .driver_data from core Viresh Kumar
2014-03-27 10:19 ` Srivatsa S. Bhat
2014-03-27 10:48 ` Gautham R Shenoy
2014-03-27 10:59   ` Viresh Kumar
2014-03-27 11:26     ` Gautham R Shenoy
2014-03-28  8:00       ` Lukasz Majewski

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).