Which cpu option is for Intel Core2 and how to optimize the FreeBSD's kernel?

I found the following information in the freebsd handbook chapter 8:
cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
The above option specifies the type of CPU you have in your system. You may have multiple instances of the CPU line (if, for example, you are not sure whether you should use I586_CPU or I686_CPU), but for a custom kernel it is best to specify only the CPU you have. If you are unsure of your CPU type, you can check the /var/run/dmesg.boot file to view your boot messages.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html

And I also found this in /sys/amd64/conf/NOTES:
#####################################################################
# CPU OPTIONS

#
# You must specify at least one CPU (the one you intend to run on);
# deleting the specification for CPUs you don't need to use may make
# parts of the system run faster.
#
cpu HAMMER # aka K8, aka Opteron & Athlon64

I want know which cpu option is for Intel Core2?

I think I can specify the "cpu option" in my kernel_conf_file to tune my kernel for specific hardware and gain more performance.

But I am not sure about this.

If my understanding is wrong, how to optimize FreeBSD's kernel for specific cpu?

I asked similar question two weeks ago, but still confused.
 
The answer is right there, in your quote :)
...you can check the /var/run/dmesg.boot file to view your boot messages.
The output of this can help:
Code:
dmesg | grep -i cpu
Compare it with /usr/src/share/mk/bsd.cpu.mk. Somewhere on this forum was a similar discussion, months ago. Perhaps a deeper search will reveal something more useful than my post.

*edit: http://forums.freebsd.org/showthread.php?t=816
Seems like your option should be prescott
 
dclau said:
The answer is right there, in your quote :)
The output of this can help:
Code:
dmesg | grep -i cpu
Compare it with /usr/src/share/mk/bsd.cpu.mk. Somewhere on this forum was a similar discussion, months ago. Perhaps a deeper search will reveal something more useful than my post.

*edit: http://forums.freebsd.org/showthread.php?t=816
Seems like your option should be prescott

I have seen the page that you give me, and this is my system information(I am planning buy a new core2 or phenom processor):
uname -a
FreeBSD PC-486.Workstation 7.0-RELEASE-p8 FreeBSD 7.0-RELEASE-p8 #0: Fri Jan 9 17:37:21 CST 2009 root@PC-486.Workstation:/usr/obj/usr/src/sys/MYKERNEL amd64
dmesg | grep -i cpu
CPU: Intel(R) Pentium(R) D CPU 2.80GHz (2802.82-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu0: <ACPI CPU> on acpi0
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est: CPU supports Enhanced Speedstep, but is not recognized.
est: cpu_vendor GenuineIntel, msr e2700000e27
p4tcc0: <CPU Frequency Thermal Control> on cpu0
cpu1: <ACPI CPU> on acpi0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
est: CPU supports Enhanced Speedstep, but is not recognized.
est: cpu_vendor GenuineIntel, msr e2700000e27
p4tcc1: <CPU Frequency Thermal Control> on cpu1
SMP: AP CPU #1 Launched!
I tried prescott and PRESCOTT, but it doesn't work. :(
fronclynne said:
AFIK, in amd64, the only valid CPU is HAMMER.
Why? Is there no difference between amd64 and em64t?
 
I hop eth ish elps.

fender0107401 said:
I tried prescott and PRESCOTT, but it doesn't work. :(

Why? Is there no difference between amd64 and em64t?

Not in your KERNCONF, I gather.

Just like the i386 only takes I[456]86_CPU.

You can further tune it in /etc/make.conf, but beware that things may break in horrible ways if you get too excited.
 
Set "I686_CPU" in your kernel configuration file for 32-bit, or "HAMMER" for 64-bit. In your make.conf you want to use "core2", which will do the right thing for both 32- and 64-bit.

p.s. Note that Intel Core 2 in 64-bit mode is considered an amd64 architecture, and not ia64 arch.
 
For 32-bit installs of FreeBSD, you will want to keep I586_CPU as well as I686_CPU.

I586_CPU enables a bunch of memory optimisations that aren't enabled with I686_CPU, even though all Intel and AMD CPUs since the PentiumPro and AthlonXP include those instructions.

There are several threads in 2008 and 2007 on the FreeBSD mailing lists regarding this "issue", and the general consensus was to have both in your 32-bit kernel config file to get the best performance.
 
phoenix_rizzen said:
For 32-bit installs of FreeBSD, you will want to keep I586_CPU as well as I686_CPU.

I586_CPU enables a bunch of memory optimisations that aren't enabled with I686_CPU, even though all Intel and AMD CPUs since the PentiumPro and AthlonXP include those instructions.

There are several threads in 2008 and 2007 on the FreeBSD mailing lists regarding this "issue", and the general consensus was to have both in your 32-bit kernel config file to get the best performance.

Somebody asked similar question regarding keeping I586_CPU and I486_CPU on one of mailing list (at and of 2008 I think) and answer was that modern CPUs do not benefit with such options in kernel.

Benchmarking custom and generic kernel I found that there is no performance drop.
 
This is my experience too, I even don't see much gain in optimizing for different cputypes apart from some theoretic benchmark noise.
 
Most workloads are not primarily CPU, hence performance increases are slim. For a VPN router with loads of connections I'd think about it (though it's probably smarter to get an accellerator). For desktop use, web- or database serving, this will not make a measurable difference.
 
phoenix_rizzen said:
For 32-bit installs of FreeBSD, you will want to keep I586_CPU as well as I686_CPU.

I586_CPU enables a bunch of memory optimisations that aren't enabled with I686_CPU, even though all Intel and AMD CPUs since the PentiumPro and AthlonXP include those instructions.

There are several threads in 2008 and 2007 on the FreeBSD mailing lists regarding this "issue", and the general consensus was to have both in your 32-bit kernel config file to get the best performance.

Out of curiosity, I tried this the other day. I have a dual Opteron machine and I had the cpu option as i686. I changed that to i586 to see if they memory optimsations would work.

When I rebooted the machine I got a kernel panic. And there was a message that the cpu type was unknown. What was even worse was that when I tried to boot kernel.old it gave me and invalid format error.

I had to use a FreeBSD live cd to boot the system and then copy the generic kernel and loader to my system. This was on a 7.1 system.
 
Not the best of ideas, Roddie ;) You should have added it. They're somewhat complementary (as the story goes), not mutually exclusive.
 
Read Carefully my friends

Anyone notice an overlap?

Code:
%dmesg | grep CPU | head -1
CPU: Intel(R) Core(TM)2 Duo CPU     E8500  @ 3.16GHz (3166.32-MHz [b]K8-class[/b] CPU)
%grep -i hammer /sys/amd64/conf/NOTES
cpu             HAMMER                  # aka [b]K8[/b], aka Opteron & Athlon64

It seems to me that HAMMER is the answer but I don't see any reason to add/remove i586 and/or i686. I don't use either and I don't have any problems but I also have used both and noticed no difference. Take note that the handbook does state "for a custom kernel it is best to specify only the CPU you have" so you will be fine with either or any combination of these.
 
I am quite late to this game

BuSerD said:
Anyone notice an overlap?

Code:
%dmesg | grep CPU | head -1
CPU: Intel(R) Core(TM)2 Duo CPU     E8500  @ 3.16GHz (3166.32-MHz [b]K8-class[/b] CPU)
%grep -i hammer /sys/amd64/conf/NOTES
cpu             HAMMER                  # aka [b]K8[/b], aka Opteron & Athlon64

It seems to me that HAMMER is the answer but I don't see any reason to add/remove i586 and/or i686. I don't use either and I don't have any problems but I also have used both and noticed no difference. Take note that the handbook does state "for a custom kernel it is best to specify only the CPU you have" so you will be fine with either or any combination of these.
If you try to use [red]i586[/red] or [red]i686[/red] in an AMD64 kernconf, I wager it'll noisily fail to build.

edit: et voila
Code:
make buildkernel

--------------------------------------------------------------
>>> Kernel build for EARTH80 started on Mon Sep 21 13:37:37 EDT 2009
--------------------------------------------------------------
===> EARTH80
mkdir -p /usr/obj/home/8/src/sys

--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /home/8/src/sys/amd64/conf;  PATH=/usr/obj/home/8/src/tmp/legacy/usr/sbin:/usr/obj/home/8/src/tmp/legacy/usr/bin:/usr/obj/home/8/src/tmp/legacy/usr/games:/usr/obj/home/8/src/tmp/usr/sbin:/usr/obj/home/8/src/tmp/usr/bin:/usr/obj/home/8/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  config  -d /usr/obj/home/8/src/sys/EARTH80  /home/8/src/sys/amd64/conf/EARTH80
/home/8/src/sys/amd64/conf/EARTH80: unknown option "i686"
*** Error code 1

Stop in /home/8/src.
*** Error code 1

Stop in /home/8/src.
 
Back
Top