Subject: RFRAC: p4tcc
To: None <tech-kern@netbsd.org>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 03/14/2007 20:30:07
Hi, I just adapted the OpenBSD p4tcc driver for NetBSD and sysctl.

Description:

 Restrict power consumption by using thermal control circuit.
 This operates independently of speedstep.
 Found on Pentium 4 and later models (feature TM).

 References:
 Intel Developer's manual v.3 #245472-012

 On some models, the cpu can hang if it's running at a slow speed.
 Workarounds included below.

[juan@nocturno][~]> sysctl -d machdep.p4tcc
machdep.p4tcc.throttling.target: CPU throttling state (0 = lowest, 7 highest)
machdep.p4tcc.throttling.current: current CPU throttling state
machdep.p4tcc.throttling.available: list of CPU throttling states
[juan@nocturno][~]> sysctl machdep.p4tcc
machdep.p4tcc.throttling.target = 7
machdep.p4tcc.throttling.current = 7
machdep.p4tcc.throttling.available = 7 6 5 4 3 2
[juan@nocturno][~]>

The errata disabled 0 and 1 on my CPU. A simple benchmark with openssl speed
reports the expected values:

with the highest state (7):

Doing md2 for 3s on 16 size blocks: 281901 md2's in 2.96s
Doing md2 for 3s on 64 size blocks: 151589 md2's in 3.00s
Doing md2 for 3s on 256 size blocks: 53293 md2's in 2.99s
Doing md2 for 3s on 1024 size blocks: 13938 md2's in 2.96s
Doing md2 for 3s on 8192 size blocks: 1904 md2's in 2.97s

with the lowest state (2):

Doing md2 for 3s on 16 size blocks: 111160 md2's in 2.91s
Doing md2 for 3s on 64 size blocks: 60901 md2's in 2.96s
Doing md2 for 3s on 256 size blocks: 21705 md2's in 2.99s
Doing md2 for 3s on 1024 size blocks: 5950 md2's in 2.97s
Doing md2 for 3s on 8192 size blocks: 777 md2's in 2.97s

http://www.netbsd.org/~xtraeme/p4tcc.diff

BTW, I added in arch/x86 because some Pentium 4 models have
the EM64T extension, so that you can run it with NetBSD/amd64
(this is my case).

Any comment before I commit this?

-- 

http://plog.xtrarom.org/
Juan RP's blog - NetBSD/pkgsrc news in Spanish