Skip to content

3.3 Machine, CPU, SMP, NUMA and memory

Sylvain Girod edited this page Dec 21, 2019 · 1 revision

MACHINE

Machines types are defined in DATA/VMMgr_CPU:

MACHINE35="q35,accel=kvm"

And the machine for a vm can be specified with MACHINETPL:

MACHINETPL=MACHINE35

This is the default in VMMgr_.conf, but can be overriden in templates

CPU

CPU templates are defined in DATA/VMMgr_CPU:

PORTABLE="kvm64"
CPUHOST="host,+x2apic,+kvm_pv_eoi,+kvm_pv_unhalt,+kvm_nopiodelay"
CPUNESTED="host,+vmx,+x2apic,+kvm_pv_eoi,+kvm_pv_unhalt,+kvm_nopiodelay"

You can then use a template in vm config:

CPU=CPUHOST

SMP - NUMA

SMP and NUMA are defined together. By default, you just define one numa node (in Linux, even you are in SMP without NUMA, you have 1 numa node0)

Templates are defined in DATA/VMMgr_CPU:

SMP1="-smp 1,cores=1,threads=1,sockets=1,maxcpus=1"
SMP1HT=$(Set_Custom_SMP 1 1)
MAX=$(Map_SMP_1CPU $(Get_Total_CPUs))
SMP4HT=$(Set_Custom_SMP 1 1)
SMP1TOMAX=$(Map_SMP_1CPU)
SMPMAXNUMA=$(Map_SMP_1CPU $(Get_Total_CPUs) on)

Functions:

Map_SMP_1CPU take the first physical cpu, and create SMP matching this CPU, and one numa

Set_Custom_SMP allow to create custom smp, spécifing number of nodes, and number on sockets (the function detect if the CPU is HT, and create threads accordingly)

SMP1 is simply how to create 1 cpu (Info: for performance reason, specially for I/O, 2 CPU is recommended for a vm)

SMP1HT is the same, but detect HT, and set threads accordingly

MAX Get Max cpu cores/threads, and launch with all theses cpu (for example, an i7 with 8 Cores HT, we will have: "-smp 16,cores=8,threads=2,sockets=1,maxcpus=16"

SMP1TOMAX will just start with only 1 cpu: "-smp 1,cores=8,threads=2,sockets=1,maxcpus=16"

SMPMAXNUMA will create a numa node for each core in your cpu

SMP4NUMA create a 4 numa system, with the half cpu started

Note: Numa is core based, so 1 numa use both threads of a core.

In vm config you can then specify what SMP numa

SMPTPL=MAX

MEMORY

in vm config, MEM is required and it's always in GB (but without specify G ), MAXMEM is optional, in this case, MAXMEM will be (MEM * 2). If don't want to have extra memory, specify MAXMEM=$MEM

SLOT is required if you want to use MAXMEM, it define how many hotpluggable memory slots you want.

For example:

MEM=2
SLOT=2

Here we don't specify MAXMEM, so it will (MEM * 2).

Clone this wiki locally