echo 0,1,2,3,4,5,6,7 > /sys/devices/system/cpu/online
Output:
bash: /sys/devices/system/cpu/online: Permission denied
echo 0,1,2,3,4,5,6,7 > /sys/devices/system/cpu/online
Output:
bash: /sys/devices/system/cpu/online: Permission denied
On my machine /sys/devices/system/cpu/online is read-only.
Next try, I'll did:
added to: /etc/rc.local
/bin/touch /sys/devices/system/cpu/cpu1/online
/bin/touch /sys/devices/system/cpu/cpu3/online
/bin/touch /sys/devices/system/cpu/cpu5/online
/bin/touch /sys/devices/system/cpu/cpu7/online
/bin/sleep 2/bin/echo 1 > /sys/devices/system/cpu/cpu1/online
/bin/echo 1 > /sys/devices/system/cpu/cpu3/online
/bin/echo 1 > /sys/devices/system/cpu/cpu5/online
/bin/echo 1 > /sys/devices/system/cpu/cpu7/online
/bin/sleep 2/bin/echo 0,1,2,3,4,5,6,7 > /sys/devices/system/cpu/online
/bin/sleep 1
Rebooted... The file "online" are now present in /sys/devices/system/cpu/cpu1/ (3+5+7)
but with value 0, not 1.
cat /sys/devices/system/cpu/cpu1/online
= 0
I'm on root, damn...
/bin/echo 1 > /sys/devices/system/cpu/cpu1/online
/bin/echo: write error: Operation not permitted
tee: /sys/devices/system/cpu/cpu1/online: Operation not permitted
Here is my "sysctl.conf"
fs.suid_dumpable = 0
kernel.core_uses_pid = 1
kernel.dmesg_restrict = 1
kernel.kexec_load_disabled = 1
kernel.perf_event_paranoid = 2
kernel.pid_max = 32768
kernel.randomize_va_space = 2
kernel.threads-max = 47319
kernel.unprivileged_userns_clone = 0
vm.max_map_count = 262144
Maybee something prevent root to run commands?
Removed the above lines from my sysctl.conf, rebooted, same again, I can't set
core 1,3,5,7 online...
andy idea?
lscpu | grep CPU.s
Output:
CPU(s): 8
On-line CPU(s) list: 0,2,4,6
Off-line CPU(s) list: 1,3,5,7
NUMA node0 CPU(s): 0,2,4,6
lscpu | egrep 'NUMA|ore'
Output:
NUMA node(s): 1
Model name: AMD FX(tm)-8350 Eight-Core Processor
NUMA node0 CPU(s): 0,2,4,6
Hello mate2go
These reddit-threads shed some light on the matter:
[1] https://www.reddit.com/r/Amd/comments/5ipj0a/is_it_true_that_that_amd_fx_8350_8core_only_has_4/
[2] https://www.reddit.com/r/buildapc/comments/969s6p/amd_fx8350_only_showing_4_cores_in_linux/
If these comments are correct, I cannot say, but the true architectur of your "8-core" may be "4-with-a-strange-form-of-hyperthreading", which may have been "switched-off" by a kernel update.
One of the threads does suggest to check that hyper-threading is turned on in your BIOS settings.
Does any of that help?
@ alpinejohn, thanks for the infos, but that did not help for me.
A few days ago I have all 8 cores available.
look here:
lscpu
Output:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 48 bits physical, 48 bits virtual
CPU(s): 8
On-line CPU(s) list: 0,2,4,6
Off-line CPU(s) list: 1,3,5,7
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 21
Model: 2
Model name: AMD FX™-8350 Eight-Core Processor
Stepping: 0
CPU MHz: 4012.980
BogoMIPS: 8027.04
Virtualization: AMD-V
L1d cache: 16K
L1i cache: 64K
L2 cache: 2048K
L3 cache: 8192K
NUMA node0 CPU(s): 0,2,4,6
On-line CPU(s) list: 0,2,4,6
Off-line CPU(s) list: 1,3,5,7
You see that CPU 1,3,5,7 are offline and I don't know why.
I didn’t set a NUMA node0.
I did a test and tried another kernel “5.0.0-13-lowlatency" and "5.0.0.35-generic".
No luck.
The problem that only 4 CPU cores are displayed still exists.
Maybee, I can activate the offline cores 1,3,5,7 when I disable NUMA or add
core 1,3,57 to 2nd node (node1)
I am not familiar with NUMA (numactl) and do not know how to add CPU core 1,3,5,7 to another node (node1).
From what I can find about that processor, there is debate over its CPU design which gives it "4 modules with 2 cores each" for a total of 8 logical processors - which sounds like a different kind of Intel's HyperThreading.
You could have a look in the BIOS to see if changing any options related to how the processor cores are exposed to the OS makes any difference. Although I suspect there isn't anything to change.
I'm not sure if it's a kernel update or the AMD microcode.
You can downgrade amd64-microcode
package from the original 19.10 release:
Then lock the version with Synaptic and reboot.
If that still doesn't work, then a new kernel may have enforced mitigations for CPU vulnerabilities, which could be disabled by passing some command line parameters to the kernel. If you want to risk your system, I found some information here:
And we just got a new version of amd64-microcode:
From the changelog:
amd64-microcode (3.20191021.1+really3.20181128.1~ubuntu0.18.04.1) bionic-security; urgency=medium
* Revert to 3.20181128.1 version of microcode because of regressions on
certain hardware. (LP: #1853614)
-- Marc Deslauriers <[email protected]> Mon, 25 Nov 2019 14:52:06 -0500
@ lah7,
Before I updated my system 4 days ago I still had 8 cores.
Updated to:
5.0.0-36-generic
3.20191021.1ubuntu0.19.04.1
After that, the problems with my system started.
Only 4 CPU cores instead of 8 as before.
CPU core 1,3,5,7 are offline.
If I start with a Ubuntu-Mate 18.10 Live DVD, it detects
the 8 CPU cores without any problems.
Mitigations are on for CPU vulnerabilities. It worked for me with 8 cores.
I haven't changed anything on my system except updated it.
Also, I can't explain why CPU core 1,3,5,7 are out of order (set to: offline).
I'm back again, installed amd64-microcode64 (3.20181128.1)...
The problem is still there.
lscpu
CPU(s): 8
On-line CPU(s) list: 0,2,4,6
Off-line CPU(s) list: 1,3,5,7Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1NUMA node(s): 1
If I knew how to turn off the NUMA-node0.
Because this apparently switches CPU core 1,3,5,7 offline.
I also tried this one.
Added to grub. cfg:
numa=off numa_balancing=disable
Has no effect.
Maybe it would work if I add CPU core 1,3,5,7 to another NUMA node.
My idea is to create "NUMA node1" and set CPU core 1,3,5,7 online.
I can't figure out what the CPU cores 1,3,5,7 could have turned off.
Also, why do I have a NUMA node0 now?
Look here:
Can someone check his system to see if he also has a "node0"?
It must be possible to deactivate the NUMA node0 somehow so that all 8 CPU cores are available again.
as it was four days ago.
"numactl" ...from package "numactl"...
numactl --help
numactl: unrecognized option '--help'
usage: numactl [--all | -a] [--interleave= | -i ] [--preferred= | -p ]
[--physcpubind= | -C ] [--cpunodebind= | -N ]
[--membind= | -m ] [--localalloc | -l] command args ...
numactl [--show | -s]
numactl [--hardware | -H]
numactl [--length | -l ] [--offset | -o ] [--shmmode | -M ]
[--strict | -t]
[--shmid | -I ] --shm | -S
[--shmid | -I ] --file | -f
[--huge | -u] [--touch | -T]
memory policy | --dump | -d | --dump-nodes | -Dmemory policy is --interleave | -i, --preferred | -p, --membind | -m, --localalloc | -l
is a comma delimited list of node numbers or A-B ranges or all.
Instead of a number a node can also be:
netdev:DEV the node connected to network device DEV
file:PATH the node the block device of path is connected to
ip:HOST the node of the network device host routes through
block:PATH the node of block device path
pci:[seg:]bus:dev[:func] The node of a PCI device
is a comma delimited list of cpu numbers or A-B ranges or all
all ranges can be inverted with !
all numbers and ranges can be made cpuset-relative with +
the old --cpubind argument is deprecated.
use --cpunodebind or --physcpubind instead
can have g (GB), m (MB) or k (KB) suffixes
If I knew what the command would have to be called
deactivate NUMA node0 or
to add another node for CPU core 1,3,5,7.
Tried:
numactl -a --physcpubind=0 --cpunodebind=0 --membind=0
commad didn't work
Does anyone have an idea how the right command is to turn off NUMA?
The kernel should enumerate all of your cores and create settings in the "/sys/devices/system/cpu" pseudo filesystem. To check, look at "/sys/devices/system/cpu/cpu1/online" - if the core is online the file will have a 1 in it. If it is offline, 0. You should be able to turn on cpu1 by writing a 1 to that file as root -
For example:
sudo su -
(enter your password when requested)
echo 1 >/sys/devices/system/cpu/cpu1/online
... should turn cpu1 online.
I verified that I can turn cpu1 on and off via that file.
Now as to why the odd cores are turned off -- unless there is a vulnerability that requires that smt be turned off I don't know why the cores got turned off.
Check if /sys/devices/system/cpu/smt/control contains off. If so,
echo on >/sys/devices/system/cpu/smt/control
should turn on the additional cores.
HTH
djb
@ Dave_Barne,
I did:
su -
echo 1 >/sys/devices/system/cpu/cpu1/online
Output:
-bash: echo: write error: Operation not permitted
cat /sys/devices/system/cpu/smt/active
Output:
0
echo on > /sys/devices/system/cpu/smt/control
(was off)
cat /sys/devices/system/cpu/smt/control
Output:
on
Thanks a lot at Dave_Barne
My 8 cores are back now
I added to rc.local in /etc:
echo on > /sys/devices/system/cpu/smt/control
Also removed from cmdline in grub.cfg:
nosmt
Rebooted and now my 8 cores are back... great
lscpu
Output:
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Model name: AMD FX(tm)-8350 Eight-Core Processor
CPU MHz: 4012.887
Virtualization: AMD-V
NUMA node0 CPU(s): 0-7
numactl -H
Output:
available: 1 nodes (0)
node 0 cpus: 0 1 2 3 4 5 6 7
node 0 size: 32142 MB
node 0 free: 29459 MB
node distances:
node 0
0: 10
I'm so happy now
So the problem was the "nosmt" option in grub. You don't need the
"echo on > /sys/devices/system/cpu/smt/control"
line in rc.local then with "nosmt" removed.
djb