From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508171137398133.3664587009439; Mon, 16 Oct 2017 09:25:37 -0700 (PDT) Received: from localhost ([::1]:33983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Cb-0005hy-Dr for importer@patchew.org; Mon, 16 Oct 2017 12:25:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48An-0004Yc-IR for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48Ak-000710-A1 for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54768) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48Ak-00070C-1i for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29CC9C04AC60; Mon, 16 Oct 2017 16:23:21 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 446A261349; Mon, 16 Oct 2017 16:23:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 29CC9C04AC60 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:51 +0200 Message-Id: <1508170976-96869-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 16 Oct 2017 16:23:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 1/6] numa: postpone options post-processing till machine_run_board_init() 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" in preparation for numa options to being handled via QMP before machine_run_board_init(), move final numa configuration checks and processing to machine_run_board_init() so it could take into account both CLI (via parse_numa_opts()) and QMP input Signed-off-by: Igor Mammedov Reviewed-by: David Gibson --- include/sysemu/numa.h | 1 + hw/core/machine.c | 5 +++-- numa.c | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 5c6df28..c19e456 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -31,6 +31,7 @@ struct NumaNodeMem { =20 extern NodeInfo numa_info[MAX_NODES]; void parse_numa_opts(MachineState *ms); +void numa_complete_configuration(MachineState *ms); void query_numa_node_mem(NumaNodeMem node_mem[]); extern QemuOptsList qemu_numa_opts; void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); diff --git a/hw/core/machine.c b/hw/core/machine.c index 80647ed..f482211 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -701,7 +701,7 @@ static char *cpu_slot_to_string(const CPUArchId *cpu) return g_string_free(s, false); } =20 -static void machine_numa_finish_init(MachineState *machine) +static void machine_numa_finish_cpu_init(MachineState *machine) { int i; bool default_mapping; @@ -756,7 +756,8 @@ void machine_run_board_init(MachineState *machine) MachineClass *machine_class =3D MACHINE_GET_CLASS(machine); =20 if (nb_numa_nodes) { - machine_numa_finish_init(machine); + numa_complete_configuration(machine); + machine_numa_finish_cpu_init(machine); } machine_class->init(machine); } diff --git a/numa.c b/numa.c index 8d78d95..18af4ff 100644 --- a/numa.c +++ b/numa.c @@ -424,15 +424,11 @@ void numa_default_auto_assign_ram(MachineClass *mc, N= odeInfo *nodes, nodes[i].node_mem =3D size - usedmem; } =20 -void parse_numa_opts(MachineState *ms) +void numa_complete_configuration(MachineState *ms) { int i; MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 - if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) { - exit(1); - } - assert(max_numa_nodeid <=3D MAX_NODES); =20 /* No support for sparse NUMA node IDs yet: */ @@ -508,6 +504,13 @@ void parse_numa_opts(MachineState *ms) } } =20 +void parse_numa_opts(MachineState *ms) +{ + if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) { + exit(1); + } +} + void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **er= rp) { int node_id =3D object_property_get_int(OBJECT(dev), "node-id", &error= _abort); --=20 2.7.4 From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508171134930946.1681757206542; Mon, 16 Oct 2017 09:25:34 -0700 (PDT) Received: from localhost ([::1]:33984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Cg-0005jv-Gj for importer@patchew.org; Mon, 16 Oct 2017 12:25:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48An-0004Yq-Sv for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48Am-00072b-O8 for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48Am-000726-GE for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 782BBC0587DF; Mon, 16 Oct 2017 16:23:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70F4E600CE; Mon, 16 Oct 2017 16:23:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 782BBC0587DF Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:52 +0200 Message-Id: <1508170976-96869-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 16 Oct 2017 16:23:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 2/6] numa: split out NumaOptions parsing into parse_NumaOptions() 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" it will allow to reuse parse_NumaOptions() for parsing configuration commands received via QMP interface Signed-off-by: Igor Mammedov --- include/sysemu/numa.h | 1 + numa.c | 48 +++++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index c19e456..aad4230 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -30,6 +30,7 @@ struct NumaNodeMem { }; =20 extern NodeInfo numa_info[MAX_NODES]; +int parse_numa(void *opaque, QemuOpts *opts, Error **errp); void parse_numa_opts(MachineState *ms); void numa_complete_configuration(MachineState *ms); void query_numa_node_mem(NumaNodeMem node_mem[]); diff --git a/numa.c b/numa.c index 18af4ff..d8e7dc0 100644 --- a/numa.c +++ b/numa.c @@ -254,28 +254,11 @@ static void parse_numa_distance(NumaDistOptions *dist= , Error **errp) have_numa_distance =3D true; } =20 -static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) +static +void parse_NumaOptions(MachineState *ms, NumaOptions *object, Error **errp) { - NumaOptions *object =3D NULL; - MachineState *ms =3D opaque; Error *err =3D NULL; =20 - { - Visitor *v =3D opts_visitor_new(opts); - visit_type_NumaOptions(v, NULL, &object, &err); - visit_free(v); - } - - if (err) { - goto end; - } - - /* Fix up legacy suffix-less format */ - if ((object->type =3D=3D NUMA_OPTIONS_TYPE_NODE) && object->u.node.has= _mem) { - const char *mem_str =3D qemu_opt_get(opts, "mem"); - qemu_strtosz_MiB(mem_str, NULL, &object->u.node.mem); - } - switch (object->type) { case NUMA_OPTIONS_TYPE_NODE: parse_numa_node(ms, &object->u.node, &err); @@ -310,6 +293,33 @@ static int parse_numa(void *opaque, QemuOpts *opts, Er= ror **errp) } =20 end: + if (err) { + error_propagate(errp, err); + } +} + +int parse_numa(void *opaque, QemuOpts *opts, Error **errp) +{ + NumaOptions *object =3D NULL; + MachineState *ms =3D MACHINE(opaque); + Error *err =3D NULL; + Visitor *v =3D opts_visitor_new(opts); + + visit_type_NumaOptions(v, NULL, &object, &err); + visit_free(v); + if (err) { + goto end; + } + + /* Fix up legacy suffix-less format */ + if ((object->type =3D=3D NUMA_OPTIONS_TYPE_NODE) && object->u.node.has= _mem) { + const char *mem_str =3D qemu_opt_get(opts, "mem"); + qemu_strtosz_MiB(mem_str, NULL, &object->u.node.mem); + } + + parse_NumaOptions(ms, object, &err); + +end: qapi_free_NumaOptions(object); if (err) { error_report_err(err); --=20 2.7.4 From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508171138350969.7335169855921; Mon, 16 Oct 2017 09:25:38 -0700 (PDT) Received: from localhost ([::1]:33985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Co-0005rr-B9 for importer@patchew.org; Mon, 16 Oct 2017 12:25:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Ar-0004bg-Fr for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48Aq-00077a-AT for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56344) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48Aq-00076a-1A for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 177C07F755; Mon, 16 Oct 2017 16:23:27 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C086B600CE; Mon, 16 Oct 2017 16:23:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 177C07F755 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:53 +0200 Message-Id: <1508170976-96869-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 16 Oct 2017 16:23:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/6] possible_cpus: add CPUArchId::type field 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For enabling early cpu to numa node configuration at runtime qmp_query_hotpluggable_cpus() should provide a list of available cpu slots at early stage, before machine_init() is called and the 1st cpu is created, so that mgmt might be able to call it and use output to set numa mapping. Use MachineClass::possible_cpu_arch_ids() callback to set cpu type info, along with the rest of possible cpu properties, to let machine define which cpu type* will be used. * for SPAPR it will be a spapr core type and for ARM/s390x/x86 a respective descendant of CPUClass. Signed-off-by: Igor Mammedov --- include/hw/boards.h | 2 ++ hw/arm/virt.c | 3 ++- hw/core/machine.c | 12 ++++++------ hw/i386/pc.c | 4 +++- hw/ppc/spapr.c | 13 ++++++++----- hw/s390x/s390-virtio-ccw.c | 1 + 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 156e0a5..2c3e958 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -80,6 +80,7 @@ void machine_set_cpu_numa_node(MachineState *machine, * CPUArchId: * @arch_id - architecture-dependent CPU ID of present or possible CPU * @cpu - pointer to corresponding CPU object if it's present on NULL othe= rwise + * @type - QOM class name of possible @cpu object * @props - CPU object properties, initialized by board * #vcpus_count - number of threads provided by @cpu object */ @@ -88,6 +89,7 @@ typedef struct { int64_t vcpus_count; CpuInstanceProperties props; Object *cpu; + const char *type; } CPUArchId; =20 /** diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9e18b41..88319db 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1357,7 +1357,7 @@ static void machvirt_init(MachineState *machine) break; } =20 - cpuobj =3D object_new(machine->cpu_type); + cpuobj =3D object_new(possible_cpus->cpus[n].type); object_property_set_int(cpuobj, possible_cpus->cpus[n].arch_id, "mp-affinity", NULL); =20 @@ -1573,6 +1573,7 @@ static const CPUArchIdList *virt_possible_cpu_arch_id= s(MachineState *ms) sizeof(CPUArchId) * max_cpus); ms->possible_cpus->len =3D max_cpus; for (n =3D 0; n < ms->possible_cpus->len; n++) { + ms->possible_cpus->cpus[n].type =3D ms->cpu_type; ms->possible_cpus->cpus[n].arch_id =3D virt_cpu_mp_affinity(vms, n); ms->possible_cpus->cpus[n].props.has_thread_id =3D true; diff --git a/hw/core/machine.c b/hw/core/machine.c index f482211..1e1fca5 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -363,18 +363,18 @@ static void machine_init_notify(Notifier *notifier, v= oid *data) HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) { int i; - Object *cpu; HotpluggableCPUList *head =3D NULL; - const char *cpu_type; + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + + /* force board to initialize possible_cpus if it hasn't been done yet = */ + mc->possible_cpu_arch_ids(machine); =20 - cpu =3D machine->possible_cpus->cpus[0].cpu; - assert(cpu); /* Boot cpu is always present */ - cpu_type =3D object_get_typename(cpu); for (i =3D 0; i < machine->possible_cpus->len; i++) { + Object *cpu; HotpluggableCPUList *list_item =3D g_new0(typeof(*list_item), 1); HotpluggableCPU *cpu_item =3D g_new0(typeof(*cpu_item), 1); =20 - cpu_item->type =3D g_strdup(cpu_type); + cpu_item->type =3D g_strdup(machine->possible_cpus->cpus[i].type); cpu_item->vcpus_count =3D machine->possible_cpus->cpus[i].vcpus_co= unt; cpu_item->props =3D g_memdup(&machine->possible_cpus->cpus[i].prop= s, sizeof(*cpu_item->props)); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 8e307f7..99afb2f1 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1147,7 +1147,8 @@ void pc_cpus_init(PCMachineState *pcms) pcms->apic_id_limit =3D x86_cpu_apic_id_from_index(max_cpus - 1) + 1; possible_cpus =3D mc->possible_cpu_arch_ids(ms); for (i =3D 0; i < smp_cpus; i++) { - pc_new_cpu(ms->cpu_type, possible_cpus->cpus[i].arch_id, &error_fa= tal); + pc_new_cpu(possible_cpus->cpus[i].type, possible_cpus->cpus[i].arc= h_id, + &error_fatal); } } =20 @@ -2269,6 +2270,7 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids(= MachineState *ms) for (i =3D 0; i < ms->possible_cpus->len; i++) { X86CPUTopoInfo topo; =20 + ms->possible_cpus->cpus[i].type =3D ms->cpu_type; ms->possible_cpus->cpus[i].vcpus_count =3D 1; ms->possible_cpus->cpus[i].arch_id =3D x86_cpu_apic_id_from_index(= i); x86_topo_ids_from_apicid(ms->possible_cpus->cpus[i].arch_id, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 29de845..9f455e8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2129,11 +2129,6 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) int boot_cores_nr =3D smp_cpus / smp_threads; int i; =20 - if (!type) { - error_report("Unable to find sPAPR CPU Core definition"); - exit(1); - } - possible_cpus =3D mc->possible_cpu_arch_ids(machine); if (mc->has_hotpluggable_cpus) { if (smp_cpus % smp_threads) { @@ -3419,6 +3414,7 @@ static int64_t spapr_get_default_cpu_node_id(const Ma= chineState *ms, int idx) static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *mach= ine) { int i; + const char *core_type; int spapr_max_cores =3D max_cpus / smp_threads; MachineClass *mc =3D MACHINE_GET_CLASS(machine); =20 @@ -3430,12 +3426,19 @@ static const CPUArchIdList *spapr_possible_cpu_arch= _ids(MachineState *machine) return machine->possible_cpus; } =20 + core_type =3D spapr_get_cpu_core_type(machine->cpu_type); + if (!core_type) { + error_report("Unable to find sPAPR CPU Core definition"); + exit(1); + } + machine->possible_cpus =3D g_malloc0(sizeof(CPUArchIdList) + sizeof(CPUArchId) * spapr_max_cores); machine->possible_cpus->len =3D spapr_max_cores; for (i =3D 0; i < machine->possible_cpus->len; i++) { int core_id =3D i * smp_threads; =20 + machine->possible_cpus->cpus[i].type =3D core_type; machine->possible_cpus->cpus[i].vcpus_count =3D smp_threads; machine->possible_cpus->cpus[i].arch_id =3D core_id; machine->possible_cpus->cpus[i].props.has_core_id =3D true; diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index f64db51..ae73fb6 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -385,6 +385,7 @@ static const CPUArchIdList *s390_possible_cpu_arch_ids(= MachineState *ms) sizeof(CPUArchId) * max_cpus); ms->possible_cpus->len =3D max_cpus; for (i =3D 0; i < ms->possible_cpus->len; i++) { + ms->possible_cpus->cpus[i].type =3D ms->cpu_type; ms->possible_cpus->cpus[i].vcpus_count =3D 1; ms->possible_cpus->cpus[i].arch_id =3D i; ms->possible_cpus->cpus[i].props.has_core_id =3D true; --=20 2.7.4 From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150817125489718.36808253061281; Mon, 16 Oct 2017 09:27:34 -0700 (PDT) Received: from localhost ([::1]:33997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Eg-0007lu-37 for importer@patchew.org; Mon, 16 Oct 2017 12:27:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48B0-0004j9-37 for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48Au-0007Bc-2F for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51486) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48At-0007AW-Oi for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD48B806B1; Mon, 16 Oct 2017 16:23:30 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F0C8600CE; Mon, 16 Oct 2017 16:23:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BD48B806B1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:54 +0200 Message-Id: <1508170976-96869-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 16 Oct 2017 16:23:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 4/6] CLI: add -paused option 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- include/sysemu/sysemu.h | 1 + qemu-options.hx | 15 ++++++++++++++ qmp.c | 5 +++++ vl.c | 54 +++++++++++++++++++++++++++++++++++++++++++++= +++- 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b213696..3feb94f 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -66,6 +66,7 @@ typedef enum WakeupReason { QEMU_WAKEUP_REASON_OTHER, } WakeupReason; =20 +void qemu_exit_preconfig_request(void); void qemu_system_reset_request(ShutdownCause reason); void qemu_system_suspend_request(void); void qemu_register_suspend_notifier(Notifier *notifier); diff --git a/qemu-options.hx b/qemu-options.hx index 39225ae..bd44db8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3498,6 +3498,21 @@ STEXI Run the emulation in single step mode. ETEXI =20 +DEF("paused", HAS_ARG, QEMU_OPTION_paused, \ + "-paused [state=3D]postconf|preconf\n" + " postconf: pause QEMU after machine is initialized\n" + " preconf: pause QEMU before machine is initialized\n", + QEMU_ARCH_ALL) +STEXI +@item -paused +@findex -paused +if set enabled interactive configuration stages before machine emulation s= tarts. +'postconf' option value mimics -S option behaviour where machine is created +but emulation isn't started. 'preconf' option value pauses QEMU before mac= hine +is created, which allows to query and configure properties affecting machi= ne +initialization. Use monitor/QMP command 'cont' to go to exit paused state. +ETEXI + DEF("S", 0, QEMU_OPTION_S, \ "-S freeze CPU at startup (use 'c' to start execution)\n", QEMU_ARCH_ALL) diff --git a/qmp.c b/qmp.c index e8c3031..49e9a5c 100644 --- a/qmp.c +++ b/qmp.c @@ -167,6 +167,11 @@ void qmp_cont(Error **errp) BlockBackend *blk; Error *local_err =3D NULL; =20 + if (runstate_check(RUN_STATE_PRELAUNCH)) { + qemu_exit_preconfig_request(); + return; + } + /* if there is a dump in background, we should wait until the dump * finished */ if (dump_in_progress()) { diff --git a/vl.c b/vl.c index 3fed457..30631fd 100644 --- a/vl.c +++ b/vl.c @@ -555,6 +555,20 @@ static QemuOptsList qemu_fw_cfg_opts =3D { }, }; =20 +static QemuOptsList qemu_paused_opts =3D { + .name =3D "paused", + .implied_opt_name =3D "state", + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_paused_opts.head), + .desc =3D { + { + .name =3D "state", + .type =3D QEMU_OPT_STRING, + .help =3D "Pause state of QEMU on startup", + }, + { /* end of list */ } + }, +}; + /** * Get machine options * @@ -1689,6 +1703,11 @@ static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; +static enum { + PRECONFIG_CONT =3D 0, + PRECONFIG_PAUSE, + PRECONFIG_SKIP, +} preconfig_requested; static WakeupReason wakeup_reason; static NotifierList powerdown_notifiers =3D NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); @@ -1773,6 +1792,11 @@ static int qemu_debug_requested(void) return r; } =20 +void qemu_exit_preconfig_request(void) +{ + preconfig_requested =3D PRECONFIG_CONT; +} + /* * Reset the VM. Issue an event unless @reason is SHUTDOWN_CAUSE_NONE. */ @@ -1939,6 +1963,12 @@ static bool main_loop_should_exit(void) RunState r; ShutdownCause request; =20 + if (runstate_check(RUN_STATE_PRELAUNCH)) { + if (preconfig_requested =3D=3D PRECONFIG_CONT) { + preconfig_requested =3D PRECONFIG_SKIP; + return true; + } + } if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } @@ -3177,6 +3207,7 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_icount_opts); qemu_add_opts(&qemu_semihosting_config_opts); qemu_add_opts(&qemu_fw_cfg_opts); + qemu_add_opts(&qemu_paused_opts); module_call_init(MODULE_INIT_OPTS); =20 runstate_init(); @@ -3845,6 +3876,26 @@ int main(int argc, char **argv, char **envp) exit(1); } break; + case QEMU_OPTION_paused: + { + const char *value; + + opts =3D qemu_opts_parse_noisily(qemu_find_opts("pause= d"), + optarg, true); + if (opts =3D=3D NULL) { + exit(1); + } + value =3D qemu_opt_get(opts, "state"); + if (!strcmp(value, "postconf")) { + autostart =3D 0; + } else if (!strcmp(value, "preconf")) { + preconfig_requested =3D PRECONFIG_PAUSE; + } else { + error_report("incomplete '-paused' option\n"); + exit(1); + } + break; + } case QEMU_OPTION_enable_kvm: olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "accel=3Dkvm", false); @@ -4731,7 +4782,6 @@ int main(int argc, char **argv, char **envp) current_machine->boot_order =3D boot_order; current_machine->cpu_model =3D cpu_model; =20 - /* parse features once if machine provides default cpu_type */ if (machine_class->default_cpu_type) { current_machine->cpu_type =3D machine_class->default_cpu_type; @@ -4741,6 +4791,8 @@ int main(int argc, char **argv, char **envp) } } =20 + main_loop(); /* do monitor/qmp handling at preconfig state if requeste= d */ + machine_run_board_init(current_machine); =20 realtime_init(); --=20 2.7.4 From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508171252816287.744479685295; Mon, 16 Oct 2017 09:27:32 -0700 (PDT) Received: from localhost ([::1]:33995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Ea-0007i3-SM for importer@patchew.org; Mon, 16 Oct 2017 12:27:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48B0-0004jx-UK for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48Az-0007Hj-Tx for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49054) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48Az-0007HA-K9 for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC31F13A40; Mon, 16 Oct 2017 16:23:36 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CD8C600CE; Mon, 16 Oct 2017 16:23:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AC31F13A40 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:55 +0200 Message-Id: <1508170976-96869-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 16 Oct 2017 16:23:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 5/6] HMP: add set-numa-node command 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hmp.h | 1 + hmp-commands.hx | 13 +++++++++++++ hmp.c | 23 +++++++++++++++++++++++ numa.c | 19 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/hmp.h b/hmp.h index 3605003..6e87f46 100644 --- a/hmp.h +++ b/hmp.h @@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict= ); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); +void hmp_set_numa_node(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/hmp-commands.hx b/hmp-commands.hx index 1941e19..1f95b3f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1837,6 +1837,19 @@ Print QOM properties of object at location @var{path} ETEXI =20 { + .name =3D "set-numa-node", + .args_type =3D "numa:O", + .params =3D "see -numa CLI option for possible options", + .help =3D "assign CPU to numa node", + .cmd =3D hmp_set_numa_node, + }, + +STEXI +@item qom-set @var{path} @var{property} @var{value} +Set QOM property @var{property} of object at location @var{path} to value = @var{value} +ETEXI + + { .name =3D "qom-set", .args_type =3D "path:s,property:s,value:s", .params =3D "path property value", diff --git a/hmp.c b/hmp.c index 739d330..69bae5b 100644 --- a/hmp.c +++ b/hmp.c @@ -43,6 +43,7 @@ #include "hw/intc/intc.h" #include "migration/snapshot.h" #include "migration/misc.h" +#include "sysemu/numa.h" =20 #ifdef CONFIG_SPICE #include @@ -2896,3 +2897,25 @@ void hmp_info_memory_size_summary(Monitor *mon, cons= t QDict *qdict) } hmp_handle_error(mon, &err); } + +void hmp_set_numa_node(Monitor *mon, const QDict *qdict) +{ + QemuOpts *opts; + Error *err =3D NULL; + MachineState *ms =3D MACHINE(qdev_get_machine()); + + opts =3D qemu_opts_from_qdict(qemu_find_opts("numa"), qdict, &err); + if (err) { + goto end; + } + + parse_numa(ms, opts, &err); + if (err) { + goto end; + } + +end: + if (err) { + hmp_handle_error(mon, &err); + } +} diff --git a/numa.c b/numa.c index d8e7dc0..a530d9c 100644 --- a/numa.c +++ b/numa.c @@ -47,6 +47,12 @@ QemuOptsList qemu_numa_opts =3D { .desc =3D { { 0 } } /* validated with OptsVisitor */ }; =20 +static enum { + NUMA_DISABLED, /* no numa was configured */ + NUMA_ENABLED, /* numa configuration is in process */ + NUMA_COMPLETE, /* configuration is complete and can't be altered */ +} numa_is_configured; + static int have_memdevs =3D -1; static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one. * For all nodes, nodeid < max_numa_nodeid @@ -259,6 +265,18 @@ void parse_NumaOptions(MachineState *ms, NumaOptions *= object, Error **errp) { Error *err =3D NULL; =20 + if (numa_is_configured =3D=3D NUMA_COMPLETE) { + error_setg(&err, "NUMA configuration is finalized and can't be cha= nged," + " use CLI option or set-numa-node HMP/QMP command at" + " preconfig stage"); + goto end; + } else if (runstate_check(RUN_STATE_PRELAUNCH)) { + numa_is_configured =3D NUMA_ENABLED; + } else { + error_setg(&err, "NUMA is not enabled at start/preconfig stage"); + goto end; + } + switch (object->type) { case NUMA_OPTIONS_TYPE_NODE: parse_numa_node(ms, &object->u.node, &err); @@ -512,6 +530,7 @@ void numa_complete_configuration(MachineState *ms) } else { numa_set_mem_node_id(0, ram_size, 0); } + numa_is_configured =3D NUMA_COMPLETE; } =20 void parse_numa_opts(MachineState *ms) --=20 2.7.4 From nobody Sat May 4 05:23:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508171326981647.9597436993645; Mon, 16 Oct 2017 09:28:46 -0700 (PDT) Received: from localhost ([::1]:34007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48Fy-0000Au-A9 for importer@patchew.org; Mon, 16 Oct 2017 12:28:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e48B3-0004mT-Al for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e48B2-0007Jg-Dt for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e48B2-0007Ir-6Y for qemu-devel@nongnu.org; Mon, 16 Oct 2017 12:23:40 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 500DDC0587F1; Mon, 16 Oct 2017 16:23:39 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id F15F0600CE; Mon, 16 Oct 2017 16:23:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 500DDC0587F1 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 18:22:56 +0200 Message-Id: <1508170976-96869-7-git-send-email-imammedo@redhat.com> In-Reply-To: <1508170976-96869-1-git-send-email-imammedo@redhat.com> References: <1508170976-96869-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 16 Oct 2017 16:23:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 6/6] QMP: add set-numa-node command 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: peter.maydell@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Igor Mammedov --- hw/core/machine.c | 1 + numa.c | 5 +++++ qapi-schema.json | 13 +++++++++++++ 3 files changed, 19 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 1e1fca5..def9b9a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -22,6 +22,7 @@ #include "qemu/cutils.h" #include "sysemu/numa.h" #include "sysemu/qtest.h" +#include "qmp-commands.h" =20 static char *machine_get_accel(Object *obj, Error **errp) { diff --git a/numa.c b/numa.c index a530d9c..1c99fca 100644 --- a/numa.c +++ b/numa.c @@ -540,6 +540,11 @@ void parse_numa_opts(MachineState *ms) } } =20 +void qmp_set_numa_node(NumaOptions *cmd, Error **errp) +{ + parse_NumaOptions(MACHINE(qdev_get_machine()), cmd, errp); +} + void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **er= rp) { int node_id =3D object_property_get_int(OBJECT(dev), "node-id", &error= _abort); diff --git a/qapi-schema.json b/qapi-schema.json index a9dd043..600f87b 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3200,3 +3200,16 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @set-numa-node: +# +# Runtime equivalent of '-numa' CLI option, available at +# preconfigure stage to configure numa mapping before initializing +# machine. +# +# Since 2.10 +## +{ 'command': 'set-numa-node', 'boxed': true, + 'data': 'NumaOptions' +} --=20 2.7.4