LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   Is there a simple solution to set the maximum freq with cpufreq_ondemand? (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/is-there-a-simple-solution-to-set-the-maximum-freq-with-cpufreq_ondemand-848947/)

whytek 12-07-2010 07:01 PM

Is there a simple solution to set the maximum freq with cpufreq_ondemand?
 
Hi all,

I have an old Gateway 7405 laptop which has an odd problem: It sometimes goes into a false thermal shutdown when the CPU clock jumps from 800MHz to 2GHz.

Although I cannot currently find the discussion thread that details this, it has something to do with a failed component on the motherboard that erroneously triggers the thermal protection due to the spike in current draw caused by the jump to 2GHz

I've used the laptop for years with another OS and a utility called RMClock to limit the max CPU clock multiplier. This worked fine and prevented the "thermal" shutdowns.

Now I have installed Slackware 13.1 64bit and discovered that it is not as easy as I thought to limit the max speed.

I'm guessing the key and maybe the easiest way to do this is to hack either the freq_table or the powernow-k8 modules to return a customised frequency table?

I haven't looked at cpu speed control in linux since a couple of years ago and I remember then that there were various methods of control, I seem to remember some kind max_cpu_speed that could be written to somewhere in the /sys tree but that seems to be gone now. It all seems to have been consolidated and simplified at the expense of configurability. This is probably a good thing, except for in bizarre cases like this one!

I will investigate further but I thought I would post here in case anyone has an insight?

Many thanks in advance.


K.

markush 12-08-2010 04:18 AM

Hello whytek and welcome to LQ,

I didn't fully understand you problem, but since I'm running Slackware as well, here the situation with my Laptop (Processor is a AMD Athlon II M320). The module powernow-k8 and the modules for the governors are all present with the Slackware-13.1 kernel. So if the module powernow-k8 is loaded you may execute
Code:

cpufreq-info
on my machine I get the following output:
Code:

markus@samsung:~$ cpufreq-info
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: powernow-k8
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 8.0 us.
  hardware limits: 800 MHz - 2.10 GHz
  available frequency steps: 2.10 GHz, 1.50 GHz, 800 MHz
  available cpufreq governors: conservative, userspace
  current policy: frequency should be within 800 MHz and 2.10 GHz.
                  The governor "conservative" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
analyzing CPU 1:
  driver: powernow-k8
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 8.0 us.
  hardware limits: 800 MHz - 2.10 GHz
  available frequency steps: 2.10 GHz, 1.50 GHz, 800 MHz
  available cpufreq governors: conservative, userspace
  current policy: frequency should be within 800 MHz and 2.10 GHz.
                  The governor "conservative" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.

I'm using the governor conservative which sets the CPU-frequency to the lowest needed.

If you want to change the settings at runtime, please look at the manpage of cpufreq-set
Code:

man cpufreq-set
You may use the following command (as an example)
Code:

cpufreq-set -c 0 -g powersave
in order to change the governor for CPU 0 to powersave. There are options which allow to set the maximum and minimum frequency (I never tried that, but it looks like this may meet your requirements).

I have edited the file /etc/rc.d/rc.modules in order to set the governor to conservative when the system starts, but there are other ways to manage this.

Markus

whytek 12-08-2010 09:38 PM

Markus, thank you very much for the welcome and the reply.

I somehow completely missed the the -d and -u paramaters to cpufreq-set. I suppose because I was looking to control this via /sys..


You are absolutely correct, one solution is to issue
cpufreq-set -g ondemand -d 800MHz -u 1600MHz

This allows me to use the ondemand driver but prevents switching to 2GHz

After doing this, this is the output from cpufreq-info:

driver: powernow-k8
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 134 us.
hardware limits: 800 MHz - 2.00 GHz
available frequency steps: 2.00 GHz, 1.60 GHz, 800 MHz
available cpufreq governors: ondemand, userspace
current policy: frequency should be within 800 MHz and 1.60 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 800 MHz (asserted by call to hardware).


I suppose this will do for the moment, it would be nice to be able to play around with faster speeds while avoiding 2GHz just to see what I can get out of it, but as I understand from a bit of net searching, the three speeds in this case 800, 1.6 and 2G are following specs that the driver is required to follow by AMD.

As you say you didn't fully understand the problem, let me just recap and put it very simply:

The motherboard is broken, but it works fine as long as the CPU is not allowed run at 2GHz
Switching to 2GHz results in instant thermal panic and the laptop powers off within 5 seconds.

Thanks!

k.

markush 12-09-2010 02:05 AM

Hi,

I think that frequencies other than those mentioned by cpufreq-info aren't possible. At least not with the userspace sotware, maybe one can change settings in the bios of the machine. And I don't believe that this other frequencies will be available by means of changes in the powernow-k8 module (as you stated in your first post).

Markus

whytek 12-09-2010 01:36 PM

Hmm, yes, the control available via cpufreq seems to be rather limited (and safe), and as I said this is probably a good thing.

However, I do wonder.. powernow-k8 on load displays:

powernow-k8: Found 1 Mobile AMD Athlon(tm) 64 Processor 3200+ processors (1 cpu cores) (version 2.20.00)
powernow-k8: 0 : fid 0xc (2000 MHz), vid 0x6
powernow-k8: 1 : fid 0x8 (1600 MHz), vid 0xe
powernow-k8: 2 : fid 0x0 (800 MHz), vid 0x18

As I understand, there are various restrictions imposed by official AMD specs on the generation of this FID/VID table and they could be relaxed. I'd have to read up on that though.

Anyway, I guess this is getting off topic. You answered my original question by pointing out those params -d and -u that I overlooked. The machine doesn't shutdown, so thanks again for that.

Simple problem, simple solution, I'm marking the thread solved.
Maybe some other time I'll come back to trying to squeeze a few Hz more out of an old CPU.
Then again, maybe not. :)

k.

markush 12-09-2010 03:14 PM

Yes, you're right, your question is answered.
If you need more information about the powernow-k8 module, I'd recommend to open a new thread in the programmingforum http://www.linuxquestions.org/questions/programming-9/ or in the Software->Kernelforum http://www.linuxquestions.org/questi...nux-kernel-70/

Markus


All times are GMT -5. The time now is 10:24 PM.