From patchwork Tue Jul 2 15:35:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1126417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45dWBj4Qr6z9s00 for ; Wed, 3 Jul 2019 03:17:17 +1000 (AEST) Received: from localhost ([::1]:55502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiMP4-0005oy-9V for incoming@patchwork.ozlabs.org; Tue, 02 Jul 2019 13:17:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38214) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiKqd-00016E-Kz for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiKqc-000781-8X for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:37:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hiKqb-000777-Vn for qemu-devel@nongnu.org; Tue, 02 Jul 2019 11:37:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B1778F916; Tue, 2 Jul 2019 15:37:33 +0000 (UTC) Received: from localhost (ovpn-116-30.gru2.redhat.com [10.97.116.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB97A5D6A9; Tue, 2 Jul 2019 15:37:32 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org, Marcel Apfelbaum , Richard Henderson Date: Tue, 2 Jul 2019 12:35:34 -0300 Message-Id: <20190702153535.9851-42-ehabkost@redhat.com> In-Reply-To: <20190702153535.9851-1-ehabkost@redhat.com> References: <20190702153535.9851-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 02 Jul 2019 15:37:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v3 41/42] numa: allow memory-less nodes when using memdev as backend X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov 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 Message-Id: <20190702140745.27767-2-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- numa.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/numa.c b/numa.c index 48fd43ecc6..1824c4e049 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 */ @@ -106,17 +107,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; }