Skip to content

Commit 32a354d

Browse files
Igor Mammedovbonzini
authored andcommitted
numa: forbid '-numa node, mem' for 5.1 and newer machine types
Deprecation period is run out and it's a time to flip the switch introduced by cd5ff83. Disable legacy option for new machine types (since 5.1) and amend documentation. '-numa node,memdev' shall be used instead of disabled option with new machine types. Signed-off-by: Igor Mammedov <[email protected]> Reviewed-by: Michal Privoznik <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Greg Kurz <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent f991911 commit 32a354d

File tree

8 files changed

+36
-24
lines changed

8 files changed

+36
-24
lines changed

docs/system/deprecated.rst

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,6 @@ error in the future.
9595
The ``-realtime mlock=on|off`` argument has been replaced by the
9696
``-overcommit mem-lock=on|off`` argument.
9797

98-
``-numa node,mem=``\ *size* (since 4.1)
99-
'''''''''''''''''''''''''''''''''''''''
100-
101-
The parameter ``mem`` of ``-numa node`` is used to assign a part of
102-
guest RAM to a NUMA node. But when using it, it's impossible to manage specified
103-
RAM chunk on the host side (like bind it to a host node, setting bind policy, ...),
104-
so guest end-ups with the fake NUMA configuration with suboptiomal performance.
105-
However since 2014 there is an alternative way to assign RAM to a NUMA node
106-
using parameter ``memdev``, which does the same as ``mem`` and adds
107-
means to actualy manage node RAM on the host side. Use parameter ``memdev``
108-
with *memory-backend-ram* backend as an replacement for parameter ``mem``
109-
to achieve the same fake NUMA effect or a properly configured
110-
*memory-backend-file* backend to actually benefit from NUMA configuration.
111-
In future new machine versions will not accept the option but it will still
112-
work with old machine types. User can check QAPI schema to see if the legacy
113-
option is supported by looking at MachineInfo::numa-mem-supported property.
114-
11598
``-numa`` node (without memory specified) (since 4.1)
11699
'''''''''''''''''''''''''''''''''''''''''''''''''''''
117100

@@ -553,3 +536,23 @@ long starting at 1MiB, the old command::
553536
can be rewritten as::
554537

555538
qemu-nbd -t --image-opts driver=raw,offset=1M,size=100M,file.driver=qcow2,file.file.driver=file,file.file.filename=file.qcow2
539+
540+
Command line options
541+
--------------------
542+
543+
``-numa node,mem=``\ *size* (removed in 5.1)
544+
''''''''''''''''''''''''''''''''''''''''''''
545+
546+
The parameter ``mem`` of ``-numa node`` was used to assign a part of
547+
guest RAM to a NUMA node. But when using it, it's impossible to manage a specified
548+
RAM chunk on the host side (like bind it to a host node, setting bind policy, ...),
549+
so the guest ends up with the fake NUMA configuration with suboptiomal performance.
550+
However since 2014 there is an alternative way to assign RAM to a NUMA node
551+
using parameter ``memdev``, which does the same as ``mem`` and adds
552+
means to actually manage node RAM on the host side. Use parameter ``memdev``
553+
with *memory-backend-ram* backend as replacement for parameter ``mem``
554+
to achieve the same fake NUMA effect or a properly configured
555+
*memory-backend-file* backend to actually benefit from NUMA configuration.
556+
New machine versions (since 5.1) will not accept the option but it will still
557+
work with old machine types. User can check the QAPI schema to see if the legacy
558+
option is supported by looking at MachineInfo::numa-mem-supported property.

hw/arm/virt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,6 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
23202320
hc->plug = virt_machine_device_plug_cb;
23212321
hc->unplug_request = virt_machine_device_unplug_request_cb;
23222322
hc->unplug = virt_machine_device_unplug_cb;
2323-
mc->numa_mem_supported = true;
23242323
mc->nvdimm_supported = true;
23252324
mc->auto_enable_numa_with_memhp = true;
23262325
mc->default_ram_id = "mach-virt.ram";
@@ -2434,6 +2433,7 @@ static void virt_machine_5_0_options(MachineClass *mc)
24342433
{
24352434
virt_machine_5_1_options(mc);
24362435
compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len);
2436+
mc->numa_mem_supported = true;
24372437
}
24382438
DEFINE_VIRT_MACHINE(5, 0)
24392439

hw/core/numa.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
117117
}
118118

119119
if (node->has_mem) {
120+
if (!mc->numa_mem_supported) {
121+
error_setg(errp, "Parameter -numa node,mem is not supported by this"
122+
" machine type");
123+
error_append_hint(errp, "Use -numa node,memdev instead\n");
124+
return;
125+
}
126+
120127
numa_info[nodenr].node_mem = node->mem;
121128
if (!qtest_enabled()) {
122129
warn_report("Parameter -numa node,mem is deprecated,"

hw/i386/pc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
19801980
hc->unplug = pc_machine_device_unplug_cb;
19811981
mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE;
19821982
mc->nvdimm_supported = true;
1983-
mc->numa_mem_supported = true;
19841983
mc->default_ram_id = "pc.ram";
19851984

19861985
object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size",

hw/i386/pc_piix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ static void pc_i440fx_5_0_machine_options(MachineClass *m)
441441
pc_i440fx_5_1_machine_options(m);
442442
m->alias = NULL;
443443
m->is_default = false;
444+
m->numa_mem_supported = true;
444445
compat_props_add(m->compat_props, hw_compat_5_0, hw_compat_5_0_len);
445446
compat_props_add(m->compat_props, pc_compat_5_0, pc_compat_5_0_len);
446447
}

hw/i386/pc_q35.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static void pc_q35_5_0_machine_options(MachineClass *m)
369369
{
370370
pc_q35_5_1_machine_options(m);
371371
m->alias = NULL;
372+
m->numa_mem_supported = true;
372373
compat_props_add(m->compat_props, hw_compat_5_0, hw_compat_5_0_len);
373374
compat_props_add(m->compat_props, pc_compat_5_0, pc_compat_5_0_len);
374375
}

hw/ppc/spapr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4510,7 +4510,6 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
45104510
* in which LMBs are represented and hot-added
45114511
*/
45124512
mc->numa_mem_align_shift = 28;
4513-
mc->numa_mem_supported = true;
45144513
mc->auto_enable_numa = true;
45154514

45164515
smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF;
@@ -4598,6 +4597,7 @@ static void spapr_machine_5_0_class_options(MachineClass *mc)
45984597
{
45994598
spapr_machine_5_1_class_options(mc);
46004599
compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len);
4600+
mc->numa_mem_supported = true;
46014601
}
46024602

46034603
DEFINE_SPAPR_MACHINE(5_0, "5.0", false);

qemu-options.hx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,11 @@ SRST
239239
-numa node,nodeid=0 -numa node,nodeid=1 \
240240
-numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
241241

242-
'\ ``mem``\ ' assigns a given RAM amount to a node. '\ ``memdev``\ '
243-
assigns RAM from a given memory backend device to a node. If
244-
'\ ``mem``\ ' and '\ ``memdev``\ ' are omitted in all nodes, RAM is
245-
split equally between them.
242+
Legacy '\ ``mem``\ ' assigns a given RAM amount to a node (not supported
243+
for 5.1 and newer machine types). '\ ``memdev``\ ' assigns RAM from
244+
a given memory backend device to a node. If '\ ``mem``\ ' and
245+
'\ ``memdev``\ ' are omitted in all nodes, RAM is split equally between them.
246+
246247

247248
'\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive.
248249
Furthermore, if one node uses '\ ``memdev``\ ', all of them have to

0 commit comments

Comments
 (0)