qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] numa: allow memory-less nodes when using memdev as backend
Date: Tue,  2 Jul 2019 10:07:44 -0400	[thread overview]
Message-ID: <20190702140745.27767-2-imammedo@redhat.com> (raw)
In-Reply-To: <20190702140745.27767-1-imammedo@redhat.com>

QEMU fails to start if memory-less node is present when memdev
is used
  qemu-system-x86_64 -object memory-backend-ram,id=ram0,size=128M \
                     -numa node -numa node,memdev=ram0
with error:
  "memdev option must be specified for either all or no nodes"

which works as expected if legacy 'mem' is used.

Fix check to make memory-less nodes valid when memdev option is used
but still disallow mix of mem and memdev options.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 numa.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/numa.c b/numa.c
index 91a29138a2..cdef332773 100644
--- a/numa.c
+++ b/numa.c
@@ -48,7 +48,8 @@ QemuOptsList qemu_numa_opts = {
     .desc = { { 0 } } /* validated with OptsVisitor */
 };
 
-static int have_memdevs = -1;
+static int have_memdevs;
+static int have_mem;
 static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
                              * For all nodes, nodeid < max_numa_nodeid
                              */
@@ -105,17 +106,11 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
         }
     }
 
-    if (node->has_mem && node->has_memdev) {
-        error_setg(errp, "cannot specify both mem= and memdev=");
-        return;
-    }
-
-    if (have_memdevs == -1) {
-        have_memdevs = node->has_memdev;
-    }
-    if (node->has_memdev != have_memdevs) {
-        error_setg(errp, "memdev option must be specified for either "
-                   "all or no nodes");
+    have_memdevs = have_memdevs ? : node->has_memdev;
+    have_mem = have_mem ? : node->has_mem;
+    if ((node->has_mem && have_memdevs) || (node->has_memdev && have_mem)) {
+        error_setg(errp, "numa configuration should use either mem= or memdev=,"
+                   "mixing both is not allowed");
         return;
     }
 
-- 
2.18.1



  reply	other threads:[~2019-07-02 14:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 18:47 [Qemu-devel] [PULL v2 00/29] Machine and x86 queue, 2019-06-28 Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 01/29] hw/boards: Add struct CpuTopology to MachineState Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 02/29] machine: Refactor smp-related call chains to pass MachineState Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 03/29] general: Replace global smp variables with smp machine properties Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 04/29] hw/ppc: Replace global smp variables with machine smp properties Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 05/29] hw/riscv: " Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 06/29] hw/s390x: " Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 07/29] hw/i386: " Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 08/29] hw/arm: " Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 09/29] hw: Replace global smp variables with MachineState for all remaining archs Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 10/29] vl.c: Replace smp global variables with smp machine properties Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 11/29] i386: Add die-level cpu topology to x86CPU on PCMachine Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 12/29] hw/i386: Adjust nr_dies with configured smp_dies for PCMachine Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 13/29] i386/cpu: Consolidate die-id validity in smp context Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 14/29] i386: Update new x86_apicid parsing rules with die_offset support Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 15/29] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size() Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 16/29] machine: show if CLI option '-numa node, mem' is supported in QAPI schema Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 17/29] numa: deprecate 'mem' parameter of '-numa node' option Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 18/29] numa: deprecate implict memory distribution between nodes Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 19/29] hppa: Delete unused hppa_cpu_list() function Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 20/29] target/i386: fix feature check in hyperv-stub.c Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 21/29] deprecate -mem-path fallback to anonymous RAM Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 22/29] i386: Don't print warning if phys-bits was set automatically Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 23/29] i386: Fix signedness of hyperv_spinlock_attempts Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 24/29] i386: make 'hv-spinlocks' a regular uint32 property Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 25/29] x86/cpu: use FeatureWordArray to define filtered_features Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 26/29] i386: Remove unused host_cpudef variable Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 27/29] target/i386: Add CPUID.1F generation support for multi-dies PCMachine Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 28/29] machine: Refactor smp_parse() in vl.c as MachineClass::smp_parse() Eduardo Habkost
2019-06-28 18:47 ` [Qemu-devel] [PULL v2 29/29] vl.c: Add -smp, dies=* command line support and update doc Eduardo Habkost
2019-07-02 10:48 ` [Qemu-devel] [PULL v2 00/29] Machine and x86 queue, 2019-06-28 Peter Maydell
2019-07-02 11:44   ` Igor Mammedov
2019-07-02 14:07   ` [Qemu-devel] [PATCH 0/2] fix memory-less numa configuration and switch to memdev syntax in tests Igor Mammedov
2019-07-02 14:07     ` Igor Mammedov [this message]
2019-07-02 14:07     ` [Qemu-devel] [PATCH 2/2] tests: use -numa memdev option in tests instead of legacy 'mem' option Igor Mammedov
2019-07-02 17:19       ` Eduardo Habkost
2019-07-02 22:03         ` Eduardo Habkost
2019-07-03 12:13           ` Igor Mammedov
2019-07-02 19:58     ` [Qemu-devel] [PATCH 0/2] fix memory-less numa configuration and switch to memdev syntax in tests no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190702140745.27767-2-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).