2004-10-26 21:32:44

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: [PATCH] Add p4-clockmod driver in x86-64


Add links for p4-clockmod driver in x86-64 cpufreq.

Signed-off-by:: "Venkatesh Pallipadi" <[email protected]>

--- linux-2.6.9/arch/x86_64/kernel/cpufreq/Makefile.org 2004-10-25 16:00:03.000000000 -0700
+++ linux-2.6.9/arch/x86_64/kernel/cpufreq/Makefile 2004-10-25 16:10:30.000000000 -0700
@@ -7,7 +7,11 @@ SRCDIR := ../../../i386/kernel/cpu/cpufr
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi.o
+obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o
+obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o

powernow-k8-objs := ${SRCDIR}/powernow-k8.o
speedstep-centrino-objs := ${SRCDIR}/speedstep-centrino.o
acpi-objs := ${SRCDIR}/acpi.o
+p4-clockmod-objs := ${SRCDIR}/p4-clockmod.o
+speedstep-lib-objs := ${SRCDIR}/speedstep-lib.o
--- linux-2.6.9/arch/x86_64/kernel/cpufreq/Kconfig.org 2004-10-25 16:00:08.000000000 -0700
+++ linux-2.6.9/arch/x86_64/kernel/cpufreq/Kconfig 2004-10-25 16:09:29.000000000 -0700
@@ -94,5 +94,23 @@ config X86_ACPI_CPUFREQ_PROC_INTF

If in doubt, say N.

+config X86_P4_CLOCKMOD
+ tristate "Intel Pentium 4 clock modulation"
+ depends on CPU_FREQ_TABLE
+ help
+ This adds the CPUFreq driver for Intel Pentium 4 / XEON
+ processors.
+
+ For details, take a look at <file:Documentation/cpu-freq/>.
+
+ If in doubt, say N.
+
+
+config X86_SPEEDSTEP_LIB
+ tristate
+ depends on (X86_P4_CLOCKMOD)
+ default (X86_P4_CLOCKMOD)
+
+
endmenu


2004-10-27 03:20:34

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Tue, Oct 26, 2004 at 02:28:26PM -0700, Venkatesh Pallipadi wrote:
>
> Add links for p4-clockmod driver in x86-64 cpufreq.

Does this really make sense? I thought all shipping EM64T capable CPUs
supported DBS? Why would you want clock modulation when you have DBS?

My own experience is that the clockmod driver is not very usable,
it leads to extensive delays on a graphical desktop.

-Andi

2004-10-27 14:43:35

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: RE: [PATCH] Add p4-clockmod driver in x86-64

>-----Original Message-----
>From: Andi Kleen [mailto:[email protected]]
>Sent: Tuesday, October 26, 2004 8:18 PM
>To: Pallipadi, Venkatesh
>Cc: [email protected]; [email protected]; [email protected]
>Subject: Re: [PATCH] Add p4-clockmod driver in x86-64
>
>On Tue, Oct 26, 2004 at 02:28:26PM -0700, Venkatesh Pallipadi wrote:
>>
>> Add links for p4-clockmod driver in x86-64 cpufreq.
>
>Does this really make sense? I thought all shipping EM64T capable CPUs
>supported DBS? Why would you want clock modulation when you have DBS?
>
>My own experience is that the clockmod driver is not very usable,
>it leads to extensive delays on a graphical desktop.
>

Yes. Clock modulation is not as useful compared to enhanced speedstep.
But,
I feel, it should be OK to have the driver, though it is not really
useful
in common case. It may be useful in some exceptional cases.

The particular case where someone wanted to use p4-clockmod was: they
wanted to run the CPU as slow as possible. Enhanced speedstep allows few

(2-3) possible freqs on this CPU. But, p4-clockmod allows as low as
12.5%
actual freq.

So, I think, it is good to have this module for the users who really
want
to use it. But I don't think any userspace or kernel governor should use

this driver by default, without user knowledge. That can cause extensive

delays and slow response times.

Thanks,
Venki


2004-10-27 14:59:22

by Paulo Marques

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

Pallipadi, Venkatesh wrote:
>>....
> Yes. Clock modulation is not as useful compared to enhanced speedstep.
> But,
> I feel, it should be OK to have the driver, though it is not really
> useful
> in common case. It may be useful in some exceptional cases.

I think I have one of such cases.

I am one of the members of the robotic soccer team from the University
of Oporto, and a couple of months ago we were looking for new
motherboards for our robots, because we are starting to need new
hardware (on-board lan, usb2.0, etc.).

We really don't need excepcional performance, but we really, really need
low power consumption, so lowering the clock on a standard mainboard
seemed to be the best cost/performance scenario.

Could this driver be used to keep a standard p4 processor at say 25%
clock speed at all times?

--
Paulo Marques - http://www.grupopie.com

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)

2004-10-27 15:57:23

by Lee Revell

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Wed, 2004-10-27 at 15:59 +0100, Paulo Marques wrote:
> I am one of the members of the robotic soccer team from the University
> of Oporto, and a couple of months ago we were looking for new
> motherboards for our robots, because we are starting to need new
> hardware (on-board lan, usb2.0, etc.).
>
> We really don't need excepcional performance, but we really, really need
> low power consumption, so lowering the clock on a standard mainboard
> seemed to be the best cost/performance scenario.
>
> Could this driver be used to keep a standard p4 processor at say 25%
> clock speed at all times?
>

Why don't you try the VIA EPIA mini-ITX boards? These are designed for
low power applications like yours. I am running the M-6000 which has a
fanless 600Mhz C3 processor, the newer fanless models run at 1Ghz. And,
on top of that they support speed scaling so you can slow it down even
more.

Lee

2004-10-27 16:16:30

by Paulo Marques

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

Lee Revell wrote:
> On Wed, 2004-10-27 at 15:59 +0100, Paulo Marques wrote:
>
>>I am one of the members of the robotic soccer team from the University
>>of Oporto, and a couple of months ago we were looking for new
>>motherboards for our robots, because we are starting to need new
>>hardware (on-board lan, usb2.0, etc.).
>>
>>We really don't need excepcional performance, but we really, really need
>>low power consumption, so lowering the clock on a standard mainboard
>>seemed to be the best cost/performance scenario.
>>
>>Could this driver be used to keep a standard p4 processor at say 25%
>>clock speed at all times?
>>
>
>
> Why don't you try the VIA EPIA mini-ITX boards? These are designed for
> low power applications like yours. I am running the M-6000 which has a
> fanless 600Mhz C3 processor, the newer fanless models run at 1Ghz. And,
> on top of that they support speed scaling so you can slow it down even
> more.

Yes, we tried those, but floating point calculations completely kill the
performance on those boards.

Even at 25% speed a P4 2.8GHz gives a 700MHz clock which completely
toasts a 600MHz (or even a 1GHz) C3 in floating point calculations... :(

Even more, I can get a Asus mainboard with integrated VGA, LAN, USB,
Audio, for half the price of a VIA EPIA mini-ITX with comparable integer
performance. As we always have to buy these things in quantities of 5,
this can make some difference.

--
Paulo Marques - http://www.grupopie.com

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)

2004-10-27 16:47:12

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: RE: [PATCH] Add p4-clockmod driver in x86-64

>-----Original Message-----
>From: Paulo Marques [mailto:[email protected]]
>Sent: Wednesday, October 27, 2004 7:59 AM
>To: Pallipadi, Venkatesh
>Cc: Andi Kleen; [email protected]; [email protected]
>Subject: Re: [PATCH] Add p4-clockmod driver in x86-64
>
>Pallipadi, Venkatesh wrote:
>>>....
>> Yes. Clock modulation is not as useful compared to enhanced
>speedstep.
>> But,
>> I feel, it should be OK to have the driver, though it is not really
>> useful
>> in common case. It may be useful in some exceptional cases.
>
>I think I have one of such cases.
>
>I am one of the members of the robotic soccer team from the University
>of Oporto, and a couple of months ago we were looking for new
>motherboards for our robots, because we are starting to need new
>hardware (on-board lan, usb2.0, etc.).
>
>We really don't need excepcional performance, but we really,
>really need
>low power consumption, so lowering the clock on a standard mainboard
>seemed to be the best cost/performance scenario.
>
>Could this driver be used to keep a standard p4 processor at say 25%
>clock speed at all times?
>

Yes and No.

No because, AFAIK p4-clockmod doesn't give a lot of direct power
savings.
You can still get some indirect power savings from cooling perspective.
If the processor supports both Enhanced Speedstep Technology (EST)
and p4-clockmod, EST will save more power and is preferred over
p4-clockmod.
Clockmod uses duty-cycle approach to modulate the freq. EST changes CPU
core voltage and freq.

Yes because, with p4-clockmod you can change the freq between 8 possible
values
(Processor freq) * n/8, where n=1, 2, ... 8

Thanks,
Venki

2004-10-27 17:37:52

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Mer, 2004-10-27 at 17:14, Paulo Marques wrote:
> > Why don't you try the VIA EPIA mini-ITX boards? These are designed for
> > low power applications like yours. I am running the M-6000 which has a
> > fanless 600Mhz C3 processor, the newer fanless models run at 1Ghz. And,
> > on top of that they support speed scaling so you can slow it down even
> > more.
>
> Yes, we tried those, but floating point calculations completely kill the
> performance on those boards.

You want Geode/NX or Pentium-M ITX boards for that (or the low power
'Shelton' board although you may need to import that since its only sold
in "poor countries")

Agree with you on pricing though.

2004-10-27 18:53:54

by Marcus Metzler

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

>>>>> "Alan" == Alan Cox <[email protected]> writes:

Alan> On Mer, 2004-10-27 at 17:14, Paulo Marques wrote:
>> > Why don't you try the VIA EPIA mini-ITX boards? These are
>> designed for > low power applications like yours. I am running
>> the M-6000 which has a > fanless 600Mhz C3 processor, the newer
>> fanless models run at 1Ghz. And, > on top of that they support
>> speed scaling so you can slow it down even > more.
>>
>> Yes, we tried those, but floating point calculations completely
>> kill the performance on those boards.

Alan> You want Geode/NX or Pentium-M ITX boards for that (or the
Alan> low power 'Shelton' board although you may need to import
Alan> that since its only sold in "poor countries")

Alan> Agree with you on pricing though.

You could also try the Efficeon board by ibase
(http://www.ibase.com.tw/mb860.htm). There seem to be some resellers
http://mb860f.4t.com/. And it has some good reviews
http://www.epiacenter.com/modules.php?name=Content&pa=showpage&pid=52
with the only disadvantage being the price.

Marcus

--
/--------------------------------------------------------------------\
| Dr. Marcus O.C. Metzler | |
| [email protected] | http://www.metzlerbros.de/ |
\--------------------------------------------------------------------/
|>>> Quis custodiet ipsos custodies <<<|

2004-10-27 23:07:39

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Mer, 2004-10-27 at 22:38, Rutger Nijlunsing wrote:
> So you've got the _disadvantages_ of a slow clock (programs run
> slower), and not the _advantages_ (power consumption is same as idle
> CPU and not lower, temperature is same as idle CPU and not lower).
>
> But why does the P4 have such a mode? It uses this mode during thermal
> throttling to get to the 'idle' temperature.

It isn't obvious how you software idle a PIV - "hlt" at least does not
seem to do that.

> Therefore, p4-clockmod is completely misnamed: it's _not_ a cpufreq
> driver in the sense that it does not change the frequency.

It performs a similar function less efficiently. Lots of older chipsets
for K6 and the like also only support this form of clock control.

Alan

2004-10-27 21:58:07

by Rutger Nijlunsing

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Wed, Oct 27, 2004 at 03:59:06PM +0100, Paulo Marques wrote:
> Pallipadi, Venkatesh wrote:
> >>....
> >Yes. Clock modulation is not as useful compared to enhanced speedstep.
> >But,
> >I feel, it should be OK to have the driver, though it is not really
> >useful
> >in common case. It may be useful in some exceptional cases.
>
> I think I have one of such cases.
>
> I am one of the members of the robotic soccer team from the University
> of Oporto, and a couple of months ago we were looking for new
> motherboards for our robots, because we are starting to need new
> hardware (on-board lan, usb2.0, etc.).
>
> We really don't need excepcional performance, but we really, really need
> low power consumption, so lowering the clock on a standard mainboard
> seemed to be the best cost/performance scenario.
>
> Could this driver be used to keep a standard p4 processor at say 25%
> clock speed at all times?

Nope, p4-clockmod is completely useles. It doesn't slow down the CPU
frequency, it only executes 7000 tick some kind of 'hlt' / 'halt'
instruction out of 8000 ticks (for example, to get 12.5%) just like
Linux's idle routine.

So you've got the _disadvantages_ of a slow clock (programs run
slower), and not the _advantages_ (power consumption is same as idle
CPU and not lower, temperature is same as idle CPU and not lower).

But why does the P4 have such a mode? It uses this mode during thermal
throttling to get to the 'idle' temperature.

Therefore, p4-clockmod is completely misnamed: it's _not_ a cpufreq
driver in the sense that it does not change the frequency. The
documentation should be updated to reflect this (eventually).

In short: p4-clockmod can be emulated in software.

--
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------

2004-10-28 00:17:24

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Tue, Oct 26, 2004 at 02:28:26PM -0700, Venkatesh Pallipadi wrote:
>
> Add links for p4-clockmod driver in x86-64 cpufreq.

I added it with a clarified description and made it dependent on
CONFIG_EMBEDDED to prevent mistakes (perhaps that should be done on i386 too?)

Thanks.

-Andi


Here's the patch for your reference:



Add links for p4-clockmod driver in x86-64 cpufreq.

AK: Made it dependent on EMBEDDED because the driver is only
useful in some special situations and should be normally not used.

Signed-off-by: "Venkatesh Pallipadi" <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

Index: linux/arch/x86_64/kernel/cpufreq/Makefile
===================================================================
--- linux.orig/arch/x86_64/kernel/cpufreq/Makefile 2004-10-19 01:55:08.%N +0200
+++ linux/arch/x86_64/kernel/cpufreq/Makefile 2004-10-28 02:02:00.%N +0200
@@ -7,7 +7,11 @@
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi.o
+obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o
+obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o

powernow-k8-objs := ${SRCDIR}/powernow-k8.o
speedstep-centrino-objs := ${SRCDIR}/speedstep-centrino.o
acpi-objs := ${SRCDIR}/acpi.o
+p4-clockmod-objs := ${SRCDIR}/p4-clockmod.o
+speedstep-lib-objs := ${SRCDIR}/speedstep-lib.o
Index: linux/arch/x86_64/kernel/cpufreq/Kconfig
===================================================================
--- linux.orig/arch/x86_64/kernel/cpufreq/Kconfig 2004-10-25 04:47:15.%N +0200
+++ linux/arch/x86_64/kernel/cpufreq/Kconfig 2004-10-28 02:09:04.%N +0200
@@ -88,5 +88,29 @@

If in doubt, say N.

+config X86_P4_CLOCKMOD
+ tristate "Intel Pentium 4 clock modulation"
+ depends on CPU_FREQ_TABLE && EMBEDDED
+ help
+ This adds the clock modulation driver for Intel Pentium 4 / XEON
+ processors. When enabled it will lower CPU temperature by skipping
+ clocks.
+
+ This driver should be only used in exceptional
+ circumstances when very low power is needed because it causes severe
+ slowdowns and noticeable latencies. Normally Speedstep should be used
+ instead.
+
+ For details, take a look at <file:Documentation/cpu-freq/>.
+
+ Unless you are absolutely sure say N.
+
+
+config X86_SPEEDSTEP_LIB
+ tristate
+ depends on (X86_P4_CLOCKMOD)
+ default (X86_P4_CLOCKMOD)
+
+
endmenu

2004-10-28 00:26:19

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Add p4-clockmod driver in x86-64

On Wed, Oct 27, 2004 at 10:50:38PM +0100, Alan Cox wrote:
> On Mer, 2004-10-27 at 22:38, Rutger Nijlunsing wrote:
> > So you've got the _disadvantages_ of a slow clock (programs run
> > slower), and not the _advantages_ (power consumption is same as idle
> > CPU and not lower, temperature is same as idle CPU and not lower).
> >
> > But why does the P4 have such a mode? It uses this mode during thermal
> > throttling to get to the 'idle' temperature.
>
> It isn't obvious how you software idle a PIV - "hlt" at least does not
> seem to do that.

It depends on the BIOS. hlt can do it with the right SMM code.
Other than that you need ACPI.

The main reason that BIOS don't use the more advanced power saving
modi is that they tend to have much longer latencies, and hlt cannot
know what interrupt latency the OS wants. A lot of BIOS seem
to go for short latency for compatibility.

That is why using the ACPI processor driver is a much better
choice, because it actually tries to figure this out and use the
correct sleep mode for the load. It doesn't do it very well on Linux yet
though because of lacking infrastructure in the main kernel
(e.g. it needs better accounting for interrupts) , but I hope
that can be eventually improved.

<insert standard rant about the the 1ms timer tick that also
doesn't help at all for this>

-Andi