CPU index (6) should be smaller than maxcpus (4)

alex.tls

Member
Oct 17, 2020
35
0
11
40
I tried to make CPU affinity to work on my VM, but I can't.
This is my configure for my vm:

Code:
root@pve:/etc/pve/qemu-server# cat 600.conf
agent: 1
boot: order=scsi0;net0
cores: 4
hotplug: disk,network,usb
machine: pc-i440fx-6.0
memory: 4096
name: win10-1
net0: virtio=5A:DD:1C:E8:A3:85,bridge=vmbr0,firewall=1
numa: 1
numa1: cpus=6-9,hostnodes=1,memory=4096,policy=bind
ostype: win10
scsi0: vms:vm-600-disk-0,size=60G
scsihw: virtio-scsi-pci
smbios1: uuid=6177b506-9db7-455f-9beb-3e382c3c152a
sockets: 1
vmgenid: 0e72f937-4e16-4fd8-80a3-4de7c70c3201

This is my host CPU topology:
Code:
root@pve:/etc/pve/qemu-server# numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 12 13 14 15 16 17
node 0 size: 32169 MB
node 0 free: 22073 MB
node 1 cpus: 6 7 8 9 10 11 18 19 20 21 22 23
node 1 size: 32218 MB
node 1 free: 24006 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10

When I start my VM , it showed me bellow error:
Code:
kvm: -numa node,nodeid=1,cpus=6-9,memdev=ram-node1: CPU index (6) should be smaller than maxcpus (4)
TASK ERROR: start failed: QEMU exited with code 1

What's wrong on my configuration ? anyone can help ?
 
If I disable NUMA by set it to 0 numa: 0 , then I can start my VM , but I found CPU affinity didn't work via
Code:
root@pve:/etc/pve/qemu-server# taskset --all-tasks --pid "$(< /run/qemu-server/600.pid)"
pid 1190387's current affinity mask: ffffff
pid 1190388's current affinity mask: ffffff
pid 1190427's current affinity mask: ffffff
pid 1190428's current affinity mask: ffffff
pid 1190429's current affinity mask: ffffff
pid 1190430's current affinity mask: ffffff
pid 1190433's current affinity mask: ffffff

The mask ffffff (0xFFFFFFFF) means all processors which is from #0 through #last. so my VM still on running on all CPU , not just I defined cpus 6-9.

So weird!
 
Looking at the documentation and the error message, I would say that you specify which cores are in which NUMA group. Therefore, cpus must be a subset of 0-3 (the 4 virtual cores) and you specify to which NUMA node you want them to belong via hostnodes.
I don't think this supports CPU pinning (mapping virtual to physical cores), only specifying which virtual cores should run on which physical NUMA node.
 
1630138432262.png
The document doesn't mention the parameter of cpus= is not mapping virtual cores to physical cores , if it does , then my configuration should be no problem.
If it's not mapping virtual cores to physical cores , then the numactl --hardware lost its meaning.
 
You should use a range of values for "cpus" less than the value for "cores".
For example:
Code:
cores: 4
numa: 1
numa1: cpus=0-3,hostnodes=1,memory=4096,policy=bind
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!