qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17
@ 2017-01-12 17:53 Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 1/6] qom: remove unused header Eduardo Habkost
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

The following changes since commit 204febd17f9ebb9e94b1980b42c7f2c2307851c1:

  libqtest: handle zero length memwrite/memread (2017-01-12 10:45:59 +0000)

are available in the git repository at:

  git://github.com/ehabkost/qemu.git tags/x86-and-machine-pull-request

for you to fetch changes up to 8ed877b78498c89aa7ce5c76aa20841ff5072796:

  qmp: Report QOM type name on query-cpu-definitions (2017-01-12 15:51:36 -0200)

----------------------------------------------------------------
x86 and machine queue, 2017-01-17

Includes i386, CPU, NUMA, and memory backends changes.

i386:
 target/i386: Fix bad patch application to translate.c

CPU:
 qmp: Report QOM type name on query-cpu-definitions

NUMA:
 numa: make -numa parser dynamically allocate CPUs masks

Memory backends:
 qom: remove unused header
 monitor: reuse user_creatable_add_opts() instead of user_creatable_add()
 monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends

----------------------------------------------------------------

Doug Evans (1):
  target/i386: Fix bad patch application to translate.c

Eduardo Habkost (1):
  qmp: Report QOM type name on query-cpu-definitions

Igor Mammedov (4):
  qom: remove unused header
  monitor: reuse user_creatable_add_opts() instead of
    user_creatable_add()
  monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends
  numa: make -numa parser dynamically allocate CPUs masks

 docs/qmp-commands.txt           |  1 +
 qapi-schema.json                |  8 ++++-
 include/qom/object_interfaces.h | 17 ---------
 include/sysemu/hostmem.h        |  1 +
 include/sysemu/numa.h           |  2 +-
 include/sysemu/sysemu.h         |  7 ----
 backends/hostmem.c              | 26 ++++++++++++++
 hmp.c                           | 10 ++----
 numa.c                          | 24 +++++++++----
 qom/object_interfaces.c         | 78 ++++++++++++-----------------------------
 target/arm/helper.c             |  1 +
 target/i386/cpu.c               |  1 +
 target/i386/translate.c         | 10 +++---
 target/ppc/translate_init.c     |  1 +
 target/s390x/cpu_models.c       |  1 +
 vl.c                            |  5 ---
 16 files changed, 87 insertions(+), 106 deletions(-)

-- 
2.11.0.259.g40922b1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 1/6] qom: remove unused header
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 2/6] monitor: reuse user_creatable_add_opts() instead of user_creatable_add() Eduardo Habkost
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1484052795-158195-2-git-send-email-imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qom/object_interfaces.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index ded4d84c85..4b880d077c 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -3,7 +3,6 @@
 #include "qom/object_interfaces.h"
 #include "qemu/module.h"
 #include "qapi-visit.h"
-#include "qapi/qobject-output-visitor.h"
 #include "qapi/opts-visitor.h"
 
 void user_creatable_complete(Object *obj, Error **errp)
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 2/6] monitor: reuse user_creatable_add_opts() instead of user_creatable_add()
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 1/6] qom: remove unused header Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 3/6] monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends Eduardo Habkost
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Simplify code by dropping ~57LOC by merging user_creatable_add()
into user_creatable_add_opts() and using the later from monitor.
Along with it allocate opts_visitor_new() once in user_creatable_add_opts().

As result we have one less API func and a more readable/simple
user_creatable_add_opts() vs user_creatable_add().

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1484052795-158195-3-git-send-email-imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/qom/object_interfaces.h | 17 ----------
 hmp.c                           |  5 +--
 qom/object_interfaces.c         | 71 ++++++++++-------------------------------
 3 files changed, 18 insertions(+), 75 deletions(-)

diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index 8b17f4def7..fdd7603c84 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -76,23 +76,6 @@ void user_creatable_complete(Object *obj, Error **errp);
 bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp);
 
 /**
- * user_creatable_add:
- * @qdict: the object definition
- * @v: the visitor
- * @errp: if an error occurs, a pointer to an area to store the error
- *
- * Create an instance of the user creatable object whose type
- * is defined in @qdict by the 'qom-type' field, placing it
- * in the object composition tree with name provided by the
- * 'id' field. The remaining fields in @qdict are used to
- * initialize the object properties.
- *
- * Returns: the newly created object or NULL on error
- */
-Object *user_creatable_add(const QDict *qdict,
-                           Visitor *v, Error **errp);
-
-/**
  * user_creatable_add_type:
  * @type: the object type name
  * @id: the unique ID for the object
diff --git a/hmp.c b/hmp.c
index b86961705d..e7bead5a1d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1808,7 +1808,6 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
     QemuOpts *opts;
-    Visitor *v;
     Object *obj = NULL;
 
     opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err);
@@ -1817,9 +1816,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    v = opts_visitor_new(opts);
-    obj = user_creatable_add(qdict, v, &err);
-    visit_free(v);
+    obj = user_creatable_add_opts(opts, &err);
     qemu_opts_del(opts);
 
     if (err) {
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 4b880d077c..9b4155a227 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -34,57 +34,6 @@ bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp)
     }
 }
 
-
-Object *user_creatable_add(const QDict *qdict,
-                           Visitor *v, Error **errp)
-{
-    char *type = NULL;
-    char *id = NULL;
-    Object *obj = NULL;
-    Error *local_err = NULL;
-    QDict *pdict;
-
-    pdict = qdict_clone_shallow(qdict);
-
-    visit_start_struct(v, NULL, NULL, 0, &local_err);
-    if (local_err) {
-        goto out;
-    }
-
-    qdict_del(pdict, "qom-type");
-    visit_type_str(v, "qom-type", &type, &local_err);
-    if (local_err) {
-        goto out_visit;
-    }
-
-    qdict_del(pdict, "id");
-    visit_type_str(v, "id", &id, &local_err);
-    if (local_err) {
-        goto out_visit;
-    }
-    visit_check_struct(v, &local_err);
-    if (local_err) {
-        goto out_visit;
-    }
-
-    obj = user_creatable_add_type(type, id, pdict, v, &local_err);
-
-out_visit:
-    visit_end_struct(v, NULL);
-
-out:
-    QDECREF(pdict);
-    g_free(id);
-    g_free(type);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        object_unref(obj);
-        return NULL;
-    }
-    return obj;
-}
-
-
 Object *user_creatable_add_type(const char *type, const char *id,
                                 const QDict *qdict,
                                 Visitor *v, Error **errp)
@@ -157,13 +106,27 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error **errp)
 {
     Visitor *v;
     QDict *pdict;
-    Object *obj = NULL;
+    Object *obj;
+    const char *id = qemu_opts_id(opts);
+    const char *type = qemu_opt_get(opts, "qom-type");
+
+    if (!type) {
+        error_setg(errp, QERR_MISSING_PARAMETER, "qom-type");
+        return NULL;
+    }
+    if (!id) {
+        error_setg(errp, QERR_MISSING_PARAMETER, "id");
+        return NULL;
+    }
 
-    v = opts_visitor_new(opts);
     pdict = qemu_opts_to_qdict(opts, NULL);
+    qdict_del(pdict, "qom-type");
+    qdict_del(pdict, "id");
 
-    obj = user_creatable_add(pdict, v, errp);
+    v = opts_visitor_new(opts);
+    obj = user_creatable_add_type(type, id, pdict, v, errp);
     visit_free(v);
+
     QDECREF(pdict);
     return obj;
 }
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 3/6] monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 1/6] qom: remove unused header Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 2/6] monitor: reuse user_creatable_add_opts() instead of user_creatable_add() Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 4/6] target/i386: Fix bad patch application to translate.c Eduardo Habkost
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

Considering 'id' is mandatory for user_creatable objects/backends
and user_creatable_add_type() always has it as an argument
regardless of where from it is called CLI/monitor or QMP,
Fix issue by adding 'id' property to hostmem backends and
set it in user_creatable_add_type() for every object that
implements 'id' property. Then later at query-memdev time
get 'id' from object directly.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1484052795-158195-4-git-send-email-imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 docs/qmp-commands.txt    |  1 +
 qapi-schema.json         |  3 +++
 include/sysemu/hostmem.h |  1 +
 backends/hostmem.c       | 26 ++++++++++++++++++++++++++
 hmp.c                    |  5 +----
 numa.c                   |  3 +++
 qom/object_interfaces.c  |  6 ++++++
 7 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/docs/qmp-commands.txt b/docs/qmp-commands.txt
index abf210a596..18db4cdb82 100644
--- a/docs/qmp-commands.txt
+++ b/docs/qmp-commands.txt
@@ -3529,6 +3529,7 @@ Example (1):
          "policy": "bind"
        },
        {
+         "id": "mem1",
          "size": 536870912,
          "merge": false,
          "dump": true,
diff --git a/qapi-schema.json b/qapi-schema.json
index eab8d4a9ee..e42998edec 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4457,6 +4457,8 @@
 #
 # Information about memory backend
 #
+# @id: #optional backend's ID if backend has 'id' property (since 2.9)
+#
 # @size: memory backend size
 #
 # @merge: enables or disables memory merge support
@@ -4473,6 +4475,7 @@
 ##
 { 'struct': 'Memdev',
   'data': {
+    '*id':        'str',
     'size':       'size',
     'merge':      'bool',
     'dump':       'bool',
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index 678232af40..ecae0cff19 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -52,6 +52,7 @@ struct HostMemoryBackend {
     Object parent;
 
     /* protected */
+    char *id;
     uint64_t size;
     bool merge, dump;
     bool prealloc, force_prealloc, is_mapped;
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 4256d24acb..7f5de70609 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -348,6 +348,24 @@ host_memory_backend_can_be_deleted(UserCreatable *uc, Error **errp)
     }
 }
 
+static char *get_id(Object *o, Error **errp)
+{
+    HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+    return g_strdup(backend->id);
+}
+
+static void set_id(Object *o, const char *str, Error **errp)
+{
+    HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+    if (backend->id) {
+        error_setg(errp, "cannot change property value");
+        return;
+    }
+    backend->id = g_strdup(str);
+}
+
 static void
 host_memory_backend_class_init(ObjectClass *oc, void *data)
 {
@@ -377,6 +395,13 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
         HostMemPolicy_lookup,
         host_memory_backend_get_policy,
         host_memory_backend_set_policy, &error_abort);
+    object_class_property_add_str(oc, "id", get_id, set_id, &error_abort);
+}
+
+static void host_memory_backend_finalize(Object *o)
+{
+    HostMemoryBackend *backend = MEMORY_BACKEND(o);
+    g_free(backend->id);
 }
 
 static const TypeInfo host_memory_backend_info = {
@@ -387,6 +412,7 @@ static const TypeInfo host_memory_backend_info = {
     .class_init = host_memory_backend_class_init,
     .instance_size = sizeof(HostMemoryBackend),
     .instance_init = host_memory_backend_init,
+    .instance_finalize = host_memory_backend_finalize,
     .interfaces = (InterfaceInfo[]) {
         { TYPE_USER_CREATABLE },
         { }
diff --git a/hmp.c b/hmp.c
index e7bead5a1d..8522efea26 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2078,13 +2078,11 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
     MemdevList *m = memdev_list;
     Visitor *v;
     char *str;
-    int i = 0;
-
 
     while (m) {
         v = string_output_visitor_new(false, &str);
         visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
-        monitor_printf(mon, "memory backend: %d\n", i);
+        monitor_printf(mon, "memory backend: %s\n", m->value->id);
         monitor_printf(mon, "  size:  %" PRId64 "\n", m->value->size);
         monitor_printf(mon, "  merge: %s\n",
                        m->value->merge ? "true" : "false");
@@ -2100,7 +2098,6 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
         g_free(str);
         visit_free(v);
         m = m->next;
-        i++;
     }
 
     monitor_printf(mon, "\n");
diff --git a/numa.c b/numa.c
index 9c09e45e7d..f5fc7da3e9 100644
--- a/numa.c
+++ b/numa.c
@@ -518,6 +518,9 @@ static int query_memdev(Object *obj, void *opaque)
 
         m->value = g_malloc0(sizeof(*m->value));
 
+        m->value->id = object_property_get_str(obj, "id", NULL);
+        m->value->has_id = !!m->value->id;
+
         m->value->size = object_property_get_int(obj, "size",
                                                  &error_abort);
         m->value->merge = object_property_get_bool(obj, "merge",
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 9b4155a227..03a95c3276 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -62,6 +62,12 @@ Object *user_creatable_add_type(const char *type, const char *id,
 
     assert(qdict);
     obj = object_new(type);
+    if (object_property_find(obj, "id", NULL)) {
+        object_property_set_str(obj, id, "id", &local_err);
+        if (local_err) {
+            goto out;
+        }
+    }
     visit_start_struct(v, NULL, NULL, 0, &local_err);
     if (local_err) {
         goto out;
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 4/6] target/i386: Fix bad patch application to translate.c
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
                   ` (2 preceding siblings ...)
  2017-01-12 17:53 ` [Qemu-devel] [PULL 3/6] monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 5/6] numa: make -numa parser dynamically allocate CPUs masks Eduardo Habkost
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov, Doug Evans

From: Doug Evans <dje@google.com>

In commit c52ab08aee6f7d4717fc6b517174043126bd302f,
the patch snippet for the "syscall" insn got applied to "iret".

Signed-off-by: Doug Evans <dje@google.com>
Message-Id: <f403045cde4049058c05446d5c04@google.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/translate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/i386/translate.c b/target/i386/translate.c
index 59e11fcd1f..7adfff09fc 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -6435,10 +6435,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
                                       tcg_const_i32(s->pc - s->cs_base));
             set_cc_op(s, CC_OP_EFLAGS);
         }
-        /* TF handling for the syscall insn is different. The TF bit is checked
-           after the syscall insn completes. This allows #DB to not be
-           generated after one has entered CPL0 if TF is set in FMASK.  */
-        gen_eob_worker(s, false, true);
+        gen_eob(s);
         break;
     case 0xe8: /* call im */
         {
@@ -7119,7 +7116,10 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
         gen_update_cc_op(s);
         gen_jmp_im(pc_start - s->cs_base);
         gen_helper_syscall(cpu_env, tcg_const_i32(s->pc - pc_start));
-        gen_eob(s);
+        /* TF handling for the syscall insn is different. The TF bit is  checked
+           after the syscall insn completes. This allows #DB to not be
+           generated after one has entered CPL0 if TF is set in FMASK.  */
+        gen_eob_worker(s, false, true);
         break;
     case 0x107: /* sysret */
         if (!s->pe) {
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 5/6] numa: make -numa parser dynamically allocate CPUs masks
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
                   ` (3 preceding siblings ...)
  2017-01-12 17:53 ` [Qemu-devel] [PULL 4/6] target/i386: Fix bad patch application to translate.c Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-12 17:53 ` [Qemu-devel] [PULL 6/6] qmp: Report QOM type name on query-cpu-definitions Eduardo Habkost
  2017-01-13 17:17 ` [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

so it won't impose an additional limits on max_cpus limits
supported by different targets.

It removes global MAX_CPUMASK_BITS constant and need to
bump it up whenever max_cpus is being increased for
a target above MAX_CPUMASK_BITS value.

Use runtime max_cpus value instead to allocate sufficiently
sized node_cpu bitmasks in numa parser.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1479466974-249781-1-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[ehabkost: Added asserts to ensure cpu_index < max_cpus]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/numa.h   |  2 +-
 include/sysemu/sysemu.h |  7 -------
 numa.c                  | 21 ++++++++++++++-------
 vl.c                    |  5 -----
 4 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index 4da808a6e9..8f09dcf918 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -17,7 +17,7 @@ struct numa_addr_range {
 
 typedef struct node_info {
     uint64_t node_mem;
-    DECLARE_BITMAP(node_cpu, MAX_CPUMASK_BITS);
+    unsigned long *node_cpu;
     struct HostMemoryBackend *node_memdev;
     bool present;
     QLIST_HEAD(, numa_addr_range) addr; /* List to store address ranges */
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 66c6f1577e..cccde56454 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -168,13 +168,6 @@ extern int mem_prealloc;
 #define MAX_NODES 128
 #define NUMA_NODE_UNASSIGNED MAX_NODES
 
-/* The following shall be true for all CPUs:
- *   cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS
- *
- * Note that cpu->get_arch_id() may be larger than MAX_CPUMASK_BITS.
- */
-#define MAX_CPUMASK_BITS 288
-
 #define MAX_OPTION_ROMS 16
 typedef struct QEMUOptionRom {
     const char *name;
diff --git a/numa.c b/numa.c
index f5fc7da3e9..379bc8a140 100644
--- a/numa.c
+++ b/numa.c
@@ -266,20 +266,19 @@ static char *enumerate_cpus(unsigned long *cpus, int max_cpus)
 static void validate_numa_cpus(void)
 {
     int i;
-    DECLARE_BITMAP(seen_cpus, MAX_CPUMASK_BITS);
+    unsigned long *seen_cpus = bitmap_new(max_cpus);
 
-    bitmap_zero(seen_cpus, MAX_CPUMASK_BITS);
     for (i = 0; i < nb_numa_nodes; i++) {
-        if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu,
-                              MAX_CPUMASK_BITS)) {
+        if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) {
             bitmap_and(seen_cpus, seen_cpus,
-                       numa_info[i].node_cpu, MAX_CPUMASK_BITS);
+                       numa_info[i].node_cpu, max_cpus);
             error_report("CPU(s) present in multiple NUMA nodes: %s",
                          enumerate_cpus(seen_cpus, max_cpus));
+            g_free(seen_cpus);
             exit(EXIT_FAILURE);
         }
         bitmap_or(seen_cpus, seen_cpus,
-                  numa_info[i].node_cpu, MAX_CPUMASK_BITS);
+                  numa_info[i].node_cpu, max_cpus);
     }
 
     if (!bitmap_full(seen_cpus, max_cpus)) {
@@ -291,12 +290,17 @@ static void validate_numa_cpus(void)
                      "in NUMA config");
         g_free(msg);
     }
+    g_free(seen_cpus);
 }
 
 void parse_numa_opts(MachineClass *mc)
 {
     int i;
 
+    for (i = 0; i < MAX_NODES; i++) {
+        numa_info[i].node_cpu = bitmap_new(max_cpus);
+    }
+
     if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL)) {
         exit(1);
     }
@@ -362,7 +366,7 @@ void parse_numa_opts(MachineClass *mc)
         numa_set_mem_ranges();
 
         for (i = 0; i < nb_numa_nodes; i++) {
-            if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) {
+            if (!bitmap_empty(numa_info[i].node_cpu, max_cpus)) {
                 break;
             }
         }
@@ -397,6 +401,7 @@ void numa_post_machine_init(void)
 
     CPU_FOREACH(cpu) {
         for (i = 0; i < nb_numa_nodes; i++) {
+            assert(cpu->cpu_index < max_cpus);
             if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
                 cpu->numa_node = i;
             }
@@ -558,6 +563,8 @@ int numa_get_node_for_cpu(int idx)
 {
     int i;
 
+    assert(idx < max_cpus);
+
     for (i = 0; i < nb_numa_nodes; i++) {
         if (test_bit(idx, numa_info[i].node_cpu)) {
             break;
diff --git a/vl.c b/vl.c
index a23de18fa9..c643d3ff3a 100644
--- a/vl.c
+++ b/vl.c
@@ -1277,11 +1277,6 @@ static void smp_parse(QemuOpts *opts)
 
         max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus);
 
-        if (max_cpus > MAX_CPUMASK_BITS) {
-            error_report("unsupported number of maxcpus");
-            exit(1);
-        }
-
         if (max_cpus < cpus) {
             error_report("maxcpus must be equal to or greater than smp");
             exit(1);
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 6/6] qmp: Report QOM type name on query-cpu-definitions
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
                   ` (4 preceding siblings ...)
  2017-01-12 17:53 ` [Qemu-devel] [PULL 5/6] numa: make -numa parser dynamically allocate CPUs masks Eduardo Habkost
@ 2017-01-12 17:53 ` Eduardo Habkost
  2017-01-13 17:17 ` [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2017-01-12 17:53 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, qemu-devel, Richard Henderson, Marcel Apfelbaum,
	Igor Mammedov

The new typename attribute on query-cpu-definitions will be used
to help management software use device-list-properties to check
which properties can be set using -cpu or -global for the CPU
model.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1479320499-29818-1-git-send-email-ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qapi-schema.json            | 5 ++++-
 target/arm/helper.c         | 1 +
 target/i386/cpu.c           | 1 +
 target/ppc/translate_init.c | 1 +
 target/s390x/cpu_models.c   | 1 +
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index e42998edec..ce20f16757 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3221,6 +3221,9 @@
 # @unavailable-features: #optional List of properties that prevent
 #                        the CPU model from running in the current
 #                        host. (since 2.8)
+# @typename: Type name that can be used as argument to @device-list-properties,
+#            to introspect properties configurable using -cpu or -global.
+#            (since 2.9)
 #
 # @unavailable-features is a list of QOM property names that
 # represent CPU model attributes that prevent the CPU from running.
@@ -3242,7 +3245,7 @@
 ##
 { 'struct': 'CpuDefinitionInfo',
   'data': { 'name': 'str', '*migration-safe': 'bool', 'static': 'bool',
-            '*unavailable-features': [ 'str' ] } }
+            '*unavailable-features': [ 'str' ], 'typename': 'str' } }
 
 ##
 # @query-cpu-definitions:
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 8dcabbf576..9f1a335e3f 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -5214,6 +5214,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
     info = g_malloc0(sizeof(*info));
     info->name = g_strndup(typename,
                            strlen(typename) - strlen("-" TYPE_ARM_CPU));
+    info->q_typename = g_strdup(typename);
 
     entry = g_malloc0(sizeof(*entry));
     entry->value = info;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b0640f1e38..a149c8dc42 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2235,6 +2235,7 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
     info->name = x86_cpu_class_get_model_name(cc);
     x86_cpu_class_check_missing_features(cc, &info->unavailable_features);
     info->has_unavailable_features = true;
+    info->q_typename = g_strdup(object_class_get_name(oc));
 
     entry = g_malloc0(sizeof(*entry));
     entry->value = info;
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 626e03186c..19ef2505e4 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -10305,6 +10305,7 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
 
         info = g_malloc0(sizeof(*info));
         info->name = g_strdup(alias->alias);
+        info->q_typename = g_strdup(object_class_get_name(oc));
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index c1e729df5e..5b66d3325d 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -290,6 +290,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
     info->has_migration_safe = true;
     info->migration_safe = scc->is_migration_safe;
     info->q_static = scc->is_static;
+    info->q_typename = g_strdup(object_class_get_name(klass));
 
 
     entry = g_malloc0(sizeof(*entry));
-- 
2.11.0.259.g40922b1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17
  2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
                   ` (5 preceding siblings ...)
  2017-01-12 17:53 ` [Qemu-devel] [PULL 6/6] qmp: Report QOM type name on query-cpu-definitions Eduardo Habkost
@ 2017-01-13 17:17 ` Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2017-01-13 17:17 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, QEMU Developers, Richard Henderson,
	Marcel Apfelbaum, Igor Mammedov

On 12 January 2017 at 17:53, Eduardo Habkost <ehabkost@redhat.com> wrote:
> The following changes since commit 204febd17f9ebb9e94b1980b42c7f2c2307851c1:
>
>   libqtest: handle zero length memwrite/memread (2017-01-12 10:45:59 +0000)
>
> are available in the git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/x86-and-machine-pull-request
>
> for you to fetch changes up to 8ed877b78498c89aa7ce5c76aa20841ff5072796:
>
>   qmp: Report QOM type name on query-cpu-definitions (2017-01-12 15:51:36 -0200)
>
> ----------------------------------------------------------------
> x86 and machine queue, 2017-01-17
>
> Includes i386, CPU, NUMA, and memory backends changes.
>
> i386:
>  target/i386: Fix bad patch application to translate.c
>
> CPU:
>  qmp: Report QOM type name on query-cpu-definitions
>
> NUMA:
>  numa: make -numa parser dynamically allocate CPUs masks
>
> Memory backends:
>  qom: remove unused header
>  monitor: reuse user_creatable_add_opts() instead of user_creatable_add()
>  monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-01-13 17:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-12 17:53 [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 1/6] qom: remove unused header Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 2/6] monitor: reuse user_creatable_add_opts() instead of user_creatable_add() Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 3/6] monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 4/6] target/i386: Fix bad patch application to translate.c Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 5/6] numa: make -numa parser dynamically allocate CPUs masks Eduardo Habkost
2017-01-12 17:53 ` [Qemu-devel] [PULL 6/6] qmp: Report QOM type name on query-cpu-definitions Eduardo Habkost
2017-01-13 17:17 ` [Qemu-devel] [PULL 0/6] x86 and machine queue, 2017-01-17 Peter Maydell

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).