From patchwork Tue Feb 12 21:48:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1040877 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43zc1s50D2z9s4Z for ; Wed, 13 Feb 2019 08:56:49 +1100 (AEDT) Received: from localhost ([127.0.0.1]:46704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtg2p-0001OE-Mt for incoming@patchwork.ozlabs.org; Tue, 12 Feb 2019 16:56:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtg24-0001Bn-J0 for qemu-devel@nongnu.org; Tue, 12 Feb 2019 16:56:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtg1z-00052G-H1 for qemu-devel@nongnu.org; Tue, 12 Feb 2019 16:55:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43588) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtg1y-0004xH-CO; Tue, 12 Feb 2019 16:55:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 746861F8D7; Tue, 12 Feb 2019 21:48:37 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-204-62.brq.redhat.com [10.40.204.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEB081001F54; Tue, 12 Feb 2019 21:48:34 +0000 (UTC) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 22:48:25 +0100 Message-Id: <20190212214827.30543-3-lvivier@redhat.com> In-Reply-To: <20190212214827.30543-1-lvivier@redhat.com> References: <20190212214827.30543-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Feb 2019 21:48:37 +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] [RFC 2/4] numa: exit on incomplete CPU mapping X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Eduardo Habkost , qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Change the existing message to an error and exit. This message was a warning and comes with the information it will be removed in the future since May 10 2017 (ec78f8114bc4 "numa: use possible_cpus for not mapped CPUs check"). Update tests/numa-test to remove the incomplete CPU mapping test. Signed-off-by: Laurent Vivier --- hw/core/machine.c | 46 +++++++++++++++++++++------------------------- tests/numa-test.c | 20 -------------------- 2 files changed, 21 insertions(+), 45 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 077fbd182adf..7c74b318f635 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -873,51 +873,47 @@ static char *cpu_slot_to_string(const CPUArchId *cpu) static void machine_numa_finish_cpu_init(MachineState *machine) { int i; - bool default_mapping; + bool default_mapping = true; GString *s = g_string_new(NULL); MachineClass *mc = MACHINE_GET_CLASS(machine); const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine); + const CPUArchId *cpu_slot; assert(nb_numa_nodes); for (i = 0; i < possible_cpus->len; i++) { - if (possible_cpus->cpus[i].props.has_node_id) { - break; + cpu_slot = &possible_cpus->cpus[i]; + + if (cpu_slot->props.has_node_id) { + default_mapping = false; + } else { + /* record slots with not set mapping, */ + char *cpu_str = cpu_slot_to_string(cpu_slot); + g_string_append_printf(s, "%sCPU %d [%s]", + s->len ? ", " : "", i, cpu_str); + g_free(cpu_str); } } - default_mapping = (i == possible_cpus->len); + if (!default_mapping && s->len && !qtest_enabled()) { + error_report("CPU(s) not present in any NUMA nodes: %s", s->str); + error_report("All CPU(s) up to maxcpus must be described " + "in NUMA config"); + g_string_free(s, true); + exit(1); + } + g_string_free(s, true); for (i = 0; i < possible_cpus->len; i++) { - const CPUArchId *cpu_slot = &possible_cpus->cpus[i]; + cpu_slot = &possible_cpus->cpus[i]; if (!cpu_slot->props.has_node_id) { /* fetch default mapping from board and enable it */ CpuInstanceProperties props = cpu_slot->props; props.node_id = mc->get_default_cpu_node_id(machine, i); - if (!default_mapping) { - /* record slots with not set mapping, - * TODO: make it hard error in future */ - char *cpu_str = cpu_slot_to_string(cpu_slot); - g_string_append_printf(s, "%sCPU %d [%s]", - s->len ? ", " : "", i, cpu_str); - g_free(cpu_str); - - /* non mapped cpus used to fallback to node 0 */ - props.node_id = 0; - } - props.has_node_id = true; machine_set_cpu_numa_node(machine, &props, &error_fatal); } } - if (s->len && !qtest_enabled()) { - warn_report("CPU(s) not present in any NUMA nodes: %s", - s->str); - warn_report("All CPU(s) up to maxcpus should be described " - "in NUMA config, ability to start up with partial NUMA " - "mappings is obsoleted and will be removed in future"); - } - g_string_free(s, true); } void machine_run_board_init(MachineState *machine) diff --git a/tests/numa-test.c b/tests/numa-test.c index 9824fdd5875e..5280573fc992 100644 --- a/tests/numa-test.c +++ b/tests/numa-test.c @@ -55,25 +55,6 @@ static void test_mon_default(const void *data) g_free(cli); } -static void test_mon_partial(const void *data) -{ - char *s; - char *cli; - - cli = make_cli(data, "-smp 8 " - "-numa node,nodeid=0,cpus=0-1 " - "-numa node,nodeid=1,cpus=4-5 "); - qtest_start(cli); - - s = hmp("info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); - g_assert(strstr(s, "node 1 cpus: 4 5")); - g_free(s); - - qtest_end(); - g_free(cli); -} - static QList *get_cpus(QDict **resp) { *resp = qmp("{ 'execute': 'query-cpus' }"); @@ -333,7 +314,6 @@ int main(int argc, char **argv) qtest_add_data_func("/numa/mon/default", args, test_mon_default); qtest_add_data_func("/numa/mon/cpus/explicit", args, test_mon_explicit); - qtest_add_data_func("/numa/mon/cpus/partial", args, test_mon_partial); qtest_add_data_func("/numa/qmp/cpus/query-cpus", args, test_query_cpus); if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64")) {