Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Configuring kernel - CPU type
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Mar 14, 2024 4:13 pm    Post subject: Configuring kernel - CPU type Reply with quote

I'm in the process of adjusting kernel for my old Chromebox CN60.

At the very beginning I already hit "What should I choose?"
make nconfig :
┌── Core 2/newer Xeon ───────────────────────────────────────────────┐
│                                                                    │
│ CONFIG_MCORE2:                                                     │
│                                                                    │
│                                                                    │
│ Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and │
│ 53xx) CPUs. You can distinguish newer from older Xeons by the CPU  │
│ family in /proc/cpuinfo. Newer ones have 6 and older ones 15       │
│ (not a typo)                                                       │
│                                                                    │
│ Symbol: MCORE2 [=n]                                                │
│ Type  : bool                                                       │
│ Defined at arch/x86/Kconfig.cpu:272                                │
│   Prompt: Core 2/newer Xeon                                        │
│   Depends on: <choice>                                             │
│   Location:                                                        │
│     -> Processor type and features                                 │
│       -> Processor family (<choice> [=y])                          │
│         -> Core 2/newer Xeon (MCORE2 [=n])                         │
│                                                                    │
│                                                                    │
│                                                                    │
│                               <OK>                                 │
└────────────────────────────────────────────────────────────────────┘
... and
lscpu:
panther-box ~ # lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         39 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  2
  On-line CPU(s) list:   0,1
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        GenuineIntel
  Model name:            Intel(R) Celeron(R) 2955U @ 1.40GHz
    BIOS Model name:     Intel(R) Celeron(R) 2955U @ 1.40GHz  CPU @ 0.0GHz
    BIOS CPU family:     12
    CPU family:          6
    Model:               69
    Thread(s) per core:  1
    Core(s) per socket:  2
    Socket(s):           1
    Stepping:            1
    CPU(s) scaling MHz:  57%
    CPU max MHz:         1400.0000
    CPU min MHz:         800.0000
    BogoMIPS:            2794.83
    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 pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonsto
                         p_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer xsave rdrand lahf_lm abm cpuid_fault epb invpcid_single ssbd ibrs
                         ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust erms invpcid xsaveopt dtherm arat pln pts md_clear flush_l1d
Virtualization features:
  Virtualization:        VT-x
Caches (sum of all):     
  L1d:                   64 KiB (2 instances)
  L1i:                   64 KiB (2 instances)
  L2:                    512 KiB (2 instances)
  L3:                    2 MiB (1 instance)
NUMA:                   
  NUMA node(s):          1
  NUMA node0 CPU(s):     0,1
Vulnerabilities:         
  Gather data sampling:  Not affected
  Itlb multihit:         KVM: Mitigation: VMX disabled
  L1tf:                  Mitigation; PTE Inversion; VMX vulnerable, SMT disabled
  Mds:                   Vulnerable; SMT disabled
  Meltdown:              Vulnerable
  Mmio stale data:       Unknown: No mitigations
  Retbleed:              Not affected
  Spec rstack overflow:  Not affected
  Spec store bypass:     Vulnerable
  Spectre v1:            Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
  Spectre v2:            Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS: Not affected
  Srbds:                 Vulnerable
  Tsx async abort:       Not affected
panther-box ~ #
... so the processor family matches, but this isn't a Xeon, that's certain. And according to wikipedia haswell isn't in the core 2 family, but core i[3-7].

Since this is quite a low power machine, I'd like to have optimized.

So, should I enable MCORE2 or go with the default GENERIC_CPU. My guess is the generic one, but I want to be certain.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Thu Mar 14, 2024 6:14 pm    Post subject: Reply with quote

It is exactly Core2/Newer Xeon(Because older Xeon is not Core 2). You won't find something more specific than that, unless you enable experimental flag on gentoo-sources.

And don't take it too literally, / means or, not and, so your CPU does not need to be Xeon.

p.s. core i-something is still core 2 family and I think it's been so ever since core 2 came into existence.

Best Regards,
Georgi


Last edited by logrusx on Thu Mar 14, 2024 6:16 pm; edited 2 times in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4157
Location: Bavaria

PostPosted: Thu Mar 14, 2024 6:15 pm    Post subject: Reply with quote

This is important:
Code:
    CPU family:          6

So, yes, you can choose Core2. Older CPUs have family 15 (no typo!) and then you cannot use it.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Mar 14, 2024 6:34 pm    Post subject: Reply with quote

Thanks guys!

pietinger wrote:
This is important:
Code:
    CPU family:          6

So, yes, you can choose Core2. Older CPUs have family 15 (no typo!) and then you cannot use it.
Yes. The CPU family number was exactly why I start wondering.

I'll enable it and start compiling...
Code:
2024-03-14T20:40:07 >>> sys-kernel/gentoo-kernel... (1 of 1) ETA: 6 hours, 33 minutes, 20 seconds
... every optimization counts here. :D

logrusx wrote:
p.s. core i-something is still core 2 family and I think it's been so ever since core 2 came into existence.
This is good to know. Although I don't know if there's much of an impact on newer intel cpu, if it isn't enabled.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!


Last edited by Zucca on Thu Mar 14, 2024 6:57 pm; edited 3 times in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4157
Location: Bavaria

PostPosted: Thu Mar 14, 2024 6:42 pm    Post subject: Reply with quote

P.S.: You can use CORE2 for every Intel CPU which is newer than NETBURST ... the next was CORE ... your Haswell is "very new" in comparison to Core :lol:

See also here: https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Mar 14, 2024 6:58 pm    Post subject: Reply with quote

So basically it should be enabled on all (?) every new intel CPU.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4157
Location: Bavaria

PostPosted: Thu Mar 14, 2024 7:08 pm    Post subject: Reply with quote

Zucca wrote:
So basically it should be enabled on all (?) every new intel CPU.

I would say: If it is a Intel i3-... or i5-... or i7-... (or i9-...) or a newer Celeron: Yes (because you can choose it even on a Core2Duo)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Thu Mar 14, 2024 7:13 pm    Post subject: Reply with quote

Zucca wrote:
So basically it should be enabled on all (?) every new intel CPU.


Can you find a better option? Mine is Opteron/Athlon64/Hammer/K8 although my CPU is Zen 3. Generic-x86-64 should be used only by binary distributions.

Also have in mind that only determines what the kernel binary code will look like and I don't think the kernel itself can make much use of extended instruction sets. That doesn't prevent applications from using them if they are compiled for them.

However I remember I once tried Generic-x86-64 and it reminded me a bit of the times when you would absolutely recompile your kernel, especially if you had Pentium. It definitely felt a little bit slower.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Mar 14, 2024 7:29 pm    Post subject: Reply with quote

logrusx wrote:
Can you find a better option?
Not really.
The option name MCORE2 and the description mentioning Core 2 just sounded that it was for older cpus of the core 2 times.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Thu Mar 14, 2024 8:18 pm    Post subject: Reply with quote

Zucca wrote:
logrusx wrote:
Can you find a better option?
Not really.
The option name MCORE2 and the description mentioning Core 2 just sounded that it was for older cpus of the core 2 times.


Well the experimental flag on gentoo-sources applies patches that give more specific targets but I doubt they'd be useful. You're good with Core 2/newer Xeon on pretty much any Intel CPU manufactured in the last 15 years or so.

Sorry if I sounded odd, I was operating under the impression that we had more common ground on that topic and I could omit things that could be implied. I'm feeling a bit of a difficulty with English at times too.

Best Regards,
Georgi
Back to top
View user's profile Send private message
wjb
l33t
l33t


Joined: 10 Jul 2005
Posts: 609
Location: Fife, Scotland

PostPosted: Thu Mar 14, 2024 8:42 pm    Post subject: Reply with quote

I went Core 2 with an "Intel Pentium Silver N5030". Seems to be ok. I did try the Pentium option at first. Which also worked. It seems like a silly question to ask since the kernel could presumably consult the CPU itself.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4157
Location: Bavaria

PostPosted: Thu Mar 14, 2024 8:50 pm    Post subject: Reply with quote

wjb wrote:
[...] It seems like a silly question to ask since the kernel could presumably consult the CPU itself.

No - the compiler (e.g. gcc) can consult the CPU and ask which optimizations it has ... a source code can only give some hints to the compiler ... unfortunatly the kernel sources (in some cases) must even protect itself from some (wrong) optimization from some compiler ... :lol:
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Thu Mar 14, 2024 11:02 pm    Post subject: Reply with quote

wjb wrote:
It seems like a silly question to ask since the kernel could presumably consult the CPU itself.
Not necessarily. Remember that binary distribution kernels are usually built once on a central build farm, then published for a variety of end user computers with varying CPUs. Even within Gentoo, I do all my kernel builds on my build machine, and copy them to the relevant individual machines to run. As a result, the kernel build has no way to examine the CPU on which I intend to run it, and must delegate the question to me.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Mar 14, 2024 11:49 pm    Post subject: Reply with quote

logrusx wrote:
the experimental flag on gentoo-sources applies patches that give more specific targets but I doubt they'd be useful.
Interesting... I only have three choices there:
  • AMD (Opteron etc...)
  • Intel Family 6, aka. this MCORE2
  • ... and the generic one
qlist -Iv gentoo-kernel:
sys-kernel/gentoo-kernel-6.1.77

_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Fri Mar 15, 2024 5:45 am    Post subject: Reply with quote

Zucca wrote:
logrusx wrote:
the experimental flag on gentoo-sources applies patches that give more specific targets but I doubt they'd be useful.
Interesting... I only have three choices there:
  • AMD (Opteron etc...)
  • Intel Family 6, aka. this MCORE2
  • ... and the generic one
qlist -Iv gentoo-kernel:
sys-kernel/gentoo-kernel-6.1.77


I'm getting 45 options including 4 x86-64 options up to v4 and a native compiler optimization option for each Intel and AMD in 6.6.20 which I emerged to avoid messing with mu currently used sources.

I'm referring to experimental USE flag on sys-kernel/gentoo-sources, did you enable something else experimental?

p.s. I remembers trying zen3 for my CPU and didn't find any noticeable difference. User code runs as fast as it's optimized to run regardless of the kernel optimizations and I guess if there's a difference in the kernel performance it can't be detected by the naked eye and should be tested in a special environment and conditions to be measured accurately.

Best Regards,
Georgi
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Fri Mar 15, 2024 8:27 am    Post subject: Reply with quote

logrusx wrote:
User code runs as fast as it's optimized to run regardless of the kernel optimizations and I guess if there's a difference in the kernel performance it can't be detected by the naked eye and should be tested in a special environment and conditions to be measured accurately.
Georgi

I'd expect binary size gain, though...

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Fri Mar 15, 2024 8:42 am    Post subject: Reply with quote

Plz note gentoo-sources-6.8.0 has no experimental USE flag.
I recall forcing cpu within make command line is possible.
No saved link here though.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
rufnut
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 247

PostPosted: Fri Mar 15, 2024 8:49 am    Post subject: Reply with quote

don't forget :

    app-portage/cpuid2cpuflags


:)
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri Mar 15, 2024 8:52 am    Post subject: Reply with quote

logrusx wrote:
I'm referring to experimental USE flag on sys-kernel/gentoo-sources, did you enable something else experimental?
Nope. It looks like same experimental patches haven't propagated into gentoo-kernel yet... if they ever will.
I'm not keen to switching back to gentoo-sources.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Fri Mar 15, 2024 9:32 am    Post subject: Reply with quote

Zucca wrote:
logrusx wrote:
I'm referring to experimental USE flag on sys-kernel/gentoo-sources, did you enable something else experimental?
Nope. It looks like same experimental patches haven't propagated into gentoo-kernel yet... if they ever will.
I'm not keen to switching back to gentoo-sources.


I guess you could drop the patches in /etc/portage/patches.

I think gentoo-kernel is not supposed to have them since it should be able to exactly replicate gentoo-kernel-bin locally and gentoo-kernel-bin is not supposed to be experimental.

Anyways, as I already expressed my opinion, I don't believe even native compiler optimization is going to give you any noticeable difference and there aren't any facts to support the opposite hypothesis either.

As CaptainBlood mentioned, there would be a differences in size, but I don't expect those to be significant either because the kernel has very specific tasks which should not depend much on extensions in the instruction set. Plus there's already an explicit setting in kernel config for optimization for size or speed.

Actually in the midst of writing this I decided to check and here's the difference:

19771904 without optimizations and 19644928 (-0.6%) bytes with them. Which is expected if a bunch of instructions can be replaced by a more complex single instruction.

Best Regards,
Georgi
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3628

PostPosted: Fri Mar 15, 2024 10:29 am    Post subject: Reply with quote

CaptainBlood wrote:
gentoo-sources-6.8.0 has no experimental USE yet:
As an example:
Code:
-rw-r--r-- 1 root root 5293056 mars  15 13:14 vmlinuz-6.8.0-gentoo-rv

But setting as below before make
Code:
export KCFLAGS="-march=native -mtune=native"
export KCPPFLAGS="-march=native -mtune=native"
brings:
Code:
-rw-r--r-- 1 root root 5243904 mars  15 12:53 vmlinuz-6.8.0-gentoo-rv

A little 1% size gain. I'd expect a little ram to be saved too.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here.
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Fri Mar 15, 2024 11:16 am; edited 1 time in total
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Fri Mar 15, 2024 10:33 am    Post subject: Reply with quote

Actually I didn't take into account the fact I'm embedding some firmware into my kernel which deflate the result a bit. The actual ratio of size savings should be larger.

Best Regards,
Georgi
Back to top
View user's profile Send private message
rogge
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2006
Posts: 132
Location: Erfurt

PostPosted: Sat Mar 16, 2024 2:39 pm    Post subject: Reply with quote

These days I'd the very same question for a Intel Icelake.

Have a look here: https://github.com/graysky2/kernel_compiler_patch
Back to top
View user's profile Send private message
logrusx
Veteran
Veteran


Joined: 22 Feb 2018
Posts: 1537

PostPosted: Sat Mar 16, 2024 4:51 pm    Post subject: Reply with quote

rogge wrote:
These days I'd the very same question for a Intel Icelake.

Have a look here: https://github.com/graysky2/kernel_compiler_patch


Judging by the set of options and even the titles, those might very well be the same patches experimental use flag brings to gentoo-sources.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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