Re: cpufreq doesn't seem to work in Intel Q9300

Previous thread: Opteron Rev E has a bug ... a locked instruction doesn't act as a read-acquire barrier by Arkadiusz Miskiewicz on Sunday, August 3, 2008 - 2:06 am. (5 messages)

Next thread: [2.6.26.1] And one very confused mouse! by Chris Rankin on Sunday, August 3, 2008 - 4:57 am. (1 message)
From: S K
Date: Sunday, August 3, 2008 - 3:00 am

Hi,

  I have an Intel Core 2 Quad and running kernel
2.6.25.11-97.fc9.i686. cpufreq doesn't seem to work. The cpufreq
scaling monitor in Gnome says CPU Freq scaling is not supported in my
CPU. The CPU can run at 2.0 and 2.5 GHz but mine always runs at 2.5
GHz in Linux.

So I checked  /sys and there is no cpufreq dir in /sys/...

# ls /sys/devices/system/cpu/
cpu0  cpu1  cpu2  cpu3  cpuidle  sched_mc_power_savings
# ls /sys/devices/system/cpu/cpuidle/
current_driver  current_governor_ro

I have no clue what cpuidle directory is for.

I added cpufreq.debug=7 in kernel boot params and saw the following in
the dmesg:

speedstep-smi: No supported Intel CPU detected.
cpufreq-core: CPU 0: _PPC is 0 - frequency not limited
cpufreq-core: CPU 3: _PPC is 0 - frequency not limited
cpufreq-core: CPU 1: _PPC is 0 - frequency not limited
cpufreq-core: CPU 2: _PPC is 0 - frequency not limited
cpuidle: using governor ladder
cpuidle: using governor menu

I looked at arch/x86/kernel/cpu/cpufreq/speedstep-smi.c and it seems
to detect only Pentium IIIs.

Anyone know what files have the cpufreq code for Intel Core 2?
Does cpufreq support Intel Core 2 Quads? Especially the Q9300? If not,
anything I can do to help?

Thanks,
SK

# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Core(TM)2 Quad  CPU   Q9300  @ 2.50GHz
stepping	: 7
cpu MHz		: 2502.516
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 4
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm
constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx smx est tm2
ssse3 cx16 xtpr sse4_1 lahf_lm
bogomips	: 5015.23
clflush size	: 64
<snipped the rest> - shows 3 more similar sections.
--

From: none
Date: Sunday, August 3, 2008 - 3:31 am

I have an Intel Core 2 Duo and it uses the ACPI cpufreq driver; your
Quad should do the same.  So this is likely an ACPI/BIOS issue.

If you ask ACPI people they will ask you to post the output of acpidump.
Also you should probably check if you have a BIOS option that needs to be
enabled for this to work.

BTW, cpuidle is something quite different, it is about how to save power 
when CPU is doing nothing (i.e. idle :-).  Cpu frequency scaling is how to
save power when CPU is working (but doesn't need to run flat out).

Alan
--

From: S K
Date: Sunday, August 3, 2008 - 10:06 pm

Hi,

  I'm attaching the acpidump output. Can someone (ACPI guys??) please
me help figure this out?
Is there any other info that's needed to debug this?

I can be a tester for this and even do some development within the
limits of my understanding.

Thanks,
SK

From: S K
Date: Thursday, August 7, 2008 - 2:35 am

Anyone care to help?

-SK

--

From: Zhao Yakui
Date: Thursday, August 7, 2008 - 6:32 pm

Will you please confirm whether the acpi_cpufreq driver is used on your
machine?
Please enable CONFIG_CPUFREQ_DEBUG in kernel configuration and boot the
system with "cpufreq.debug=7".
After the system is booted, please attach the output of dmesg.

please attach the output of acpidump using the latest pmtools at
  http://www.lesswatts.org/patches/linux_acpi/ 

Of course you can open a new bug in bugzilla and attach the output of
dmesg, acpidump, lspci -vxxx.

http://bugzilla.kernel.org/enter_bug.cgi?product=ACPI


--

From: S K
Date: Thursday, August 7, 2008 - 9:53 pm

Hi,

I already did the cpufreq.debug thing and it was using the
smi_speedstep driver instread of the acpi_speedstep (or whatever is
the right name).

Alan already told me this is likely an ACPI issue. So, I already sent
the acpidump in a prev email (Aug 3rd 08). I'm don't have access to my
home machine right now. Will send it again later if you can't get my
prev email from the archives.

Is lspci output needed for this?

Thanks,
SK

--

From: Alan Jenkins
Date: Friday, August 8, 2008 - 1:41 am

I could be completely wrong though!

I'd not heard of speedstep_smi before (now I look, it doesn't seem to be
an option in the cpu frequency scaling Kconfig menu?).

I assumed the error messages you had about SMI were just flack.  I
thought  acpi-cpufreq was the only option on recent machines - and that
a quad core  probably counts as recent.  The error messages could be due
to Fedora scripts unconditionally loading several different modules, to
find one that works.

I'm not sure how you can answer Zhao's question if you don't already
know.  I expect Fedora C7 does try loading acpi_cpufreq (as well as
speedstep_smi).  Whether your machine actually supports acpi_cpufreq is
the question we're trying to answer.  (This is where looking at Windows,
or BIOS settings, would help).

Alan
--

From: S K
Date: Friday, August 8, 2008 - 3:10 am

On Fri, Aug 8, 2008 at 1:41 AM, Alan Jenkins

My machine has acpi-cpufreq module, but when I try to load it, I get:
FATAL: Error inserting acpi_cpufreq
(/lib/modules/2.6.25.11-97.fc9.i686/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko):
No such device

Btw, yes, cpu freq scaling works in Windows XP. What should I look for
in Windows?

I build my own system, so I have gone through my system BIOS several
times and don't remember anything related to freq scaling. But I will
check again.

Btw, my machine is a Shuttle SG33G5. It has other issues too but right
now heat is the biggest concern.

Thanks,
SK
--

From: S K
Date: Friday, August 8, 2008 - 3:43 am

There is a "PPM mode" option which has possible values:
Native - Native mode is for fully support ACPI OS (ex. Win XP, Vista)
SMM - SMM mode is for legacy OS (ex. Win 2k)

Setting it to SMM didn't help. Gave the same error for acpi_cpufreq.

Btw, you were right about FC trying all the module, but it apparently
tried only speedstep modules for some reason. It's clear from my
dmesg.txt that all the speedstep modules are attempted.

Forgot one obvious thing when I ran dmesg -- forgot to run it after
trying modprobe acpi_cpufreq.
This is what I get when I do that:

acpi-cpufreq: acpi_cpufreq_init
acpi-cpufreq: acpi_cpufreq_early_init
cpufreq-core: trying to register driver acpi-cpufreq
cpufreq-core: adding CPU 0
acpi-cpufreq: acpi_cpufreq_cpu_init
cpufreq-core: initialization failed
cpufreq-core: adding CPU 1
acpi-cpufreq: acpi_cpufreq_cpu_init
cpufreq-core: initialization failed
cpufreq-core: adding CPU 2
acpi-cpufreq: acpi_cpufreq_cpu_init
cpufreq-core: initialization failed
cpufreq-core: adding CPU 3
acpi-cpufreq: acpi_cpufreq_cpu_init
cpufreq-core: initialization failed
cpufreq-core: no CPU initialized for driver acpi-cpufreq
cpufreq-core: unregistering CPU 0
cpufreq-core: unregistering CPU 1
cpufreq-core: unregistering CPU 2
cpufreq-core: unregistering CPU 3

Attaching the files I sent to Zaho so others can look at it too.

Thanks,
SK
--

From: Thomas Renninger
Date: Friday, August 8, 2008 - 5:30 am

Try updating the BIOS.
I expect your CPU is too new and the BIOS cannot export the correct freq 
values for the specific CPU yet.

      Thomas
--

From: S K
Date: Friday, August 8, 2008 - 11:23 am

The BIOS is already at the latest version :( Is the above comment the
only possible reason for the issue?

-SK
P.S: Thoman, I initially replied only to you. Sorry for the double email.
--

From: Thomas Renninger
Date: Saturday, August 9, 2008 - 11:59 am

It is very likely.

your BIOS does not export basic CPU freq data. The only way to get cpufreq 
working on latest Intel HW is through ACPI and acpi-cpufreq driver.

It may happen that above functions are somewhat hidden in SSDT tables but 
loading and finding the CPU freq functions generally works quite well.

Mark Langsdorf reported some acpi breakage in .27-rc1, this could also be the 
reason.

That a BIOS update is needed for latest CPUs is common. I expect your machine 
is rather new?

There also is a cpufreq list which moved recently, the latest one you should 
post to is this one:
cpufreq@vger.kernel.org

       Thomas
--

From: Thomas Renninger
Date: Saturday, August 9, 2008 - 12:30 pm

Hi,

just that in case you try out kernels...

----------

So it's rc2 not rc1, but AFAIK your report should be older than rc2.

There also was a similar report from Laurence Darby <ldarby@tuffmail.com>.
He still posted on the old cpufreq list.
Subject: Core 2 Duo E8400 stepping 6 not recognised

A BIOS update helped.
You may be able to google this out and compare his CPU_FREQ_DEBUG logs.

      Thomas
--

From: S K
Date: Sunday, August 10, 2008 - 1:28 am

But Windows XP is able to do the scaling properly. So how can it be a
BIOS issue? While reading about the Foxconn BIOS fiasco that happened
recently a kernel dev (forgot his name) stated that Linux tries to
emulate Windows for ACPI operations.

So I'm guessing this is a kernel bug.

-SK
--

From: Zhao Yakui
Date: Sunday, August 10, 2008 - 6:33 pm

_PCT,_PSS, _PPC. So acpi_cpufreq driver can't be used on your machine.
This is a BIOS issue. 

But it is very strange that cpufreq scaling can work on Windows XP.
Will you please try the P4 clock cpufreq driver and see whether the
scaling can work ? In fact P4 clock cpufreq driver is already replaced
by acpi_cpufreq driver for the latest cpu. 
Anyway please try p4 clock cpufreq driver.


--

From: S K
Date: Sunday, August 10, 2008 - 9:44 pm

What is the name of the driver? I'm not able to find any such driver
in Fedora 9 installed modules. There is only acpi-cpufreq and powernow-k8.

Also, If someone doesn't mind, can they tell me what all files I need to
replace in Fedora 9 once I get a kernel.org kernel compiled? I know
how to edit grub.conf,
and that I should replace vmlinuz, but do I need to replace initrd too?

Thanks,
SK
--

From: Zhao Yakui
Date: Sunday, August 10, 2008 - 10:24 pm

Yes. There is no definition of _PSS,_PCT,_PPC in DSDT table, which are
required by acpi_cpufreq driver.At the same time there is no extra SSDT
The driver is P4-clockmod, which is located in the directory of
Maybe you should enable "CONFIG_X86_P4_CLOCKMOD" in kernel configuration
and compile a new kernel.

--

From: S K
Date: Sunday, August 10, 2008 - 10:24 pm

So what's the significance of "no extra SSDT table"? Does that mean that XP

Thanks. I just looked at the kernel.org kernel (what's the term used
in lkml for this?) and found out the switch.
I got the kernel.org kernel compiled with the .config used for the F9
kernel. Now I need figure out how to get it to boot.

Btw, on your suggestion, I opened a bug for this issue.
http://bugzilla.kernel.org/show_bug.cgi?id=11299

Does the LKML community consider the Fedora 9 kernels as too different?
I would prefer using the F9 kernel for testing this issue since it's
easier for me to compile and install.

I got some important stuff to deal with for the next couple of days.
So I will get back on this thread in 2-4 days.

Thanks,
SK
--

From: Andi Kleen
Date: Monday, August 11, 2008 - 3:55 am

It sounds like the BIOS just doesn't support frequency scaling. 
Perhaps it's disabled in the BIOS setup. Or the system doesn't
support it at all. 

If he can't find an option to enable it there he'll have to update it
and if there is no update he's out of luck.


Using p4 clockmod doesn't make sense because it doesn't really
safe any power and is often very slow.

--

From: S K
Date: Monday, August 11, 2008 - 6:15 am

It works in Windows XP, so I'm not sure if it's only a BIOS issue.
If it's not that simple, then care to impart some knowledge?

Thanks,
SK
--

From: Andi Kleen
Date: Monday, August 11, 2008 - 6:23 am

On Windows platform drivers sometimes provide a replacement DSDT
that might enable cpufreq. If that's the case there's nothing
we can do really on the Linux side. You might be able to extract
that DSDT from somewhere and supply it to Linux as a replacement

If you can't get your BIOS to provide the necessary methods
then useful Linux cpufreq won't work. It's that simple.
p4-clockmod aka throttling might work, but it doesn't actually
save energy and often causes severe performance problems.

-Andi

--

From: S K
Date: Monday, August 11, 2008 - 10:43 pm

Wow! Didn't mean to start a "tech war" here (point's at the long

I don't remember installing any special driver for Windows XP.
Since you claim that as a possibility, is there something that I can look
for to check if this is the case?

The reason I'm questioning this so much is because I plan to contact
Shuttle tech support and try to get them to fix this if it really is a BIOS
issue. But I need valid points to make sure they don't pass on the
blame and slip away. They do seem to release BIOS updates now and then

I definitely don't want to use anything that will have a drastic
effect on performance.

Thanks,
SK
--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 4:22 am

On Sun, 10 Aug 2008 21:44:50 -0700

yeah don't bother with p4-clockmod, it's not something that saves you
energy... it only gives you a fake feeling that you would.

-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Alexey Dobriyan
Date: Monday, August 11, 2008 - 4:38 am

Why it is still in tree?

It's likely that you'll waste more time explaining everybody to not use
p4-clockmod than send a patch.

--

From: Matthew Garrett
Date: Monday, August 11, 2008 - 4:53 am

Because it's useful for thermal throttling on hardware that doesn't 
implement voltage scaling.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
--

From: Adrian Bunk
Date: Monday, August 11, 2008 - 7:02 am

This statement is only true for HPC environments and when you measure 
Watts per work done.

But if you have some desktop or server with a load that is determined by 
when it gets used, then p4-clockmod can actually save energy when the 
computer is not under high load or even idle.

Or do I miss anything?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--

From: Matthew Garrett
Date: Monday, August 11, 2008 - 7:07 am

On modern hardware, the C states will win you more than downclocking the 
processor would.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 7:12 am

On Mon, 11 Aug 2008 15:07:34 +0100

actually.. p4_clockmod is *NOT* downclocking the processor.. that's the
whole problem with it..



-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 7:11 am

On Mon, 11 Aug 2008 17:02:06 +0300

yes you're missing quite a few things...
lets build this up

1) when the cpu is idle (as in "idle loop C states/hlt"; p4_clockmod
doesn't mean anything.. the clock is stopped not just skipped.
2) when the cpu is executing code (eg non-idle), it takes more power
for a unit of time than it takes when it's idle
3) when the cpu is in thermal throttle (p4_clockmod) and does a
throttle cycle, it'll take less power for that cycle than a full
execution (at least of the power intensive type of instruction), but
more than if it would have been in idle.

now lets take your "Light load" example (light could mean anything less
than 100% cpu use for all I care) and lets assume a 50% throttle (just
because it makes the explenation simpler, not fundamental)

in 50% thermal throttle, after every cycle a throttle cycle is
inserted, this means that code that gets executed will take 2x as long
basically.

take your lightly loaded case, and lets say you have 20% CPU
utilization in the unthrottled case (again, random number, works with
any number). Now with the thermal throttle, you suddenly take 40%.

so before you had for one second "20% expensive, 80% low power" 
now you have for one second "20% expensive, 20% throttle power, 60% low
power"

since throttle power is higher than low/idle power.. you lose.

-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Adrian Bunk
Date: Monday, August 11, 2008 - 9:03 am

So what is the intended use case?

Is it for people who bought an Intel Heating 4 but forgot to buy an 
appropriate cooling?

That sounds absurd.

There must be a reason why Intels CPUs support this throttling?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 9:20 am

On Mon, 11 Aug 2008 19:03:46 +0300

it's thermal throttling.
To forcefully reduce the number of cycles that have the full "execute"


yes there is.. for cases where there is overtemperature. Think of it as
the emergency break in the subway. You really don't want to use it but
when you need it you're glad it's there.


-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Adrian Bunk
Date: Monday, August 11, 2008 - 9:28 am

But this only helps when the cooling is working but not good enough,
for the classic "fan broken" case it won't cool down enough.

Does the Pentium 4 predate CPUs that shutdown when becoming too hot
(I experienced such a shutdown recently on my Athlon...)?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 9:44 am

On Mon, 11 Aug 2008 19:28:39 +0300

I would call this an unclassified statement for which you have no data

thermal shutdown is the last measure for sure (and it's in cpus yes)...
but sysadmins frown on that.. before you go down that path there's
various things that happen first (thermal throttle being one of them)


-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Adrian Bunk
Date: Tuesday, August 12, 2008 - 12:27 pm

Sorry, I was a bit too surprised after your description.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--

From: Dominik Brodowski
Date: Monday, August 11, 2008 - 12:33 pm

Hi,


This statement might be true, but might also be wrong:
	a) on systems where only C1 is exported, p4-clockmod most often
	   equals the state the CPU is in when in C1[*], so we're in a 
	   win-win, or lose-lose situation.
	b) IIRC 50% throttling is not "execute-one-statement
	   skip-one-statement execute-one-statement, etc." but instead
	   work for N us, skip for N us, work for N us, etc. Therefore,
	   the situation is a bit more compilcated.

Still, I agree that p4-clockmod is useful mostly in corner cases (and for
developing the cpufreq infrastructure in the first case, but that's another
story)

[*] or C2 even?

Best,
	Dominik
--

From: Arjan van de Ven
Date: Monday, August 11, 2008 - 4:58 pm

On Mon, 11 Aug 2008 21:33:17 +0200


even if it were EXACTLY identical (which it isn't).. you would be at

doesn't change the fundamental math though.


-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Dominik Brodowski
Date: Tuesday, August 12, 2008 - 12:03 pm

Hi Arjan,


well, the spec isn't really clear about this. It says (IA32 Intel
Architecture Software Developer's Manual, Volume 3, section 13.14.3) that
P6 family processors did this using STPCLK#. And STPCLK# was also used by the
chipset to force the CPU to enter C2, IIRC.
Do P4s only do an C1-equivalent (or even less than that) now, as they do the

If it's C2-equivalent vs. C1, it's a win. So throttling would be a win from
this perspective on a only C1-capable PIII, but not on a P4? Is that what
you're trying to hint at here?

To summarize:

(1) p6 family processors use STPCLK# initiated by the chipset for thermal
    throttling.
(2) STPCLK# is also used by the chipset to make the CPU enter C2.
(3) p4-clockmod uses the STPCLK#-equivalent in p4 CPUs.
(4) Therefore, it is as effective as STPCLK#, and as effective as C2.
(5) STPCLK#/C2 has higher energy savings than hlt/C1.
(6) therefore, p4-clockmod might make sense on systems which only export C1
    as an idle state.

Where's my mistake?

Thanks,
	Dominik
--

From: Arjan van de Ven
Date: Tuesday, August 12, 2008 - 12:59 pm

On Tue, 12 Aug 2008 21:03:02 +0200

not quite.. if it does for a certain cpu, then it's only for cpus that

it's basically always less (or really best case equal) than c1 just due


not even on PIII is it a win.. it's just too short a duration 


This is not correct. C2 is only effective if you stay in it "long

incorrect



-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--

From: Alan Jenkins
Date: Thursday, August 7, 2008 - 12:24 pm

Please don't top-post!

According to the online ACPI spec, the BIOS should expose _PCT, _PSS and PPC objects if it supports multiple CPU performance states (aka P-states, cpufreq).  I ran your acpidump.txt through acpixtract to generate the DSDT, and decompiled it using iasl.  It did not contain any of _PCT, _PSS and _PPC.

Again, it is possible this is an option in your BIOS which is currently disabled.  You need to go into your BIOS setup screen and see if you can find any relevant options.

If possible, find out whether cpu frequency scaling works in windows.  If it doesn't work in windows, it's very unlikely to work on linux.  Linux ACPI aims for bug-for-bug compatibility with Windows, which is what manufacturers test their product against.

There may be other possibilities.  Your acpidump output did not appear to include a SSDT, which is another place these objects might be found.  My computer suffered from a bug where linux could not find the SSDT (<http://bugzilla.kernel.org/show_bug.cgi?id=8630>).  This bug was relatively simple and was fixed.  However there might be something similar going on.  IIRC from last time, SSDTs or similar can also be loaded dynamically by the AML code in the DSDT, so maybe something goes wrong there.

Regards
Alan

--

Previous thread: Opteron Rev E has a bug ... a locked instruction doesn't act as a read-acquire barrier by Arkadiusz Miskiewicz on Sunday, August 3, 2008 - 2:06 am. (5 messages)

Next thread: [2.6.26.1] And one very confused mouse! by Chris Rankin on Sunday, August 3, 2008 - 4:57 am. (1 message)