Skip to contentSkip to conversation

2.6: use scaling_available_freqs in acpi-cpufreq-ioport driver

PATCH In review Dominik Brodowski 6 participants 13 messages Feb 20, 2004 – Mar 12, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 2.6: use scaling_available_freqs in acpi-cpufreq-ioport driver

Export an array of supported frequencies in sysfs [scaling_available_frequencies]

 arch/i386/kernel/cpu/cpufreq/acpi.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)
arch/i386/kernel/cpu/cpufreq/acpi.c +9 -1
diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/acpi.c linux/arch/i386/kernel/cpu/cpufreq/acpi.c
@@ -306,7 +306,7 @@
 			data->freq_table[i].frequency = CPUFREQ_TABLE_END;
 	}
 
-	result = cpufreq_frequency_table_cpuinfo(policy, &data->freq_table[0]);
+	result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
 	if (result) {
 		goto err_freqfree;
 	}
@@ -321,6 +321,7 @@
 			(u32) data->acpi_data.states[i].power,
 			(u32) data->acpi_data.states[i].transition_latency);
 
+	cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);
 	return_VALUE(result);
 
  err_freqfree:
@@ -345,6 +346,7 @@
 	ACPI_FUNCTION_TRACE("acpi_cpufreq_cpu_exit");
 
 	if (data) {
+		cpufreq_frequency_table_put_attr(policy->cpu);
 		acpi_io_data[policy->cpu] = NULL;
 		acpi_processor_unregister_performance(&data->acpi_data, policy->cpu);
 		kfree(data);
@@ -354,6 +356,11 @@
 }
 
 
+static struct freq_attr* acpi_cpufreq_attr[] = {
+	&cpufreq_freq_attr_scaling_available_freqs,
+	NULL,
+};
+
 static struct cpufreq_driver acpi_cpufreq_driver = {
 	.verify 	= acpi_cpufreq_verify,
 	.target 	= acpi_cpufreq_target,
@@ -361,6 +368,7 @@
 	.exit		= acpi_cpufreq_cpu_exit,
 	.name		= "acpi-cpufreq",
 	.owner		= THIS_MODULE,
+	.attr           = acpi_cpufreq_attr,
 };
#1 lore raw

Hi!

Quoted 2 lines

Export an array of supported frequencies in sysfs
[scaling_available_frequencies]

Would it be possible to export [frequency/voltage] pairs, and allow user to change it?
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#2 lore raw
Quoted 7 lines · Pavel Machek

Hi!

Quoted 2 lines

Export an array of supported frequencies in sysfs
[scaling_available_frequencies]

Would it be possible to export [frequency/voltage] pairs, and allow user to change it?

IMO, NO! While this might be a necessity for powernow-k7, the generic acpi-io driver should stay clean of such overrides et al. If you need to modify the ACPI tables, there are other ways.

Dominik

_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq

#3 lore raw

Hi!

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Export an array of supported frequencies in sysfs
[scaling_available_frequencies]

Would it be possible to export [frequency/voltage] pairs, and allow user to change it?

IMO, NO! While this might be a necessity for powernow-k7, the generic acpi-io driver should stay clean of such overrides et al. If you need to modify the ACPI tables, there are other ways.

Well, I know k7 machines that apparently needed override, and I know k8 machines that definitely need one. Buggy bioses seem to be quite common...

I do not know how buggy tables on intel machines are, but it seems to me that overrides should be generic.

[Otoh... that would need tables to contain voltages in some known units, probably milivolts. Again that would be good for printouts...]

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#4 lore raw
In reply to Pavel Machek

have a loook at the "userpace frequency governer" under 2.6.x

TMC

Quoted 25 lines · Pavel Machek

Hi!

Quoted 2 lines

Export an array of supported frequencies in sysfs
[scaling_available_frequencies]

Would it be possible to export [frequency/voltage] pairs, and allow user to change it?
Pavel

Signature · 13 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Acpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-devel
Signature · 10 lines
Tomasz M. Ciolek	
*******************************************************************************
 tmc at dreamcraft dot com dot au or tmc at goldweb dot com dot au 	
*******************************************************************************
	GPG Key ID: 0x41C4C2F0  Key available on www.pgp.net	
*******************************************************************************
  Everything falls under the law of change;	
  Like a dream, a phantom, a bubble, a shadow,
  like dew of flash of lightning.
  You should contemplate like this. 
#5 lore raw

Hi!

Quoted 1 line

have a loook at the "userpace frequency governer" under 2.6.x

That's not the same. frequency governor can select frequency *from the set provided by BIOS*. I want to override frequency/voltage table from bios.

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#6 lore raw
Quoted 8 lines · Pavel Machek

Hi!

Quoted 1 line

have a loook at the "userpace frequency governer" under 2.6.x

That's not the same. frequency governor can select frequency *from the set provided by BIOS*. I want to override frequency/voltage table from bios.

It need to be done IMO in a driver, definitely not in cpufreq core, and worst that may need to be adapted to the acpi perflib certainly (when all pending patches for will go to mainstream I guess).

For now, you can adapt with something like the powernow-k7 override patches at http://www.poupinou.org/cpufreq/powernow-k7/ if really needed.

Also, you should check that in fact the acpi perflib stuff will give you more accurate results. For the powernow-k7 case, unfortunately, it sound like that acpi perflib whereas giving good results still could be problematics for some acer IIRC due to a bad VID for one entry, and then it may be usefull for them to get the override patch merged IMO.

Cheers,

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#7 lore raw
Quoted 11 lines · Bruno Ducrot
Quoted 5 lines · Pavel Machek
Quoted 1 line

have a loook at the "userpace frequency governer" under 2.6.x

That's not the same. frequency governor can select frequency *from the set provided by BIOS*. I want to override frequency/voltage table from bios.

It need to be done IMO in a driver, definitely not in cpufreq core, and worst that may need to be adapted to the acpi perflib certainly (when all pending patches for will go to mainstream I guess).

Well, it still looks pretty generic to me. Having same code in k7 and k8 drivers does not sound right.

Anyway, lets see what happens. If acpi mostly solves it, it is not necessary.

Quoted 9 lines

For now, you can adapt with something like the powernow-k7 override patches at http://www.poupinou.org/cpufreq/powernow-k7/ if really needed.

Also, you should check that in fact the acpi perflib stuff will give you more accurate results. For the powernow-k7 case, unfortunately, it sound like that acpi perflib whereas giving good results still could be problematics for some acer IIRC due to a bad VID for one entry, and then it may be usefull for them to get the override patch merged IMO.

Hmm, if there's really only _one_ machine to fix, perhaps DMI blacklist is the right solution.
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#8 lore raw
Quoted 9 lines · Pavel Machek
Quoted 8 lines · Bruno Ducrot
Quoted 5 lines · Pavel Machek
Quoted 1 line

have a loook at the "userpace frequency governer" under 2.6.x

That's not the same. frequency governor can select frequency *from the set provided by BIOS*. I want to override frequency/voltage table from bios.

Quoted 6 lines
Quoted 3 lines

It need to be done IMO in a driver, definitely not in cpufreq core, and worst that may need to be adapted to the acpi perflib certainly (when all pending patches for will go to mainstream I guess).

Well, it still looks pretty generic to me. Having same code in k7 and k8 drivers does not sound right.

That can be shared by the two drivers if that is needed, but I don't think that part going to the cpufreq frequency tables. But I espected that powernow k7 and k8 are different beasts enough? There is no rvo, irt etc. for example in powernow-k7.

Quoted 7 lines

Anyway, lets see what happens. If acpi mostly solves it, it is not necessary.

Quoted 3 lines

For now, you can adapt with something like the powernow-k7 override patches at http://www.poupinou.org/cpufreq/powernow-k7/ if really needed.

Quoted 8 lines
Quoted 5 lines

Also, you should check that in fact the acpi perflib stuff will give you more accurate results. For the powernow-k7 case, unfortunately, it sound like that acpi perflib whereas giving good results still could be problematics for some acer IIRC due to a bad VID for one entry, and then it may be usefull for them to get the override patch merged IMO.

Hmm, if there's really only _one_ machine to fix, perhaps DMI blacklist is the right solution.

Yes, but I guess there are more though. Just that we don't get enough reports yet.

Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.
#9 lore raw
Quoted 14 lines · Pavel Machek
Quoted 13 lines · Bruno Ducrot
Quoted 11 lines · Pavel Machek
Quoted 6 lines
Quoted 2 lines

have a loook at the "userpace frequency governer" under 2.6.x

That's not the same. frequency governor can select frequency *from the set provided by BIOS*. I want to override frequency/voltage table from bios.

It need to be done IMO in a driver, definitely not in cpufreq core, and worst that may need to be adapted to the acpi perflib certainly (when all pending patches for will go to mainstream I guess).

Quoted 7 lines
Quoted 2 lines

Well, it still looks pretty generic to me. Having same code in k7 and k8 drivers does not sound right.

That can be shared by the two drivers if that is needed, but I don't think that part going to the cpufreq frequency tables. But I espected that powernow k7 and k8 are different beasts enough? There is no rvo, irt etc. for example in powernow-k7.

They are different, but like every other driver, they have table of (voltage, frequency) pairs, and that table is exactly the thing user is trying to override. [And that's probably same with all other drivers..]

As long as people don't want to change rvo, irt, etc, we should be fine.

First step in that direction would be to have voltage in milivolts in those frequency tables, so that core can print them etc... like this:

include/linux/cpufreq.h +1 -0
@@ -316,6 +316,7 @@
 	unsigned int	index;     /* any */
 	unsigned int	frequency; /* kHz - doesn't need to be in ascending
 				    * order */
+	unsigned int	voltage;   /* mV */
 };
 
 int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

A message that is not in the archive (sent off-list or not yet received): 20040301180325.GA562-I/[email protected]

#11 lore raw
Quoted 3 lines · Pavel Machek

As long as people don't want to change rvo, irt, etc, we should be fine.

Yes, probably, but in case of powernow-k7 I need to pass specifically fsb and latency. And I much prefer to do it atomic. Also I want to check that the user do not enter stupid things. For example, I requested that frequency being passed even though it's actually only here in order to check that frequency and FID being OK with something like
if (frequency != table[vid] * fsb * ...) then fail.
for each entry passed.

include/linux/cpufreq.h line 320

Quoted 11 lines

First step in that direction would be to have voltage in milivolts in those frequency tables, so that core can print them etc... like this:

include/linux/cpufreq.h +1 -0
@@ -316,6 +316,7 @@
 	unsigned int	index;     /* any */
 	unsigned int	frequency; /* kHz - doesn't need to be in ascending
 				    * order */
+	unsigned int	voltage;   /* mV */
 };

Well, why not?

Signature · 11 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
#12 lore raw
Quoted 10 lines · Bruno Ducrot

include/linux/cpufreq.h line 320

Quoted 8 lines
include/linux/cpufreq.h +1 -0
@@ -316,6 +316,7 @@
 	unsigned int	index;     /* any */
 	unsigned int	frequency; /* kHz - doesn't need to be in ascending
 				    * order */
+	unsigned int	voltage;   /* mV */
 };

Well, why not?

Four reasons:

1.) not all cpufreq drivers which use frequency table helpers know the voltage

2.) most cpufreq drivers don't need to know the voltage -- they need to know a value [==index] to be written to some sort of register [msr/io/whatever].

3.) sizeof(struct cpufreq_table_entry)

4.) the overrides discussed for k{7,8} are very driver-specific and do neither belong into the cpufreq core nor into the cpufreq frequency table helpers.

Dominik

_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq

#13 lore raw

Hi!

Quoted 16 lines · Bruno Ducrot
Quoted 10 lines

include/linux/cpufreq.h line 320

Quoted 8 lines
include/linux/cpufreq.h +1 -0
@@ -316,6 +316,7 @@
 	unsigned int	index;     /* any */
 	unsigned int	frequency; /* kHz - doesn't need to be in ascending
 				    * order */
+	unsigned int	voltage;   /* mV */
 };

Well, why not?

Four reasons:

1.) not all cpufreq drivers which use frequency table helpers know the voltage

Quoted 8 lines

2.) most cpufreq drivers don't need to know the voltage -- they need to know a value [==index] to be written to some sort of register [msr/io/whatever].

3.) sizeof(struct cpufreq_table_entry)

4.) the overrides discussed for k{7,8} are very driver-specific and do neither belong into the cpufreq core nor into the cpufreq frequency table helpers.

After seeing k7 table that contains specific parameters (settle time etc) for each state, I have to agree that what I suggested is bad idea.

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms