# which processor family should I select?

## queen

I am installing now a new system with cpu ivy bridge  Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz

I am not sure which processor family should I select in the kernel. Core 2/newer Xeon or generic x86_64. 

More details about the cpu: 

```

processor       : 7

vendor_id       : GenuineIntel

cpu family      : 6

model           : 58

model name      : Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz

stepping        : 9

microcode       : 0x12

cpu MHz         : 2294.894

cache size      : 6144 KB

physical id     : 0

siblings        : 8

core id         : 3

cpu cores       : 4

apicid          : 7

initial apicid  : 7

fpu             : yes

fpu_exception   : yes

cpuid level     : 13

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 pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms

bogomips        : 4589.78

clflush size    : 64

cache_alignment : 64

address sizes   : 36 bits physical, 48 bits virtual

power management:

```

----------

## Catanduva

I'm getting an i5 ivy bridge tomorrow. Same question here.

----------

## kimmie

You want core2 / newer Xeon

----------

## duderonomy

 *kimmie wrote:*   

> You want core2 / newer Xeon

 

Really?

I have tried both "Generic-x86-64" and "Core 2/newer Xeon".

Apparently, either one works...

Where can I look the details why "Core 2/newer Xeon" is best?

I have not googled this yet. 

Thx

 :Very Happy: 

----------

## queen

 *kimmie wrote:*   

> You want core2 / newer Xeon

 

Yes, that's what I ended up selecting. I looked also in the help of the selection and it seemed better, but I don't have a more based reason. If you have a good reason, I will be glad to know.

I also checked safe cflags which gave some hints too. 

http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Core_2_Duo.2FQuad.2C_Xeon_51xx.2F53xx.2F54xx.2F3360.2C_Pentium_Dual-Core_T23xx.2B.2FExxxx.2C_Celeron_Dual-Core

http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Core_i7_and_Core_i5.2C_Xeon_55xx

Too bad they didn't update the site for Ivy bridge. model 58 doesn't appear there yet.

----------

## kimmie

Basically, if you are building a 64 bit kernel, CONFIG_MCORE2 will build the kernel with gcc options -m64 -march=core2, whereas CONFIG_GENERIC_CPU will build it with -m64 -mtune=generic.

CORE2 is definitely the right one to use, as more recent i7/i5 support the core2 instructions, which are a superset of the basic amd64 instructions. Latter versions of gcc have -march=core7 available too, I think, I'm not sure if that's yet used by any kernel version.

It's hard to find this info by googling, I just looked in the kernel source for MCORE2 and also built the kernel using make V=1 to see exactly how the gcc options changed. If you set CONFIG_GENERIC_CPU, there are a few other undocumented kernel options set too, you'd have to look in the source to see what these actually do. Probably some sort of runtime detection and optimisation.

EDIT: Probably for your Ivy Bridge i7 you'll find that Processor family is 6 in /proc/cpuinfo, as described in the make menuconfig help for CONFIG_MCORE2. It certainly is for my first generation i7.

----------

## queen

 *kimmie wrote:*   

> Basically, if you are building a 64 bit kernel, CONFIG_MCORE2 will build the kernel with gcc options -m64 -march=core2, whereas CONFIG_GENERIC_CPU will build it with -m64 -mtune=generic.
> 
> CORE2 is definitely the right one to use, as more recent i7/i5 support the core2 instructions, which are a superset of the basic amd64 instructions. Latter versions of gcc have -march=core7 available too, I think, I'm not sure if that's yet used by any kernel version.
> 
> It's hard to find this info by googling, I just looked in the kernel source for MCORE2 and also built the kernel using make V=1 to see exactly how the gcc options changed. If you set CONFIG_GENERIC_CPU, there are a few other undocumented kernel options set too, you'd have to look in the source to see what these actually do. Probably some sort of runtime detection and optimisation.
> ...

 

Yes, I assumed that generic is for all kinds of 64bit (for multi platforms). As far I saw in the kernel, there isn't -march=i7. Indeed the family is 6.See the first post of proc/cpuinfo

However,  there might be some discrepancy since in the CFLAGS I selected -march=native for Ivy Bridge as suggested in other threads. I am not sure how it will behave. Ivy bridge will be supported in higher gcc versions (4.6 and higher), but so far it's full of bugs. 

You have an idea how to check and see which flags actually take in place?

----------

## kimmie

The CFLAGS you use in make.conf are not used when building the kernel.

The kernel config controls the gcc options for the kernel build. If you want to see the actual gcc commands used when then kernel is built, use 'make V=1'.

I don't know what you mean by a "discrepancy". It won't matter at all if you build a kernel using generic options, and use CFLAGS="-march=native" when you build your system.

----------

## khayyam

 *queen wrote:*   

> You have an idea how to check and see which flags actually take in place?

 

queen ... you can get the flags that -march=native (or similarly with '-m64 -march=core2') will enable with the following

```
gcc '-###' -e -v -march=native /usr/include/stdlib.h
```

best ... khay

----------

## duderonomy

 *khayyam wrote:*   

> 
> 
> ```
> gcc '-###' -e -v -march=native /usr/include/stdlib.h
> ```
> ...

 

Thanks for the great tip!

----------

## queen

 *khayyam wrote:*   

>  *queen wrote:*   You have an idea how to check and see which flags actually take in place? 
> 
> queen ... you can get the flags that -march=native (or similarly with '-m64 -march=core2') will enable with the following
> 
> ```
> ...

 

Cool. Thanks a lot.

----------

## queen

 *kimmie wrote:*   

> The CFLAGS you use in make.conf are not used when building the kernel.

 

That explains everything. Thanks.

----------

