powersaved is backwards on my machine...
[just being clear, I am an AMD employee, though I am writing for
myself at the moment]
Greetings,
Maybe this is a FAQ of some sort, but I couldn't find it with the searches I tried, so I'm sending it here to know what the right thing to do is...
I have an AMD machine which, when I enabled the powernow-k8 module and powersaved, sets the power states opposite of what they should be.
I.e. when the machine is unloaded, it runs at the highest clock speed/ power state, and which the machine is loaded, it runs at the lowest clock speed/power state.
I looked at the code a bit, and figured out the root causes:
-- My old machine does not have correct ACPI power-state tables, so
I disabled that. (no, I can't get a BIOS update, sigh)
-- It *does* have a functioning old Athlon64 PSB BIOS interface. -- powernow-k8 reports PSB-based power-states in ascending order
instead of descending order like ACPI.
-- powersaved assumes that the cpufreq interface will always
report the power-states in descending order.
Fixing either cpufreq to report them always in descending order, or powersaved to not assume it is in descending order is possebl... but the question is what the cpufreq interface *should* support.
So, I could not find any documentation on cpufreq that claimed the frequency states listed should be in any particular order, but maybe I was just not looking in the right place for the documentation...
--
Erich Stefan Boleyn <[email protected]> http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"
Hi,
Quoted 3 lines · Erich Boleyn
So, I could not find any documentation on cpufreq that claimed the frequency states listed should be in any particular order, but maybe I was just not looking in the right place for the documentation...
There's no such documentation that I'm aware of :) and I don't see why we should enforce any particular order here. So I'd say fixing powernowd is the right approach here.
Thanks for debugging this!
Dominik
Quoted 10 lines · Dominik Brodowski
Hi,
Quoted 3 lines · Erich Boleyn
So, I could not find any documentation on cpufreq that claimed the frequency states listed should be in any particular order, but maybe I was just not looking in the right place for the documentation...
There's no such documentation that I'm aware of :) and I don't see why we should enforce any particular order here. So I'd say fixing powernowd is the right approach here.
Ok, so I will fix powersaved to sort the values after reading them from scaling_avaialable_frequencies because I can't even assume that they are in any particular order, neither descending nor ascending.
Regards,
Holger
Quoted 8 lines · Holger Macht
Quoted 7 lines · Dominik Brodowski
Hi,
Quoted 3 lines · Erich Boleyn
So, I could not find any documentation on cpufreq that claimed the frequency states listed should be in any particular order, but maybe I was just not looking in the right place for the documentation...
Quoted 7 lines
Quoted 3 lines
There's no such documentation that I'm aware of :) and I don't see why we should enforce any particular order here. So I'd say fixing powernowd is the right approach here.
Ok, so I will fix powersaved to sort the values after reading them from
scaling_avaialable_frequenciesbecause I can't even assume that they are in any particular order, neither descending nor ascending.
I had come to that conclusion as well, and made a tiny patch which did a "qsort" on the values involved as a quick and dirty solution.
daemon/cpufreq_userspace.cpp +8 -0
@@ -24,6 +24,7 @@ #include <sstream> #include <cpufreq.h> +#include <stdlib.h> #include "cpufreq_interface.h" #include "globals.h"
@@ -328,6 +329,10 @@ } #endif +static int myqsortcmp(const void *a, const void *b) +{ + return (*(unsigned*)b) - (*(unsigned*)a); +} int CPUFreq_Userspace::initFreqsViaFile() {
@@ -351,6 +356,9 @@ } } + // Sort frequencies + qsort(&_speeds_kHz[0], speed_no, sizeof(unsigned), myqsortcmp); + _speeds_kHz[speed_no + 1] = 0; _last_step = speed_no;
--
Erich Stefan Boleyn <[email protected]> http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"
_______________________________________________
Cpufreq mailing list
[email protected]
http://lists.linux.org.uk/mailman/listinfo/cpufreq