# Only 1 core out of 4 being used with kernel 4.0.5 [SOLVED]

## Raspoetin

Hello,

I'm running the following kernel with SMP enabled in the kernel options.

```
Linux localhost 4.0.5-gentoo #3 SMP Sun Jun 28 15:47:02 CEST 2015 x86_64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz GenuineIntel GNU/Linux
```

Strangely enough, the only core that is being used is #2. Very periodically i can see #1 jump to 10% or something but it never gets utilised more than this. #3 an #4 are always at 0%. Especially when I'm emerging something this slows down everything severely.

My portage options are:

```
Portage 2.2.20 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/plasma/systemd, gcc-4.8.4, glibc-2.20-r2, 4.0.5-gentoo x86_64)

=================================================================

System uname: Linux-4.0.5-gentoo-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-gentoo-2.2

KiB Mem:    12258416 total,  10775204 free

KiB Swap:          0 total,         0 free

Timestamp of repository gentoo: Tue, 30 Jun 2015 20:45:01 +0000

sh bash 4.3_p39

ld GNU ld (Gentoo 2.25 p1.2) 2.25

app-shells/bash:          4.3_p39::gentoo

dev-lang/perl:            5.20.2-r1::gentoo

dev-lang/python:          2.7.10::gentoo, 3.3.5-r1::gentoo

dev-util/cmake:           3.2.3::gentoo

dev-util/pkgconfig:       0.28-r3::gentoo

sys-apps/baselayout:      2.2::gentoo

sys-apps/openrc:          0.17::gentoo

sys-apps/sandbox:         2.6-r1::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo

sys-devel/automake:       1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo

sys-devel/binutils:       2.25-r1::gentoo

sys-devel/gcc:            4.8.4::gentoo, 4.9.2::gentoo

sys-devel/gcc-config:     1.8::gentoo

sys-devel/libtool:        2.4.6-r1::gentoo

sys-devel/make:           4.1-r1::gentoo

sys-kernel/linux-headers: 4.1::gentoo (virtual/os-headers)

sys-libs/glibc:           2.20-r2::gentoo

Repositories:

gentoo

    location: /storage/portage

    sync-type: rsync

    sync-uri: rsync://rsync.nl.gentoo.org/gentoo-portage

    priority: -1000

local_overlay

    location: /storage/local/portage

    masters: gentoo

    priority: 0

kde

    location: /var/lib/layman/kde

    sync-type: laymansync

    sync-uri: git://anongit.gentoo.org/proj/kde.git

    masters: gentoo

    priority: 50

Installed sets: @kde-frameworks, @kde-plasma

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe"

DISTDIR="/storage/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="ftp://mirror.leaseweb.com/gentoo/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo"

LANG="en_US.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j5"

PKGDIR="/storage/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv jpeg kde kipi lcms ldap libnotify lm_sensors mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds pulseaudio qml qt3support qt4 qt5 readline sdl semantic-desktop session spell sse sse2 ssl startup-notification svg systemd tcpd tiff truetype udev udisks unicode upower usb vorbis widgets wxwidgets x264 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmxext mmx sse sse2 avx sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20 ruby22" USERLAND="GNU" VIDEO_CARDS="fglrx" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
```

I can put my kernel options on pastebin or something if that would help but I have enabled SMP and multi-core scheduler support.

Furthermore, I am dual booting with windows from uefi as suggested in https://wiki.gentoo.org/wiki/UEFI_Dual_boot_with_Windows_7/8.

The cores are all functioning properly under windows so it is not a malfunction. Just let me know if I need to output some more logs or data.

ThanksLast edited by Raspoetin on Tue Jul 07, 2015 8:05 pm; edited 1 time in total

----------

## NeddySeagoon

Raspoetin,

Welcome to Gentoo.

```
4.0.5-gentoo #3 SMP
```

tells that you have SMP in your kernel.

```
MAKEOPTS="-j5"
```

allows the build system to run 5 instances of make.

On the surface it all looks good.  There are a few corner cases where MAKEOPTS="j1" is forced by the ebuild, as parralel make is broken.

On bootup, how many tuxes do you see at the top of the screen?

None means you don't have the option set.

One means your kernel can only see one core.

Four is the right answer.

Try 

```
dmesg | grep x86
```

 I get 

```
$ dmesg | grep x86

[    0.183272] x86: Booting SMP configuration:

[    0.276371] x86: Booted up 1 node, 6 CPUs
```

What does your kernel tell you?

----------

## Raspoetin

Hey Neddy,

Thanks for the reply. I see 4 tux logos during boot, as I always did with previous kernel versions. Furthermore dmesg gives me

```
$ dmesg | grep x86

[    0.031976] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)

[    0.046581] x86: Booting SMP configuration:

[    0.086221] x86: Booted up 1 node, 4 CPUs
```

I've never had this problem before with kernels 3.x. I know that some package force MAKEOPTS="-j1" but for every single package I install only core #2 is used.

Also during internet browsing, video playback etc. only core #2....

Even a benchmark test like intel linpack is using a single thread only whereas it always used 4.

Luckily it's a pretty fast CPU so things don't get slowed down too bad but it is noticeable.

Could it be related to uefi because, besides the kernel version, that is pretty much the only thing I did different with this gentoo install.

----------

## albright

with sysbench you can explicitly set number of threads in

the cpu test -- it might be interesting to see what happens

when you ask for more than 1

----------

## Raspoetin

Hey albright,

thanks for the tip. I tried sysbench with 2 threads and 4. Same result for both, only core #2 was at 100% and the other 3 did nothing.

http://i.imgur.com/uwsy3o8.png

The weird thing is that the cores do get recognised by the kernel but just not get utilised....

----------

## schorsch_76

Is this a vserver or is it in a chroot? Is it limited via a cgroup to one core?

----------

## Raspoetin

 *Quote:*   

> 
> 
> Is this a vserver or is it in a chroot? Is it limited via a cgroup to one core?
> 
> 

 

Neither a vserver or in chroot. Just a regular desktop install with default kernel options (besides some specific video, sound, systemd etc. options). Also I've never used control groups.

----------

## MustrumR

Maybe for some reason the CPUs are disabled. Could you check

```

$ cat /sys/devices/system/cpu/cpu*/online

$ dmesg | grep smpboot -B 3

```

----------

## Raspoetin

Hey MustrumR,

here is the output:

```
$ cat /sys/devices/system/cpu/cpu*/online

1

1

1

```

So cpu1 - 3 seem to be online. For cpu0 I get: "cat: /sys/devices/system/cpu/cpu0/online: No such file or directory"

Maybe this is normal behaviour?

Furthermore:

```
$ dmesg | grep smpboot -B 3

[    0.000000] ACPI: IRQ9 used by override.

[    0.000000] Using ACPI (MADT) for SMP configuration information

[    0.000000] ACPI: HPET id: 0x8086a701 base: 0xfed00000                                                                      

[    0.000000] smpboot: Allowing 4 CPUs, 0 hotplug CPUs

--

[    0.037935] Freeing SMP alternatives memory: 20K (ffffffff819b7000 - ffffffff819bc000)                                      

[    0.042267] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1                                                            

[    0.052262] TSC deadline timer enabled                                                                                      

[    0.052264] smpboot: CPU0: Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz (fam: 06, model: 2a, stepping: 07)

--

[    0.052443] x86: Booting SMP configuration:

[    0.052444] .... node  #0, CPUs:      #1 #2 #3

[    0.092081] x86: Booted up 1 node, 4 CPUs

[    0.092083] smpboot: Total of 4 processors activated (26400.06 BogoMIPS)

```

It might be a problem with the CPU idle options that I enabled in the kernel config, going to disable them and post the results.

----------

## Raspoetin

In the kernel config I disabled: "cpuidle driver for intel processors", "intel enhanced speedstep", "intel pentium 4 clock modulation", and "intel p-state control", and did a reinstall

Still no difference. I also installed kernel 3.18.16 with the same kernel options as much as possible (most of them were autocompleted to match the current kernel options). 

After booting the downgraded kernel the problem was still there, so it might be something other than the kernel. 

Is there anything else that might affect CPU core utilisation in such a big way? Maybe something with the UEFI booting process that is going wrong? I have no idea where else to look.

----------

## albright

just wild guess: do you have hotplug_cpu enabled in kernel?

----------

## NeddySeagoon

Raspoetin,

Its scary that cpu0 has gone offline. Thats the only one you must have.

Is there anything in dmesg?

----------

## Raspoetin

 *Quote:*   

> just wild guess: do you have hotplug_cpu enabled in kernel?

 

It was indeed automatically enabled due to the fact that ARCH_SUSPEND_POSSIBLE [=y] and ARCH_HIBERNATION_POSSIBLE [=y]. Disabling both these options and hotplug cpu and then rebuilding the kernel did give me during boot "hotpluggable CPUs 0", but it didnt change anything for the multicore support.

 *Quote:*   

> Its scary that cpu0 has gone offline. Thats the only one you must have.
> 
> Is there anything in dmesg?
> 
> 

 

There is nothing in dmesg about cpu0. Even when I boot from a systemrescue USB I also get  "cat: /sys/devices/system/cpu/cpu0/online: No such file or directory"  but then all cores are functioning fine (checked this by doing a sysbench and linpack test). So it might be sort of normal.

I guess I'm gonna do a fresh install once again and check more closely for all the tips given here and post again when I have a cleaner and minimal install.

Thanks for all the help guys!

----------

## Raspoetin

I did a complete reinstall with the unstable branch, so kernel 4.1.1-r1. Somehow everything is working again now. I guess I'll never find out what went wrong there. 

Again, thanks for the help.

----------

## jfranz2

Make sure 

```
CONFIG_SMP=y
```

 is set in the kernel config

Description for configuration setting CONFIG_SMP ("CPU" refers to each core)

 *Quote:*   

> This enables support for systems with more than one CPU. If you have a system with only one CPU, say N. If you have a system with more than one CPU, say Y.
> 
> If you say N here, the kernel will run on uni- and multiprocessor machines, but will use only one CPU of a multiprocessor machine. If you say Y here, the kernel will run on many, but not all, uniprocessor machines. On a uniprocessor machine, the kernel will run faster if you say N here.
> 
> People using multiprocessor machines who say Y here should also say Y to "Enhanced Real Time Clock Support", below.

 

----------

