Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hyper Threading on ANY p4 (mini) HOWTO
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
gubbs
n00b
n00b


Joined: 28 Feb 2003
Posts: 35

PostPosted: Fri Apr 25, 2003 4:44 pm    Post subject: Hyper Threading on ANY p4 (mini) HOWTO Reply with quote

Pentium 4's are currently being marketed with the HT or Hyper Threading whizz-bang w00t! extra. The fact of the matter is however, that almost all p4's even p4A (400mhz FSB) have Hyper Threading support - they just dont _officially_ have it.

As far as I can tell, anyone with a p4 made after April 2002 can use Hyper Threading with a little trickery.

YOU DO NOT NEED A MOBO W/HYPER THREADING SUPPORT
YOU DO NOT NEED ANY BIOS UPDATES WHATSOEVER

YOU DO NEED: Latest development sources (2.5.68 as of now)

Interested? Read on ...

Step 1: Does your P4 support HT?

Celerons based on the Northwood core dont, as far as I can tell. I may be wrong. Any p4 with a Northwood core should do however. The easy way to tell is by typing CAT /PROC/CPUINFO and looking in the FLAGS line for the following flag "ht".

Does yours have it? My .. rather old ... p4 from June 2002 has it. Woohoo! If yours does ..
Well gratz. You will soon have Hyper Threading enabled and working and it wont cost you SAUSAGES.

Here's a VERY expensive Xeon cpuinfo result:

processor : 2
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Xeon(TM) CPU 2.60GHz
stepping : 7
cpu MHz : 2599.799
cache size : 512 KB
Physical processor ID : 3
Number of siblings : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips : 5187.17

Thats all well and good ... after all they are marketed as Hyper Threading chips.

However .. Here's my p4a's cpuinfo result ...

processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 2.00GHz
stepping : 4
cpu MHz : 2660.015
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips : 5308.41

As you can see, it too has the "ht" flag and so there has the potential to function as a Hyper Threading enabled cpu.

Yes if you're thinking to yourself 'Hang on, those results dont make sense - he's overclocked the SHIT out of that!' you're right. But my overclocking has bugger all to do with the fact that my cpu has Hyper Threading functionality.

Here's my cpuinfo AFTER Hyper Threading was fully configured:

processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 2.00GHz
stepping : 4
cpu MHz : 2660.776
cache size : 512 KB
physical id : 0
siblings : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips : 5259.26

If you have the flag .. Here's what you need to do in order to use Hyper Threading.

emerge sys-kernel/development-sources-2.5.68

cd /usr/src/linux-2.5.68

make menuconfig

make sure you enable (compile in with the asterix *) the following:

[*] Symmetric multi-processing support

<*> /dev/cpu/*/msr - Model-specific register support
<*> /dev/cpu/*/cpuid - CPU information support

[*] ACPI Support
[*] CPU Enumeration Only

+ everything else you normally would use inc. defs and devpts etc.

IMPORTANT: If you use an Nvidia gfx card make sure you DONT compile in or modularize /dev/agpart or DRI. Leave it ALL out.

Ok. 2.5.68 compiles differently to 2.4's you only need to type make bzImage (no dep) then make modules make modules_install

Boot your new kernel image. run top, notice it says CPU(s) not CPU? gratz it works. to be certain go to cat /proc/cpuinfo and note the new line 'siblings -1' has appeared. thats confirmation hyper threading is now configured and working.

To take advantage of this you need to now go edit make.conf to include the MAKEOPTS (just scroll down to the bottom, its there just commented out. Set this to -j4 not -j2 to make double sure you get the most out of it.

IMPORTANT: Using the 2.5.68 sources will cause problems with NVIDIA drivers and there are a number of things you'll need to repair to make sure it all works ok. Because I hate people who promise you the Earth then fuck it all up for you .. Here's what you can expect to have to fix and how to fix it. I'm so nice. :)

1. QM_MODULES problems. ie. you cant load any modules. Sheeeeeet!!!!

FIX: cd /usr/portage/sys-apps/module-init-tools/ && emerge module-init-tools-0.9.11-r3.ebuild

2. Arghhh Xterm/Aterm/Rterm/Eterm wont open in X, gives me some error about not being able to open tty (null) or something. Help!

FIX: Open /etc/fstab and making sure you have compiled devpts fs into your kernel (its on the same mini list as devfs in the 2.5.68 menuconfig so you cant miss it) add this line under the PROC entry:

devpts /dev/pts devpts defaults 0 0

save it. reboot your machine.

3. Nvidia drivers are fucked. ARGHHH I HATE YOU!

FIX: This one requires some cunning. Thanks. I know. I rock. First emerge search nvidia.
Then from the results emerge nvidia-kernel. It will bomb. Why? Because in your /usr/src directory you have a folder called 'linux' thats where it looks to compile stuff. If you've been using a 2.4. kernel beforehand it will contain a 2.4 src tree. Good eh? So go into /usr/src/linux and make menuconfig SAVE you config to a file then move it to your home dir as a backup. Then rm -rf linux/ and mv linux-2.5.68 linux. Then re-emerge nvidia-kernel. Now it works! Hoorah. Then emerge nvidia-glx ... Then run the update it suggests so that you are now running opengl by nvidia. Done!

Because you were clever and didnt include agpart or DRI all opengl apps will now use nvidia agp driver not the oss linux kernel one. Some say its worse. I prefer it .. Up to you. But bear in mind the OSS one is OSS ... the nvidia one gets better with each new release. Go figure.

4. Arghh. My CDROM wont mount! What have you done???

FIX: Ok. Thanks for cyfred for this. You can read his post
here
on how to fix that. URL is down the bottom.

All done?

Hyper Threading happily?

Me too! :)

Gubbs.

irc.freenode.net 6667 #incantus


Last edited by gubbs on Fri Apr 25, 2003 5:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
snutte
Apprentice
Apprentice


Joined: 24 Apr 2002
Posts: 181
Location: Sweden, Malmö

PostPosted: Fri Apr 25, 2003 5:21 pm    Post subject: Reply with quote

I will try this later tonight with my P4 2.4ghz (533).
And I will report back. :D
Back to top
View user's profile Send private message
gubbs
n00b
n00b


Joined: 28 Feb 2003
Posts: 35

PostPosted: Fri Apr 25, 2003 5:24 pm    Post subject: Reply with quote

yeah ... some guys with laptops have been moaning at me that [*] CPU Enumeration Only is no good for them as they need the ACPI options for power switches and such forth.

i havent actually tried not using enumeration ...

if someone does try JUST compiling in ACPI support and it still works post to confirm.
i'm rushed off my feet and wont get chance for at least 3-4 hrs. :(

Gubbs.
Back to top
View user's profile Send private message
barlad
l33t
l33t


Joined: 22 Feb 2003
Posts: 673

PostPosted: Fri Apr 25, 2003 5:36 pm    Post subject: Reply with quote

To be honest, I am not convinced at all. It was my understanding that the main role of HT is to simulate the presence of another CPU.
Thus you have one physical CPU which splits into TWO virtual CPUs.

The system does not care wether or not those CPUs are virtual, it just see them as two CPUs. So basically, you should have two cpus listed (I will come back to that later)

About Intel, it's true that some CPUs were built with a hidden HT support but according to what I read, no one has found a way to enable that HT support yet in those old processors. See the link posted by bsolar somewhere else. The activation of HT hidden capabilities cannot be a trivial thing and according to that thread, has not been figured out yet.

Anyway, to come back on your cpu listing thing. If HT is enabled, you must see two CPUs and according to your cat /proc/cpuinfo, you only have one.
Here is a cat from my config
Code:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 3.06GHz
stepping        : 7
cpu MHz         : 3066.939
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips        : 6107.95

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 3.06GHz
stepping        : 7
cpu MHz         : 3066.939
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips        : 6121.06


See, there are two processors. Everything in my system works like if I had two processors. It does not know those proc are fakes.

On the other hand, it looks like you just activated SMP capabilities in your kernel. It does not report more than one CPU.

Anyway, I would be glade to be proved wrong but I highly doubt HT was really activated nor that you can that trivially enable it on old PIV cpus.
Back to top
View user's profile Send private message
gubbs
n00b
n00b


Joined: 28 Feb 2003
Posts: 35

PostPosted: Fri Apr 25, 2003 5:41 pm    Post subject: Reply with quote

Why does the Xeon report Physical processor ID : 3 Number of siblings : 2 and mine Physical Processor ID: 0 (ie, the first one of any given number) and Number of Siblings: 1 ie. there's more than one CPU being detected. Guess it means HT is being picked up but its disabled on the die or something.

... you're right about HT I was wrong.

Processor #0 15:2 APIC version 16
Building zonelist for node : 0
Kernel command line: BOOT_IMAGE=HyperT ro root=4802
Found and enabled local APIC!
Initializing CPU#0
PID hash table entries: 2048 (order 11: 16384 bytes)
Detected 2660.776 MHz processor.
Console: colour VGA+ 80x25
Calibrating delay loop... 5259.26 BogoMIPS
Memory: 514932k/524272k available (1830k kernel code, 8604k reserved, 727k data, 320k init, 0k highmem)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
-> /dev
-> /dev/console
-> /root
CPU: Trace cache: 12K uops, L1 D cache: 8K
CPU: L2 cache: 512K
CPU: Hyper-Threading is disabled
CPU: After generic, caps: 3febfbff 00000000 00000000 00000000
Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#0.
CPU#0: Intel P4/Xeon Extended MCE MSRs (12) available
CPU#0: Thermal monitoring enabled
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Checking 'hlt' instruction... OK.
POSIX conformance testing by UNIFIX
CPU0: Intel(R) Pentium(R) 4 CPU 2.00GHz stepping 04
per-CPU timeslice cutoff: 1463.05 usecs.
task migration cache decay timeout: 2 msecs.
SMP motherboard not detected.
enabled ExtINT on CPU#0
ESR value before enabling vector: 00000000
ESR value after enabling vector: 00000000
Using local APIC timer interrupts.
calibrating APIC timer ...
..... CPU clock speed is 2659.0605 MHz.
..... host bus clock speed is 132.0980 MHz.
Starting migration thread for cpu 0
CPUS done 32

oh, well. better luck next time. :)


Last edited by gubbs on Fri Apr 25, 2003 6:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
bsolar
Bodhisattva
Bodhisattva


Joined: 12 Jan 2003
Posts: 2764

PostPosted: Fri Apr 25, 2003 6:34 pm    Post subject: Reply with quote

The 'siblings' number shows how many "virtual" cpus are visible to an ht-enabled system, so it should be '2' being the pentium4 a 2-way hyperthreading CPU.

BTW. there are some discussions in the various lists around that, i.e. these posts might be of interest.
_________________
I may not agree with what you say, but I'll defend to the death your right to say it.
Back to top
View user's profile Send private message
gubbs
n00b
n00b


Joined: 28 Feb 2003
Posts: 35

PostPosted: Fri Apr 25, 2003 6:40 pm    Post subject: Reply with quote

cleared that up nicely.

damn. I cant even claim its a hoax.

arses.

:)
Back to top
View user's profile Send private message
nepenthe
Guru
Guru


Joined: 14 Jul 2002
Posts: 317
Location: Sanford, ME

PostPosted: Sat Apr 26, 2003 3:41 am    Post subject: Reply with quote

Me being laptop user, am equally interested in seeing if it works without selecting CPU Emuration Only
Back to top
View user's profile Send private message
sn4ip3r
Guru
Guru


Joined: 14 Dec 2002
Posts: 325
Location: Tallinn, Estonia

PostPosted: Sat Apr 26, 2003 9:03 am    Post subject: Re: Hyper Threading on ANY p4 (mini) HOWTO Reply with quote

gubbs wrote:

...
Celerons based on the Northwood core dont, as far as I can tell.



I have a celeron 2.0 (Northwood)

Code:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Celeron(R) CPU 2.00GHz
stepping        : 7
cpu MHz         : 2458.060
cache size      : 8 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips        : 4902.09
Back to top
View user's profile Send private message
proxy
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 253
Location: Chantilly, VA

PostPosted: Sat Apr 26, 2003 11:22 pm    Post subject: Reply with quote

just to clear somthing up, my roomate used to work for intel (when tge p4 was in development) as far as he knows, all of them actually have HT capability, just ones without the HT logo have that circuty physically disabled (intentiionally shorted or whatever). so the flag will be there, but unless you actually see 2 cpus in /proc/cpuinfo, you can't use it.

The noted, I have a 3.06 HT and i see 2 cpus :D

proxy
Back to top
View user's profile Send private message
Bowyakka
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2002
Posts: 142
Location: London

PostPosted: Tue Apr 29, 2003 1:45 pm    Post subject: Reply with quote

Quote:
[*] Symmetric multi-processing support

<*> /dev/cpu/*/msr - Model-specific register support
<*> /dev/cpu/*/cpuid - CPU information support

[*] ACPI Support
[*] CPU Enumeration Only


not meaing to upset you further but as an old hand at smp I should point out that you also need to enable (not module enable) enhanced real time clock or else the rtc is all screwy for smp computers and stuff wont work proper
_________________
glows in the dark
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Thu May 01, 2003 8:28 pm    Post subject: Reply with quote

Just to make this clear:
The instructions above DOES NOT work

In order to enable HT on a normally non-ht enabled P$, you have to have a BIOS that configures the processor correctly. This has been disabled by default on all HT aware BIOS'es after Intel's request. The only way to get a non-ht enabled P$ to actually work as an ht-enabled P4, is to get hold of a BIOS where the feature has been anabled for all P4's. As far as I have been able to research, such a BIOS does not exist, as all BIOS producers wanna stay on Intel's good side.

There is a thread over at VRForum investigating other ways of HT enable normal P4's. Unfortuately, I can't get to the site right now. You can try VRForum HT Thread

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
nepenthe
Guru
Guru


Joined: 14 Jul 2002
Posts: 317
Location: Sanford, ME

PostPosted: Thu May 01, 2003 11:55 pm    Post subject: Reply with quote

Thanx for the clarification
Back to top
View user's profile Send private message
gubbs
n00b
n00b


Joined: 28 Feb 2003
Posts: 35

PostPosted: Mon May 05, 2003 3:22 pm    Post subject: Reply with quote

aye, just to be CLEAR. THIS ABSOLUTELY DOES NOT WORK! I was taking way too many class A drugs!

sorry. :)

gubbs.
Back to top
View user's profile Send private message
nepenthe
Guru
Guru


Joined: 14 Jul 2002
Posts: 317
Location: Sanford, ME

PostPosted: Mon May 05, 2003 4:08 pm    Post subject: Reply with quote

no prob :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum