[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [Qemu-devel] [PATCH v3] numa: improve cpu hotplug error m

From: Laurent Vivier
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v3] numa: improve cpu hotplug error message with a wrong node-id
Date: Fri, 24 May 2019 16:39:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 24/05/2019 16:10, Igor Mammedov wrote:
On Fri, 24 May 2019 12:35:21 +0200
Laurent Vivier <address@hidden> wrote:

On pseries, core-ids are strongly binded to a node-id by the command
line option. If an user tries to add a CPU to the wrong node, he has
an error but it is not really helpful:

   qemu-system-ppc64 ... -smp 1,maxcpus=64,cores=1,threads=1,sockets=1 \
                         -numa node,nodeid=0 -numa node,nodeid=1 ...

   (qemu) device_add power9_v2.0-spapr-cpu-core,core-id=30,node-id=1
   Error: node-id=1 must match numa node specified with -numa option

This patch improves this error message by giving to the user the good
topology information (node-id, socket-id and thread-id if they are
available) to use with the core-id he's providing:

   Error: node-id=1 must match numa node specified with -numa option 'node-id 0'

Signed-off-by: Laurent Vivier <address@hidden>

     v3: only add the topology to the existing message
         As suggested by Igor replace
           Error: core-id 30 can only be plugged into node-id 0
           Error: node-id=1 must match numa node specified with -numa option 
'node-id 0'
v2: display full topology in the error message

  numa.c | 25 ++++++++++++++++++++++++-
  1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/numa.c b/numa.c
index 3875e1efda3a..7882ec294be4 100644
--- a/numa.c
+++ b/numa.c
@@ -458,6 +458,27 @@ void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
      set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
+static char *cpu_topology_to_string(const CPUArchId *cpu)
+    GString *s = g_string_new(NULL);
+    if (cpu->props.has_socket_id) {
+        g_string_append_printf(s, "socket-id %"PRId64, cpu->props.socket_id);
+    }
+    if (cpu->props.has_node_id) {
+        if (s->len) {
+            g_string_append_printf(s, ", ");
+        }
+        g_string_append_printf(s, "node-id %"PRId64, cpu->props.node_id);
+    }
+    if (cpu->props.has_thread_id) {
+        if (s->len) {
+            g_string_append_printf(s, ", ");
+        }
+        g_string_append_printf(s, "thread-id %"PRId64, cpu->props.thread_id);
+    }
+    return g_string_free(s, false);

turns out we already have such helper: cpu_slot_to_string()

It doesn't display the node-id but the core-id. And node-id is what we need to know.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]